Sei sulla pagina 1di 17

Oracle DBA Checklist

Version 1.4 Generic


Revised: 23-Aug-2000
Authors: Thomas B. Co! "ith Christine Choi
#ur$ose: This document gives detai%s &or $er&orming dai%'! "ee(%'! and month%' chec(s o& the status o&
one or more )rac%e data*ases. A%% +,- and #-.+,- code &or the %isted chec(s can *e &ound
in the a$$endi.
The %atest version o& this $a$er shou%d a%"a's *e avai%a*%e on the $rimar' author/s home $age!
0htt$:..""".geocities.com.t*co231.
Change 2otes: 1.1: T'$o in 'existext.sql' identi&ied *' +teve 3e2un4io! &ied
1.2: T'$os &ied
1.3 Gnu #u*%ic -icense added5 $ctincr 0 in re*ui%d inde added
1.4 Added $ointer to ne"est version on Geocities home $age!
htt$:..""".geocities.com.t*co23
6ied $ointer to /ora$u*/ "e* site
Added night%' chec(%ist and vo%umetrics
+u$$ort 7n&ormation 8customi4e &or 'our site9:
:e%$ 3es(: 0$hone1
#h'sica% 3BA: 0name1 0$hone1
A$$%ication 3BA: 0name1 0$hone1
)rac%e +u$$ort: C+7: 0;1 0$hone1
Ac(no"%edgements:
This $a$er "as ins$ired *' the "or( o& 3avid Coo( 8see Re&erences9! and Version 1.0 "as %arge%' &%eshed out *'
Christine Choi o& :e"%ett-#ac(ard 8Com$onents Grou$9! +an <ose! Ca%i&ornia. 7 am grate&u% to *oth &or their
contri*utions to this document.
#%ease send 'our corrections! suggestions! and &eed*ac( to me at the address *e%o"! "ith 'our return address so
7 ma' credit 'our contri*ution. Than( 'ou.
-Thomas B. Co! 0t*co=att.net1
Co$'right > 1???! 2000 Thomas B. Co! A%% Rights Reserved.
This document is &ree5 'ou can redistri*ute it and.or modi&' it under the terms o& the G2@ Genera% #u*%ic
-icense as $u*%ished *' the 6ree +o&t"are 6oundation5 either version 2
o& the -icense! or 8at 'our o$tion9 an' %ater version.
This document is distri*uted in the ho$e that it "i%% *e use&u%! *ut A7T:)@T A2B AARRA2TB5 "ithout even
the im$%ied "arrant' o& CDRC:A2TAB7-7TB or 67T2D++ 6)R A #ART7C@-AR #@R#)+D. +ee the G2@
Genera% #u*%ic -icense &or more detai%s.
6or a co$' o& the G2@ Genera% #u*%ic -icense "rite to the 6ree +o&t"are
6oundation! 7nc.! E? Tem$%e #%ace - +uite 330! Boston! CA 02111-130F! @+A.
Index
I. DAILY PROCEDURES 3
A. VDR76B A-- 72+TA2CD+ ARD @# 3
B. -))G 6)R A2B 2DA A-DRT -)G D2TR7D+ 3
C. VDR76B 3B+2C# 7+ R@2272G 3
3. VDR76B +@CCD++ )6 3ATABA+D BACG@# 3
D. VDR76B +@CCD++ )6 3ATABA+D ARC:7V72G T) TA#D 3
6. VDR76B D2)@G: RD+)@RCD+ 6)R ACCD#TAB-D #DR6)RCA2CD 3
G. C)#B ARC:7VD3 -)G+ T) +TA23BB 3ATABA+D A23 R)-- 6)RAAR3 E
:. RDA3 3BA CA2@A-+ 6)R )2D :)@R E
II. NIGHTLY PROCEDURES 6
A. C)--DCT V)-@CDTR7C 3ATA H
III. EE!LY PROCEDURES "
A. -))G 6)R )B<DCT+ T:AT BRDAG R@-D+ F
B. -))G 6)R +DC@R7TB #)-7CB V7)-AT7)2+ F
C. -))G 72 +,-I2DT -)G+ 6)R DRR)R+! 7++@D+ F
3. ARC:7VD A-- A-DRT -)G+ T) :7+T)RB F
D. V7+7T :)CD #AGD+ )6 GDB VD23)R+ J
I#. $ONTHLY PROCEDURES %
A. -))G 6)R :ARC6@- GR)AT: RATD+ ?
B. RDV7DA T@272G )##)RT@27T7D+ ?
C. -))G 6)R 7.) C)2TD2T7)2 ?
3. RDV7DA 6RAGCD2TAT7)2 ?
D. #R)<DCT #DR6)RCA2CD 72T) T:D 6@T@RD ?
6. #DR6)RC T@272G A23 CA72TD2A2CD ?
#. APPENDI& '(
A. 3A7-B #R)CD3@RD+ 10
B. 27G:T-B #R)CD3@RD+ 12
C. ADDG-B #R)CD3@RD+ 14
#I. RE)ERENCES '"
2
I. Daily Procedures
A. Verify all instances are up
Ca(e sure the data*ase is avai%a*%e. -og into each instance and run dai%' re$orts or test
scri$ts. +ome sites ma' "ish to automate this.
)$tiona% im$%ementation: use )rac%e Dnter$rise Canager/s /$ro*e/ event.
B. Look for any new alert log entries
Connect to each managed s'stem.
@se /te%net/ or com$ara*%e $rogram.
6or each managed instance! go to the *ac(ground dum$ destination! usua%%'
K)RAC-DLBA+D.0+731.*dum$. Ca(e sure to %oo( under each managed data*ase/s
+73.
At the $rom$t! use the @ni Mtai%N command to see the a%ertL0+731.%og! or other"ise
eamine the most recent entries in the &i%e.
7& an' )RA-errors have a$$eared since the $revious time 'ou %oo(ed! note them in the
3ata*ase Recover' -og and investigate each one. The recover' %og is in 0&i%e1.
C. Verify DBSNMP is running
1. Log on to each managed machine to check for the 'dbsnmp' process.
6or @ni: at the command %ine! t'$e $s Oe& P gre$ d*snm$. There shou%d *e t"o d*snm$
$rocesses running. 7& not! restart 3B+2C#. 8+ome sites have this disa*%ed on $ur$ose5 i&
this is the case! remove this item &rom 'our %ist! or change it to Qveri&' that 3B+2C# is
2)T runningQ.9
D. Verify success of database backup
. Verify success of database arc!i"ing to tape
#. Verify enoug! resources for acceptable perfor$ance
1. Verify free space in tablespaces.
6or each instance! veri&' that enough &ree s$ace eists in each ta*%es$ace to hand%e the
da'Ns e$ected gro"th. As o& 0date1! the minimum &ree s$ace &or 0re$eat &or each
ta*%es$ace1: R 0 ta*%es$ace 1 is 0 amount 1 S. Ahen incoming data is sta*%e! and average
dai%' gro"th can *e ca%cu%ated! then the minimum &ree s$ace shou%d *e at %east 0time to
order! get! and insta%% more dis(s1 da'sN data gro"th.
a) Go to each instance, run free.sql to check free mb in tablespaces.
Com$are to the minimum &ree CB &or that ta*%es$ace. 2ote an' %o"-s$ace conditions and
correct.
3
b) Go to each instance, run space.sql to check percentage free in tablespaces.
Com$are to the minimum $ercent &ree &or that ta*%es$ace. 2ote an' %o"-s$ace conditions
and correct.
2. Verify rollback segment.
+tatus shou%d *e )2-72D! not )66-72D or 6@--! ece$t in some cases 'ou ma' have a
s$ecia% ro%%*ac( segment &or %arge *atch To*s "hose norma% status is )66-72D.
a) ptional! each database may ha"e a list of rollback segment names and their
e#pected statuses.
b) $or current status of each %L&%' or $(LL rollback segment )by &* not by
name), query on V+,LL-./..
c) $or storage parameters and names of /LL rollback segment, query on
*0/1,LL0/231-'G-. .hat "ie45s -./.(- field is less accurate than
V+,LL-./., ho4e"er, as it lacks the 6'%*&%G $$L&%' and $(LL statuses,
sho4ing these as $$L&%' and %L&%' respecti"ely.
7. &dentify bad gro4th pro8ections.
-oo( &or segments in the data*ase that are running out o& resources 8e.g. etents9 or
gro"ing at an ecessive rate. The storage $arameters o& these segments ma' need to *e
adTusted. 6or eam$%e! i& an' o*Tect reached 200 as the num*er o& current etents! A23 it/s
an o*Tect that is su$$osed to get %arge! u$grade the maLetents to un%imited.
a) .o gather daily si9ing information, run analy9e:pct.sql. &f you are collecting
nightly "olumetrics, skip this step.
b) .o check current e#tents, run nr1e#tents.sql
c) ;uery current table si9ing information
d) ;uery current inde# si9ing information
e) ;uery gro4th trends
<. &dentify space=bound ob8ects.
+$ace-*ound o*TectsN netLetents are *igger than the %argest etent that the ta*%es$ace can
o&&er. +$ace-*ound o*Tects can harm data*ase o$eration. 7& "e get such o*Tect! &irst need
to investigate the situation. Then "e can use A-TDR TAB-D+#ACD 0ta*%es$ace1
C)A-D+CD. )r add another data&i%e.
4
a) ,un spacebound.sql. &f all is 4ell, 9ero ro4s 4ill be returned.
:. 6rocesses to re"ie4 contention for 26(, memory, net4ork or disk resources.
a) .o check 26( utili9ation, go to #!>4eb>phase2>default.htm ?@system
metrics?@26( utili9ation page. <AA is the ma#imum 26( utili9ation because there
are < 26(s on ph#de" and ph#prd machine. Be need to in"estigate if 26(
utili9ation keeps abo"e 7:A for a 4hile.
%. Copy Arc!i"ed Logs to Standby Database and &oll #orward
7& 'ou have a +tand*' 3ata*ase! co$' the a$$ro$riate Archived -ogs to the e$ected
%ocation on the stand*' machine and a$$%' those %ogs 8ro%% &or"ard the changes9 to the
stand*' data*ase. This (ee$s the stand*' data*ase u$-to-date.
The co$'ing o& %ogs! the a$$%'ing o& them! or *oth! can in some cases *e automated. 7& 'ou
have automated them! then 'our dai%' tas( shou%d *e to con&irm that this ha$$ened correct%'
each da'.
'. &ead DBA $anuals for one !our
2othing is more va%ua*%e in the %ong run than that the 3BA *e as "ide%' e$erienced! and
as "ide%' read! as $ossi*%e. Readings shou%d inc%ude 3BA manua%s! trade Tourna%s! and
$ossi*%' ne"sgrou$s or mai%ing %ists.
E
II. Nightly Procedures
Cost $roduction data*ases 8and man' deve%o$ment and test data*ases9 "i%% *ene&it &rom
having certain night%' *atch $rocesses run.
A. Collect "olu$etric data
This eam$%e co%%ects ta*%e ro" counts. This can easi%' *e etended to other o*Tects such
as indees! and other data such as average ro" si4es.
1. /naly9e -chemas and 2ollect *ata.
The idea here is to use the more time consuming and more accurate A2A-BUD C)C#@TD
command and save the resu%ts! "hich sho" u$ in the data dictionar'! to a more $ermanent
store.
a) &f you ha"ent' yet, create the "olumetrics table 4ith mk1"olfact.sql
b) .o gather nightly si9ing information, run analy9e1comp.sql.
c) .o collect the resulting statistics, run pop1"ol.sql
d) '#amine the data at your leisure, probably 4eekly or monthly.
7 use C+ Dce% and an )3BC connection to eamine and gra$h data gro"th.
H
III. Weekly Procedures
A. Look for ob(ects t!at break rules
6or each o*Tect-creation $o%ic' 8naming convention! storage $arameters! etc.9 have an automated
chec( to veri&' that the $o%ic' is *eing &o%%o"ed.
1. '"ery ob8ect in a gi"en tablespace should ha"e the e#act same si9e for
%'C.1'C.'%., 4hich should match the tablespace default for %'C.1'C.'%.. /s of
12D1<DEF, default %'C.1'C.'%. for */./G& is 1 gig )1A<F:HI bytes), */./L is
:AA mb ):2<2FF bytes), and &%*'C'- is 2:I mb )2I21<< bytes).
a) .o check settings for %'C.1'C.'%., run ne#te#t.sql.
b) .o check e#isting e#tents, run e#iste#t.sql
2. /ll tables should ha"e unique primary keys.
a) .o check missing 63, run no1pk.sql.
b) .o check disabled 63, run dis63.sql.
c) /ll primary key inde#es should be unique. ,un nonu63.sql to check.
7. /ll inde#es should use &%*'C'- tablespace. ,un mkrebuild1id#.sql.
<. -chemas should look identical bet4een en"ironments, especially test and
production.
a) .o check data type consistency, run datatype.sql.
b) .o check other ob8ect consistency, run ob81coord.sql.
c) 0etter yet, use a tool like ;uest -oft4are's -chema Janager.
B. Look for security policy "iolations
C. Look in S)L*Net logs for errors+ issues
1. 2lient side logs
2. -er"er side logs
D. Arc!i"e all Alert Logs to !istory
F
. Visit !o$e pages of key "endors
1. racle 2orporation
htt$:..""".orac%e.com
htt$:..technet.orac%e.com
htt$:..""".orac%e.com.su$$ort
htt$:..""".oramag.com
2. ;uest -oft4are
htt$:..""".Vuests.com
7. -un Jicrosystems
htt$:..""".sun.com
J
IV. Monthly Procedures
A. Look for 'ar$ful %rowt! &ates
1. ,e"ie4 changes in segment gro4th 4hen compared to pre"ious reports to identify
segments 4ith a harmful gro4th rate.
B. &e"iew ,uning -pportunities
1. ,e"ie4 common racle tuning points such as cache hit ratio, latch contention, and
other points dealing 4ith memory management. 2ompare 4ith past reports to identify
harmful trends or determine impact of recent tuning ad8ustments.
C. Look for ./- Contention
1. ,e"ie4 database file acti"ity. 2ompare to past output to identify trends that could
lead to possible contention.
D. &e"iew #rag$entation
1. &n"estigate fragmentation )e.g. ro4 chaining, etc.).
. Pro(ect Perfor$ance into t!e #uture
1. 2ompare reports on 26(, memory, net4ork, and disk utili9ation from both racle
and the operating system to identify trends that could lead to contention for any one of
these resources in the near future.
2. 2ompare performance trends to -er"ice Le"el /greement to see 4hen the system
4ill go out of bounds
#. Perfor$ ,uning and Maintenance
1. Jake the ad8ustments necessary to a"oid contention for system resources. .his
may include scheduled do4n time or request for additional resources.
?
V. Appendix
A. Daily Procedures
1. $ree.sql
--
-- free.sql
--
-- To verify free space in tablespaces
-- Minimum amount of free space
-- document your thresholds:
-- <tablespace_name> <amount> m
--
!"#"$T tablespace_name% sum & bloc's ( as free_bl' % trunc & sum & bytes ( )
&*+,-.*+,-( ( as free_m
% max & bytes ( ) &*+,-( as bi/_chun'_'% count &.( as num_chun's
012M dba_free_space
31245 67 tablespace_name
2. -pace.sql
--
-- space.sql
--
-- To chec' free% pct_free% and allocated space 8ithin a tablespace
--
-- **),-)9:
!"#"$T tablespace_name% lar/est_free_chun'
% nr_free_chun's% sum_alloc_bloc's% sum_free_bloc's
% to_char&*++.sum_free_bloc's)sum_alloc_bloc's% '+9.99'( ;; '<'
=! pct_free
012M & !"#"$T tablespace_name
% sum&bloc's( =! sum_alloc_bloc's
012M dba_data_files
31245 67 tablespace_name
(
% & !"#"$T tablespace_name =! fs_ts_name
% max&bloc's( =! lar/est_free_chun'
% count&bloc's( =! nr_free_chun's
% sum&bloc's( =! sum_free_bloc's
012M dba_free_space
31245 67 tablespace_name (
>?"1" tablespace_name fs_ts_name
7. analy9e:pct.sql
--
-- analy@eApct.sql
--
-- To analy@e tables and indexes quic'ly% usin/ a A< sample si@e
-- &do not use this script if you are performin/ the overni/ht
-- collection of volumetric data(
--
10
-- **)B+)9:
6"3CD
dbms_utility.analy@e_schema & 'E2>D"1'% '"!TCM=T"'% D4##% A ( F
"DG F
)
<. nr1e#tents.sql
--
-- nr_extents.sql
--
-- To find out any obHect reachin/ <threshold>
-- extents% and manually up/rade it to allo8 unlimited
-- max_extents &thus only obHects 8e .expect. to be bi/
-- are allo8ed to become bi/(
--
-- **)B+)9:
!"#"$T e.o8ner% e.se/ment_type % e.se/ment_name % count&.( as nr_extents %
s.max_extents
% to_char & sum & e.bytes ( ) & *+,- . *+,- ( % '999%999.9+'( as M6
012M dba_extents e % dba_se/ments s
>?"1" e.se/ment_name s.se/ment_name
31245 67 e.o8ner% e.se/ment_type % e.se/ment_name % s.max_extents
?=ICD3 count&.( > ET?1"!?2#G
21 & & s.max_extents - count&.( ( < EET?1"!?2#G (
21G"1 67 count&.( desc
:. spacebound.sql
--
-- spacebound.sql
--
-- To identify space-bound obHects. Cf all is 8ell% no ro8s are returned.
-- Cf any space-bound obHects are found% loo' at value of D"JT extent
-- si@e to fi/ure out 8hat happened.
-- Then use coalesce &alter tablespace <foo> coalesceF(.
-- #astly% add another datafile to the tablespace if needed.
--
-- **)B+)9:
!"#"$T a.table_name% a.next_extent% a.tablespace_name
012M all_tables a%
& !"#"$T tablespace_name% max&bytes( as bi/_chun'
012M dba_free_space
31245 67 tablespace_name ( f
>?"1" f.tablespace_name a.tablespace_name
=DG a.next_extent > f.bi/_chun'
11
B. Nig!tly Procedures
1. mk1"olfact.sql
--
-- m'_volfact.sql &only run this once to set it upF do not run it ni/htlyK(
--
-- -- Table 4T#_I2#_0=$T!
$1"=T" T=6#" utl_vol_facts
&
table_name I=1$?=1,&B+(%
num_ro8s D4M6"1%
meas_dt G=T"
(
T=6#"!5=$" platab
!T21=3" &
CDCTC=# *,:'
D"JT *,:'
5$TCD$1"=!" +
MCD"JT"DT! *
M=J"JT"DT! unlimited
(
)
-- 5ublic !ynonym
$1"=T" 546#C$ !7D2D7M utl_vol_facts 021 E2>D"1..utl_vol_facts
)
-- 3rants for 4T#_I2#_0=$T!
31=DT !"#"$T 2D utl_vol_facts T2 public
)
2. analy9e1comp.sql
--
-- analy@e_comp.sql
--
6"3CD
sys.dbms_utility.analy@e_schema & 'E2>D"1'%'$2M54T"'(F
"DG F
)
7. pop1"ol.sql
--
-- pop_vol.sql
--
insert into utl_vol_facts
select table_name
% DI# & num_ro8s% +( as num_ro8s
% trunc & last_analy@ed ( as meas_dt
from all_tables -- or Hust user_tables
8here o8ner in &'E2>D"1'( -- or a comma-separated list of o8ners
12
)
commit
)
13
C. 0eekly Procedures
1. ne#te#t.sql
--
-- nextext.sql
--
-- To find tables that don't match the tablespace default for D"JT extent.
-- The implicit rule here is that every table in a /iven tablespace should
-- use the exact same value for D"JT% 8hich should also be the tablespace's
-- default value for D"JT.
--
-- This tells us 8hat the settin/ for D"JT is for these obHects today.
--
-- **)B+)9:
!"#"$T se/ment_name% se/ment_type% ds.next_extent as =ctual_Dext
% dt.tablespace_name% dt.next_extent as Gefault_Dext
012M dba_tablespaces dt% dba_se/ments ds
>?"1" dt.tablespace_name ds.tablespace_name
=DG dt.next_extent Kds.next_extent
=DG ds.o8ner 455"1 & 'E2>D"1' (
21G"1 67 tablespace_name% se/ment_type% se/ment_name
2. e#iste#t.sql
--
-- existext.sql
--
-- To chec' existin/ extents
--
-- This tells us ho8 many of each obHect's extents differ in si@e from
-- the tablespace's default si@e. Cf this report sho8s a lot of different
-- si@ed extents% your free space is li'ely to become fra/mented. Cf so%
-- this tablespace is a candidate for reor/ani@in/.
--
-- *,)*A)9:
!"#"$T se/ment_name% se/ment_type
% count&.( as nr_exts
% sum & G"$2G" & dx.bytes%dt.next_extent%+%*( ( as nr_illsi@ed_exts
% dt.tablespace_name% dt.next_extent as dflt_ext_si@e
012M dba_tablespaces dt% dba_extents dx
>?"1" dt.tablespace_name dx.tablespace_name
=DG dx.o8ner 'E2>D"1'
31245 67 se/ment_name% se/ment_type% dt.tablespace_name% dt.next_extent
7. %o1pk.sql
--
-- no_p'.sql
--
-- To find tables 8ithout 5L constraint
--
14
-- **),)9:
!"#"$T table_name
012M all_tables
>?"1" o8ner 'E2>D"1'
MCD4!
!"#"$T table_name
012M all_constraints
>?"1" o8ner 'EE2>D"1'
=DG constraint_type '5'
<. dis63.sql
--
-- dis5L.sql
--
-- To find out 8hich primary 'eys are disabled
--
-- **)B+)9:
!"#"$T o8ner% constraint_name% table_name% status
012M all_constraints
>?"1" o8ner 'E2>D"1' =DG status 'GC!=6#"GM =DG constraint_type '5'
:. nonu63.sql
--
-- nonu5L.sql
--
-- To find tables 8ith nonunique 5L indexes. 1equires that 5L names
-- follo8 a namin/ convention. =n alternative query follo8s that
-- does not have this requirement% but runs more slo8ly.
--
-- **),)9:
!"#"$T index_name% table_name% uniqueness
012M all_indexes
>?"1" index_name li'e 'E5LD=M"<'
=DG o8ner 'E2>D"1' =DG uniqueness 'D2D4DCN4"'
!"#"$T c.constraint_name% i.tablespace_name% i.uniqueness
012M all_constraints c % all_indexes i
>?"1" c.o8ner 455"1 & 'E2>D"1' ( =DG i.uniqueness 'D2D4DCN4"'
=DG c.constraint_type '5' =DG i.index_name c.constraint_name
I. mkrebuild1id#.sql
--
-- m'rebuild_idx.sql
--
-- 1ebuild indexes to have correct stora/e parameters
--
-- **),)9:
!"#"$T 'alter index ' ;; index_name ;; ' rebuild '
% 'tablespace CDG"J"! stora/e '
;; ' & initial ,AO L next ,AO L pctincrease + ( F '
1E
012M all_indexes
>?"1" & tablespace_name K 'CDG"J"!'
21 next_extent K & ,AO . *+,- (
(
=DG o8ner 'E2>D"1'
)
H. datatype.sql
--
-- datatype.sql
--
-- To chec' datatype consistency bet8een t8o environments
--
-- **)B+)9:
!"#"$T
table_name%
column_name%
data_type%
data_len/th%
data_precision%
data_scale%
nullable
012M all_tab_columns -- first environment
>?"1" o8ner 'E2>D"1'
MCD4!
!"#"$T
table_name%
column_name%
data_type%
data_len/th%
data_precision%
data_scale%
nullable
012M all_tab_columnsPEmy_db_lin' -- second environment
>?"1" o8ner 'E2>D"1,'
order by table_name% column_name
F. ob81coord.sql
--
-- obH_coord.sql
--
-- To find out any difference in obHects bet8een t8o instances
--
-- *,)+:)9:
!"#"$T obHect_name% obHect_type
012M user_obHects
MCD4!
!"#"$T obHect_name% obHect_type
012M user_obHectsPEmy_db_lin'
1H
VI.References
1. -one'! Gevin )rac%eJ 3BA :and*oo(
2. Coo(! 3avid 3ata*ase Canagement &rom Crisis to Con&idence
Rhtt$:..""".ora$u*.com.S
3. Co! Thomas B. The 3ata*ase Administration Caturit' Code%
1F