Professional Documents
Culture Documents
ORACLE DBA Activity Checklist PDF
ORACLE DBA Activity Checklist PDF
Purpose:
This document gives details for performance/maintenance task daily, weekly, and monthly
for checking the status of one or more Oracle databases. These proactive activities will give
the complete health check report of databases.
Daily Activity
1. Oracle Database instance is running or not
2. Database Listener is running or not.
3. Check any session blocking the other session
4. Check the alert log for an error
5. Check is there any dbms jobs running & check the status of the same
6. Check the Top session using more Physical I/O
7. Check the number of log switch per hour
8. How_much_redo_generated_per_hour.sql
9. Run the statpack report
10. Detect lock objects
11. Check the SQL query consuming lot of resources.
12. Check the usage of SGA
13. Display database sessions using rollback segments
14. State of all the DB Block Buffer
Weekly Activity
1. Check the objects fragmented
2. Check the Chaining & Migrated Rows
3. Check the size of tables & check weather it need to partition or not
4. Check for Block corruption
5. Check the tables without PK
6. Check the tables having no Indexes
7. Check the tables having more Indexes
8. Check the tables having FK but there is no Index
9. Check the objects having the more extents
10. Check the frequently pin objects & place them in separate tablespace & in cache
Check the objects reload in memory many time
11. Check the free space at O/s Level
12. Check the CPU, Memory usage at O/s level define the threshold for the same.
13. Check the used & free Block at object level as well as on tablespaces.
14. Check the objects reaching to its Max extents
15. Check free Space in the tablespace
16. Check invalid objects of the database
17. Check open cursor not reaching to the max limit
18. Check locks not reaching to the max lock
Run listener status on terminal and verify weather database listener is running or not.
If it is not running then run listener start to run the listener. Follow the
listener_troubleshooting document for more details.
LSNRCTL STATUS
sys.v_$bgprocess p
where
a.statistic#=c.statistic# and
p.paddr (+) = b.paddr and
b.sid=a.sid and
c.name in ('physical reads',
'physical writes',
'physical writes direct',
'physical reads direct',
'physical writes direct (lob)',
'physical reads direct (lob)')
group by
b.sid, nvl(b.username,p.name)),
(select
sum(value) total_io
from
sys.v_$statname c,
sys.v_$sesstat a
where
a.statistic#=c.statistic# and
c.name in ('physical reads',
'physical writes',
'physical writes direct',
'physical reads direct',
'physical writes direct (lob)',
'physical reads direct (lob)'))
order by
3 desc;
"00",
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
to_char(sum(decode(substr(first_time,10,2),'10',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'11',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'12',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'13',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'14',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'15',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'16',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'17',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'18',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'19',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'20',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'21',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'22',1,0)),'99')
to_char(sum(decode(substr(first_time,10,2),'23',1,0)),'99')
from v$log_history
group by substr(first_time,1,5)
/
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23"
Run the statpack twice in a day to collect database statistics & compare it with previous
statistics. Follow the Statpack document to create the statpack report.
10. Check the SQL query consuming lot of resources
Need to Run the stats pack report or problematic_sql_query.sql to verify query
consuming lot of resource then find the explain plan of this particular query & compare it
with previous plan. Follow the Sql Tuning troubleshooting Document.
Break on User_Name On Disk_Reads on Buffer_Gets on Rows_Processed
Select A.User_Name, B.Disk_Reads, B.Buffer_Gets,
B.Rows_Processed, C.SQL_Text
From
V$Open_Cursor A, V$SQLArea B, V$SQLText C
Where
A.User_Name = Upper('&&User')
And
A.Address = C.Address
And
A.Address = B.Address
Order By
A.User_Name, A.Address, C.Piece;
col
col
col
col
Weekly Activity
1. Check the Table fragmented
Run the script check_table_fragmented_or_not.sql to verify the maximum extent &
fragmented table. Follow the How to identified table is fragmented or
not_and_resolve document to remove the fragmentation.
3. Check the size of tables & check weather it need to partition or not
Run the script table_size.sql to check the size of the table & follow the Partitioning in
Oracle document to identify the table which are the candidate of partition.
select table_name, round((blocks*8),2) tablesize,
round((num_rows*avg_row_len/1024),2) actualsize from dba_tables
where table_name='T';
SELECT distinct 'Data Block# '|| block# || ' of Data File '
|| name || ' is corrupted.'
FROM
v$copy_corruption a, v$datafile b
WHERE a.file# = b.file#;
and
order
sysdate,OWNER,TABLE_NAME
dba_tables dt
not exists (
select 'TRUE'
from
dba_constraints dc
where
dc.TABLE_NAME = dt.TABLE_NAME
and
dc.CONSTRAINT_TYPE='P')
OWNER not in ('SYS','SYSTEM')
by OWNER, TABLE_NAME
from
where
group
having
order
dba_indexes
OWNER not in ('SYS','SYSTEM')
by OWNER, TABLE_NAME
COUNT(*) > 5
by COUNT(*) desc, OWNER, TABLE_NAME
10. Check the frequently load objects & place them in separate tablespace & in
cache
Run the script frequent_load_object.sql to find the object which need to pin most the
time. So we can place this object in separate tablespace as well as in keep cache.
Follow the document how_move_objects_tablespace and how_to_put_object_cache.
select OWNER,
NAME||' - '||TYPE object,
LOADS
from
v$db_object_cache
where
LOADS > 3
and
type in ('PACKAGE','PACKAGE BODY','FUNCTION','PROCEDURE')
order
by LOADS desc
Monthly Activity
1. Check is there any dead lock was occurred
Verify alert log file there is no dead lock while application is running. If any dead
lock found then follow the doc Dealock to avoid the same in future.
2. Check the database size & compare it previous size to find the exact growth
of the database
Run db_size.sql to find the size of the database
3. Find Tablespace Status, segment management, initial & Max Extents and
Extent Management
Run the script tablespace_extens.sql to check the storage clause of tablespace
select tablespace_name,INITIAL_EXTENT, NEXT_EXTENT
,MAX_EXTENTS,EXTENT_MANAGEMENT,SEGMENT_SPACE_MANAGEMENT
from dba_tablespaces
,STATUS
4. Check location of datafile & Used & free space of each datafile
Run the script db_file.sql to check the location of data file & used & free of each
datafile.
SELECT sysdate, 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
FROM v$datafile df, dba_free_space dfs
WHERE df.file# = dfs.file_id(+)
GROUP BY dfs.file_id, df.NAME, df.file#, df.bytes
ORDER BY file_name;
7. Check the Extents of each object and compare if any object extent are
overridden which is define at tablespace level.
Run the script extent_compare_object_tablespace.sql to verify that is there any object
whose extents are different from tablespace. If so then move these objects on separate
tablespace having same extent as on object level to avoid the fragmentation.
8. Check the overall database statistics
Runs the statpack_report.sql to find the overall database performance & follow the
database performance document to make sure database well optimized.
9. Tablespace need coalescing
Run the script Tablespace_need_coalescing.sql to verify any tablespace need
coalescing or not
select tablespace_name, percent_extents_coalesced
from dba_free_space_coalesced
where percent_extents_coalesced <> 100;
Nightly Activity
1. Analyzed the objects routinely.
Run the Script Analyzed.sql while there is less activity or in the night to collect the
statistics of the Objects so that Oracle optimizers can you the best execution plan.
exec dbms_stats.gather_schema_stats(ownname=>'TEST',cascade => TRUE);
exec dbms_stats.gather_schema_stats(ownname=>'SCOTT',cascade => TRUE)
5. Check the No. of Date of Last Analysis & No. of Record in the Table
select TABLE_NAME, NUM_ROWS, LAST_ANALYZED from dba_tables where
table_name='TABLE_NAME';
format
format 999,999,999
column c3
column c4
select
size_for_estimate
c1,
buffers_for_estimate
c2,
estd_physical_read_factor c3,
estd_physical_reads
c4
from
v$db_cache_advice
where
name = 'DEFAULT'
and
block_size = (SELECT value FROM V$PARAMETER
WHERE name = 'db_block_size')
and
advice_status = 'ON';
and l1.id1=l2.id1
and l1.id2=l2.id2
Undo Tablespace shrink by SMON after every 12 hrs. if more space is required.
SELECT DISTINCT STATUS, SUM(BYTES), COUNT(*)
FROM DBA_UNDO_EXTENTS GROUP BY STATUS;
AND dF.autoextensible='NO'
group by fs.tablespace_name
) aa
where (Used_Space*100/Total_Space)>85