oracle 日常檢查

1,Shmmax 是核心參數中最重要的參數之一,用於定義單個共享內存段的最大值,shmmax 設置應該足夠大,能在一個共享內存段下容納下整個的SGA ,
         設置的過低可能會導致需要創建多個共享內存段,這樣可能導致系統性能的下降.
         一般設置shmmax >=SGA (32Bit 系統是否支持到1.7G 以上SGA 需要注意) 。如果是64Bit 的Linux 操作系統,shmmax 設置爲大於SGA_MAX_SIZE 即可。
         Ipcs -sa 可以看到共享內存段個數
2,

1,檢查磁盤空間使用情況
select tablespace_name,count(*) chunks,max(bytes)/1024/1024 max_chunk,sum(bytes)/1024/1024 tatal_space from dba_free_space group by tablespace_name;
2,檢查是否有失效的索引
select tablespace_name,count(*) chunks,max(bytes)/1024/1024 max_chunk,sum(bytes)/1024/1024 tatal_space from dba_free_space group by tablespace_name;
3,檢查是否有無效的對象
col object_name format a25;
select object_name,object_type,owner,status from dba_objects where status !='VALID' and owner not in ('SYS','SYSTEM')

select owner,object_name,object_type from dba_objects where status='INVALID';
4,檢查sequence使用
set linesize 120
select sequence_owner,sequence_name,min_value,max_value,increment_by,last_number,cache_size,cycle_flag from dba_sequences;

5,檢查是否有運行失敗的job
col what format a20;
select job,this_date,this_sec,next_date,next_sec,failures,what from dba_jobs where failures !=0 or failures is not null;
6,檢查SGA的使用情況
select * from v$sgastat;
select pool,count(pool),sum(bytes)/1024/1024 from v$sgastat group by pool;

7,檢查回滾段使用情況
select n.name,wraps,extends,shrinks,optsize,waits,xacts,aveactive,hwmsize from v$rollstat r, v$rollname n where r.usn=n.usn;
8,檢查是否有用戶的缺省表空間和臨時表空間設置爲SYSTEM表空間
select username,default_tablespace,temporary_tablespace from dba_users;
9,檢查數據文件的自動增長是否關閉
select file_name,autoextensible from dba_data_files where autoextensible='SYS';

10,檢查表空間的使用情況
select a.tablespace_name,round((total-free)/total,3)*100 pecent from (select tablespace_name,sum(bytes) free from dba_free_space group by tablespace_name) a,(select tablespace_name,sum(bytes) total from dba_data_files group by tablespace_name) b where a.tablespace_name=b.tablespace_name;
11,檢查剩餘表空間
select tablespace_name,sum(blocks) as free_blk,trunc(sum(bytes)/(1024*1024)) as free_m,max(bytes)/(1024) as big_chunk_k,count(*) as num_chunks from dba_free_space group by tablespace_name;

12,檢查不起作用的約束
select owner,constraint_name,table_name,constraint_type,status from dba_constraints where status='DISABLED' and constraint_type='p';
13,檢查無效的trigger
 select owner,trigger_name,table_name,status from dba_triggers where status='DISABLED';

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章