You are on page 1of 8

Oracle Database Health Check List #

1 2 3 4 5 6 7 8

Checks
Instance state # of database connections Checking Error Log File CPU utilization Check PID of top query Connect to Databse Run Database Statspack Database Instance status

Get details of top PID (from OS)

10

Check tablespace used / free space

11 12 13 14

Check sessions count Check Blocking sessions Check waiting sessions Check temp tbs usage Check long running sessions

15

16 17

Check details of old sessions

Check tables analyzed status Check indexes analyzed 18 status

19

Check DB file with high reads/writes

20

Check parameter change requirement

21 Re-Run Database Statspack 22 23 24 Get Statspack Report and Analyze the report Get Long Running Queries Caculate Undo Retention

25 26

How to Remove Locks Get Locked objects by users

27 28 29` 30 31 32 33 34 35 36 37

How to Find full Table Scans Get Sql for a particular process id Database details for unix process id Compile Invalid Objects Memory for inactive sessions Steps to trace a users activities Database Growth Monthly Display SGA Statistics Show Database versions with options installed Gathering Statistics Performance issues after increasing work loads

C:\Docum ent\ Perform ance_issues_aftre_workload. doc

38

Enable/Disable Triggers

C :\D ocum ent \ C ent ral \Not es\A t os\Recov ery _scenari os. doc

C :\D ocum ent \ C ent ral \Not es\A t os\Recov ery _scenari os. doc

39

Recovery Scenarios Reorg activity for TG121 database Script for Instance information

40 41

42

Show Used/free space in Meg by tablespace name

43

Shows current size, used & freespace within the datafiles.

44

Shows whether the TBS is fragmented and the type of fragmentation.

45

List analyzed tables with unanalyzed indexes

46 47

DBA health check script Get DDL for tablespaces and objects

Oracle Database Health Check List Command


ps -ef | grep pmon_ | grep -v grep ps -ef | grep "$ORACLE_SID" | grep "(LOCAL=NO)" | grep -v grep | wc -l tail -100 alert_$ORACLE_SID.log sar 2 5 prstat -a (SUN) OR topas (AIX) OR top (LINUX) sqlplus "/ as sysdba" exec statspack.snap(7); Select instance_name,status from v$instance; SELECT b.osuser, b.username, b.program, b.sid, b.serial#, c.disk_reads, c.executions, c.buffer_gets, b.terminal, b.sql_hash_value,c.module, c.sql_text FROM v$sqlarea c, v$session b, v$process a WHERE a.spid='&process_id' AND b.paddr = a.addr AND c.hash_value = b.sql_hash_value AND b.sql_address = c.address; select a.tablespace_name, ceil(sum(a.tots)/1024/1024) "AllocatedSize(MB)", round((sum(a.tots)-sum(a.sumb))/1024/1024,1) "Used(MB)", round(((sum(a.tots)-sum(a.sumb))/sum(a.tots))*100,1) "Used%", round(sum(a.sumb)/1024/1024,1) "Free(MB)", round(sum(a.sumb)*100/sum(a.tots),1) "Free%", round(sum(a.largest)/1024/1024,1) "LargestFreeSize(MB)", sum(a.chunks) "ChunksFree" from (select tablespace_name, 0 tots,sum(bytes) sumb, max(bytes) largest, count(*) chunks from dba_free_space a group by tablespace_name union select tablespace_name, sum(bytes) tots, 0, 0, 0 from dba_data_files group by tablespace_name union select tablespace_name, sum(bytes), 0,0,0 from dba_temp_files group by tablespace_name) a, dba_tablespaces b where a.tablespace_name = b.tablespace_name and b.contents not in ('TEMPORARY', 'UNDO') group by a.tablespace_name order by 1; select count(*) from v$session; select * from dba_blockers; select * from dba_waiters; select * from v$sort_usage; select sid, serial#, OPNAME, to_char(START_TIME,'dd-mon-yyyy hh24:mi:ss') starttime,to_char(LAST_UPDATE_TIME,'dd-mon-yyyy hh24:mi:ss') lastupdatetime, TIME_REMAINING, ELAPSED_SECONDS, MESSAGE, SQL_HASH_VALUE from v$session_longops where sofar!=totalwork; select sid, serial#,program,terminal, machine, to_char(logon_time, 'dd-mon-yyyy hh24:mi:ss') time , status,last_call_et from v$session where logon_time < to_char(sysdate,'dd-mon-yyyy') and status <> 'ACTIVE' order by time; select to_char(last_analyzed,'dd-mon-yyyy'), owner, count(*) from dba_tables group by to_char(last_analyzed,'dd-mon-yyyy') , owner; select to_char(last_analyzed,'dd-mon-yyyy'), owner, count(*) from dba_indexes group by to_char(last_analyzed,'dd-mon-yyyy') , owner;

select a.file#, b.file_name, a.singleblkrds, a.singleblkrdtim, a.singleblkrdtim/a.singleblkrds average_wait from v$filestat a, dba_data_files b where a.file# = b.file_id and a.singleblkrds > 0 order by average_wait

exec statspack.snap(7); in 9i @?/rdbms/admin/spreport.sql in 10g- @?/rdbms/admin/awrrpt.sql or @?/rdbms/admin/addmrpt.sql SELECT * FROM (select username,opname,sid,serial#,context,sofar,totalwork ,round(sofar/totalwork*100,2) "% Complete" from v$session_longops) WHERE "% Complete" != 100;

C:\Docum ent\ Perform ance_issues_aftre_workload. doc

To check the status: select OWNER,TRIGGER_NAME, STATUS from dba_triggers where TRIGGER_NAME like '%DDL%'; Script to change: alter trigger owner.trigger_name enable or disable;

C :\D ocum ent \ C ent ral \Not es\A t os\Recov ery _scenari os. doc

C :\D ocum ent \ C ent ral \Not es\A t os\Recov ery _scenari os. doc

tti "Space Usage for Database in Meg" SELECT Total.name "Tablespace Name", nvl(Free_space, 0) Free_space, nvl(total_space-Free_space, 0) Used_space, total_space FROM (select tablespace_name, sum(bytes/1024/1024) Free_Space from sys.dba_free_space group by tablespace_name ) Free, (select b.name, sum(bytes/1024/1024) TOTAL_SPACE TTI "Allocated, Used & Free space within datafiles" COLUMN free_space_mb format 999999.90 COLUMN allocated_mb format 999999.90 COLUMN used_mb format 999999.90 SELECT SUBSTR (df.NAME, 1, 40) file_name, df.bytes / 1024 / 1024 allocated_mb, ((df.bytes / 1024 / 1024) - NVL (SUM (dfs.bytes) / 1024 / 1024, 0)) used_mb, NVL (SUM (dfs.bytes) / 1024 / 1024, 0) free_space_mb TTI "Tablespace Fragmentation Details" SELECT dfsc.tablespace_name tablespace_name, DECODE ( dfsc.percent_extents_coalesced, 100, (DECODE ( GREATEST ((SELECT COUNT (1) FROM dba_free_space dfs WHERE dfs.tablespace_name = dfsc.tablespace_name), 1), 1, 'No Frag', 'Bubble Frag' ) ), 'Possible Honey Comb Frag' ) fragmentation_status FROM dba_free_space_coalesced dfsc ORDER BY dfsc.tablespace_name; TTI off

select 'Index '||i.index_name||' not analyzed but table '|| i.table_name||' is.' from user_tables t, user_indexes i where t.table_name = i.table_name and t.num_rows is not null and i.distinct_keys is null /

You might also like