檢視資料庫 Oracle資料庫技術與實驗指導

2021-10-09 20:43:49 字數 2708 閱讀 4618

1.檢視表空間的名稱及大小

select tablespace_name,min_extents,max_extents,pct_increase,status from dba_tablespaces;

select tablespace_name,initial_extent,next_extent,contents,logging,extent_management,allocation_type from dba_tablespaces order by tablespace_name;

select t.tablespace_name, round(sum(bytes / (1024 * 1024)), 0) ts_size from dba_tablespaces t, dba_data_files d where t.tablespace_name = d.tablespace_name group by t.tablespace_name;

2.檢視表空間物理檔案的名稱及大小

column db_block_size new_value blksz noprint;

select value db_block_size from v$parameter where name='db_block_size';

column tablespace_name format a16;

column file_name format a60;

set linesize 160;

select file_name,round(bytes/(1024*1024),0) total_space,autoextensible,increment_by*&blksz/(1024*1024) as incement,maxbytes/(1024*1024) as maxsize from dba_data_files order by tablespace_name;

select tablespace_name, file_id,file_name, round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name;

3.檢視回滾段名稱及大小

select a.owner||' . '||a.segment_name roll_name , a.tablespace_name tablespace , to_char(a.initial_extent)||'/'||to_char(a.next_extent) in_extents , to_char(a.min_extents)||'/'||to_char(a.max_extents)m_extents,a.status status,b.bytes bytes , b.extents extents , d.shrinks shrinks , d.wraps wraps , d.optsize opt from dba_rollback_segs a , dba_segments b , v$rollname c , v$rollstat d where a.segment_name = b.segment_name and a.segment_name = c.name (+) and c.usn = d.usn (+) order by a.segment_name;

select segment_name, tablespace_name, r.status,(initial_extent/1024) initialextent,(next_extent/1024) nextextent,max_extents, v.curext curextent from dba_rollback_segs r, v$rollstat v where r.segment_id = v.usn(+) order by segment_name ;

4.檢視控制檔案

select name from v$controlfile;
5.檢視日誌檔案

select member from v$logfile;
6.檢視表空間的使用情況

select * from( select sum(bytes)/(1024*1024)  as "free_space(m)",tablespace_name from dba_free_space group by tablespace_name) order by "free_space(m)";
7.檢視資料庫庫物件

select owner, object_type, status, count(*) count# from all_objects group by owner,object_type,status;
8.檢視資料庫的版本

select * from v$version;

select version from product_component_version where substr(product,1,6)='oracle';

9.檢視資料庫的建立日期和歸檔方式

select created,log_mode,log_mode from v$database;
10.檢視臨時資料庫檔案

select status, enabled, name from v$tempfile;

檢視Oracle資料庫狀態

show sga set wrap off set linesize 400 檢視正在執行的後台程序 select from v bgprocess select from v bgprocess where paddr 00 檢視資料庫的物理組成 檔案情況 select from v contro...

Oracle檢視資料庫結構

用sql語句檢視資料庫就夠,前提針對自己可見的表,如下語句,檢視表結構方式 1.select a.column name 欄位名,a.data type 資料型別,a.data length 長度,a.data precision 整數字,a.data scale 小數字,a.nullable 允許...

檢視oracle資料庫鎖

方法一 檢視產生鎖的程序id 在資料庫伺服器上 主機 如應用伺服器 等等 select s.machine sourse host,p.spid pid,l.session id sid,s.serial l.locked mode,l.oracle username,s.user l.os use...