Database Administrator An Introduction
Database Administrator An Introduction
UNCLASSIFIED
DBA Introduction
Preface
The information contained herein focuses on what would be considered an introduction to being an Oracle DataBase Administrator (DBA). It is not in any way a replacement for hands-on-training at an education center li e !earning Tree International or Oracle "ducation. It is howe#er to be used as a starting point of reference for people starting a career as an Oracle DBA. This manual is a hodgepodge of information gathered from manuals$ boo s$ internet articles and personal e%perience$ nothing is intentionally plagiari&ed.
1.1
Terminology
Table 1-1. Abbreviations Abbreviation RMAN %RIM SECD CA&A Description Oracles Recover Mana!er "roduct used to bac#u" restore databases$ &'e "rimar instance database &'e (ailover instance database &'e RMAN catalo! instance database
1.2
Typographic Conventions
Table 1-2. Typographic Conventions Convention Courier Italics UPPERCASE 0cr1 Arial Description Courier t "e indicates UNI) commands* director names* usernames* "at'names* and (ilenames Italic t "e indicates a variable* includin! variable "ortions o( (ilenames U""ercase letters indicate Structured +uer Lan!ua!e ,S+L- reserved .ords* initiali/ation "arameters* and environment variables &'is strin! indicates a ne.line c'aracter Arial t "e indicates res"onse to commands b o"eratin! s stem ,OS- or current "ro!ram in use
The following table pro#ides the typographic con#entions used in this guide'
1.3
Command Synta
All command synta% appears in courier font. )*+ character at the beginning of ,-I. command e%amples is the default ,-I. command prompt. Do not enter it as part of the command. The ,-I. command assumes the use of the /O0I. shell. 01!2 indicates a command e%ample gi#en at the default 01!/!,0 command prompt. Do not enter it as part of the command.
Table 1-3. Command Synta Conventions Convention bac#slas' 2 braces 34 brac#ets ;< Italics Description A bac#slas' indicates a command t'at .as too lon! to (it on a sin!le line Braces indicated re5uired items6 e7"ort DIS%LA8938OUR:&ERMINAL4 Brac#ets indicate o"tional items6 sto":mon$s' 3db4 ;service< Italic t "e indicates a variable$ Substitute a value (or t'e variable6 database_name
(ommand prompts will #ary depending on the shell or program you are current using.
DBA Introduction
1.!
1.!.1
Standards
"ile #ocations and Descriptions
"#ery system has sets of standards that to which they adhere. This document uses the following standards to for file locations. It is not to be ta en as a recommendation of standards$ only as an e%ample.
Table 1-!. $eneral "ile #ocations Type of "ile RMAN scri"ts RMAN lo!s S+L scri"ts S'ell Scri"ts Initiali/ation (iles %ass.ord (iles Oratab (iles #ocation /opt/oracle/workspace/bin /opt/oracle/workspace/logs/rman /home/oracle/sql and /opt/oracle/workspace/sql /opt/oracle/workspace/bin $ORAC E!"O#E/dbs/sp$iledbname%o ra $ORAC E!"O#E/dbs/orapwdbname /etc/oratab =RMAN:LO>S =S+L:DIR =ORA:BIN NA NA NA Short %ame =RMAN:DIR Description %OSI) s'ell scri"ts ,$s'- callin! rman commands to bac#u" and restore t'e database$ &'ese are located on t'e se!ment controller server$ Lo! (iles created b t'e RMAN scri"ts and located on t'e se!ment controller server$ >eneral s5l scri"ts used in monitorin! t'e database$ >eneral s'ell scri"ts t'e 'el" in t'e over administration and monitorin! o( t'e database$ Initiali/ation "arameter (ile (or startin! u" database$ %ass.ord (ile (or accessin! database as S8SDBA Listin! o( current databases on mac'ine .it' t'eir current 'ome director and i( t'e s'ould startu" .'en server is rebooted$
DBA Introduction
2
2.1
2.2
DBA Introduction
6anage ment
8e3uiremen ts "ngineers
0ystem Architects
DBA
De#elopers
nt
,ser s
2.3
DBA Introduction
2.!
2.!.1
Daily Proced*res
6any of these procedures can be automated using shell scripts and a scheduler li e cron or e#en using tools such as Oracle "nterprise 6anager (O"6). The )!a&y DBA+ is the concept that you are wor ing smarter using tools to do the grunt wor and then you chec ing the results.
2.!.1.1 .erify all instances are *p.
6a e sure that all databases under your super#ision are a#ailable. !og into each instance and run daily reports or test scripts.
2.!.1.2 #oo, for any ne/ alert log entries
"ach Oracle Instance has a bac ground dump destination$ usually in *O8A(!"<BA0" /ORACLE_SID/bdump. The alert log file (alert<ORACLE_SID.log) is in this location and should be chec ed for errors each day.
2.!.1.3 .erify s*ccess of database bac,*p
:eep a schedule of database bac ups and re#iew logs to assure bac ups occurred successfully. In many en#ironments it is beneficial to eep trac of bac up times and si&es for capacity planning.
2.!.1.! .erify eno*gh reso*rces for acceptable performance
:eep a record of acceptable minimum amount 7 percentage free in tablespaces and compare it daily to reports. Inform appropriate parties if there is a discrepancy.
2.!.1.0 .erify eno*gh reso*rces for acceptable performance
!oo for segments in the database that are running out of resources (e.g. e%tents) or growing at an e%cessi#e rate. The storage parameters for these segments may need to be ad5usted. =ou should as well gather si&ing information as well and compare it to past trends. It is also important to chec to ma e sure that the ne%t<e%tent for each table is smaller than the largest e%tent that the tablespace can offer$ if not the space may need to be coalesced or a datafile added.
2.!.1.1 &evie/ contention for CP23 memory3 net/or, or dis, reso*rces
4or with system administrators to de#elop methods to re#iew contention for these resources.
2.!.1.4 Chec, stat*s of standby database if applicable.
(hec to determine if latest archi#e logs ha#e been applied to the database by loo ing at the alert log file for the standby database.
2.!.1.5 &ead D(A man*als6reference materials for one ho*r
It is e%tremely important to continue to read DBA manuals$ trade 5ournals$ newgroups and7or mailing lists. The newsgroups li e$ http'77dba-#illage.com7#illage7d#p<base.main$ allow you see real world 3uestions being answered by other e%perienced DBA>s$ it also gi#es you a chance to as 3uestions and #erify answers. The DBA manuals and trade 5ournals help you stay abreast of new trends and technologies. Often it is best to find a topic you are interested in learning more about and do research on the web about the topic.
DBA Introduction
2.!.2
2.!.2.1
"ach system should be adhering to ob5ect-creation policies (naming con#entions$ storage parameters$ etc.). =ou should create scripts that chec these policies out to assure they are being enforced.
2.!.2.2 #oo, for sec*rity policy violations
"#ery system has security policies. One of the best practices is that of !east -eeded /ri#ileges. The concept is that an ob5ect should be created with the least amount of indi#idual access right to allow software to wor . Access rights should be by group$ not indi#iduals$ and ne#er by public.
2.!.2.3 #oo, in S8#9%et logs for errors or iss*es
Although unli ely$ it is possible that system changes occur in the manner which an application connects to the system. The 01!?-et logs should be re#iewed to catch any such errors.
2.!.2.! &evie/ T*ning 'pport*nities
8e#iew common Oracle tuning points. (ache hit ratio !atch contention Dis i7o contention Data @ragmentation (ompare with past reports to identify impact of recent changes to system. /ro5ect /erformance into the @uture by comparing with past reports for both Oracle and the O0.
2.0
D(A &eso*rces
!i e with any other technical field the functionality and options that you can implement with Oracle continue to grow. It is impossible to be an e%pert on e#ery single area of Oracle but there are resources that can definitely help you nurture your nowledge. Training is #ery helpful$ but I suggest that you ta e the hands-on approach. ,sing (BT courses are all well and good$ but you need to sit down with Oracle and play with itA create a few tables$ a few users$ learn basic 01!$ shutdown7startup$ bac up and restore. =ou may want to ta e a class at a uni#ersity in basic database administration. The following lin s were current as off @ebruary B$ CDDB. They are not e%hausti#e but are only meant to be used as a spring board for you to find your own sources of nowledge. http'77docs.oracle.com7home<content.html - All the original documents from Oracle and a great reference library. http'77metalin .oracle.com E The nowledge base and trouble tic et submission utility for Oracle. =ou must ha#e an account which is based on your (ustomer 0upport Identifier ((0I). http'77www.oracle.com7technology7inde%.html-Oracle - The Oracle Technology -etwor where you can download software$ re#iew documentation$ participate in forums$ read articles$ see sample codes and tutorials. http'77www.oracle-base.com E Another good source from DBA 0cripts$ Fersion specific articles$ forums$ e%aminiation guides$ and industry news. http'77www.dba-oracle.com7oracle<lin s.htm - 0ite sponsored by Burleson (onsulting with lin s to other sites of interest. http'77www.toadsoft.com7inde%.htm - 0ite for Toadsoft by 1uest 0oftware. This is a good tool for database de#elopers and DBAs.
DBA Introduction
http'77blogs.oracle.com E Oracle blogging community where you can read blogs from Oracle e%ecuti#es$ employees and non-employees that e%change #iews about re3uirements and best practices for Oracle. http'77www.dba-#illage.com7#illage7d#p<base.main - A good source of information for tips$ scripts$ papers$ forums and lin s.
DBA Introduction
'racle Architect*re
The following section outlines the Oracle Architecture. In general$ an Oracle Instance refers to the bac ground processes and memory structuresA where as the Oracle Database refers to the actual physical storage structures.
3.1
'racle Server
An Oracle 0er#er is a relational database management system (8DB60). It pro#ides an open comprehensi#e$ integrated approach to information management. It consists of an Oracle Instance and an Oracle database (see @igure C). System Global Area
Dedicated 0er#er /rocess Database 4riter 0ystem 6onitor Database buffer cache 8edo !og Buffer 0hared /ool Ga#a /ool
HHH HHH
!og 4riter Archi#er (:/T
/rocess 6onitor
HHH HHH
Data 0egments
(ontrol @iles
3.1.1
'racle :nstance An Oracle Instance is the means to access an Oracle database. It is always connected to one and only one database. There howe#er may be more than one instance that connects to a database (DB<-A6") (this is either a parallel configuration or a 8eal Application (luster (8A() configuration (see @igure ;). An Oracle Instance consists of 6emory structures and bac ground processes (see @igure C). It is uni3uely defined as O8A(!"<0ID.
DBA Introduction
O8A(!"<0IDM /8ODI O8A(!"<0IDM /8ODC O8A(!"<0IDM /8OD;
DB<-A6"M O"</8OD
"ig*re 3 + Parallel 6 &AC Config*ration
3.1.2
System $lobal Area ;S$A< The 0JA consists of the memory structures that perform the database management. This is a dynamic memory area where si&e is controlled by the initiali&ation parameter 0JA<6A.<0IK". The following list is only a few of the memory structures within an instance.
0hared /ool !ibrary (ache Data Dictionary (ache Database Buffer (ache Ga#a /ool 8edo !og Buffer !arger /ool
Includes areas such as !ibrary (ache and Data Dictionary (ache. The !ibrary (ache includes the most recently e%ecuted 01! statements. "nables the sharing of commonly used statements across sessions. Is managed by a least recently used (!8,) algorithm and has two areas (01!$ /!701!) The Data Dictionary (ache includes the most recently used data definitions. Including information about database files$ tables$ inde%es$ columns$ users$ pri#ileges and other database ob5ects. (aching impro#es response time on 3ueries and D6!. 0tores copies of data bloc s that ha#e been retrie#ed from the datafiles. "nables great performance when you obtain and then update data. Is managed by a !8, algorithm. 8e3uired only if installing and using Ga#a because it ser#ices parsing re3uirements for Ga#a commands. Oracle IDg does re3uire it for normal wor ing. 8ecords all changes made to the database data bloc s. /rimary purpose is reco#ery. (hanges recorded within are called redo entries. 8edo entries contain information to reconstruct or redo changes. Optional area of memory in the 0JA used to relie#e the burden placed on the shared pool by session memory$ I7O ser#er processes$ bac up and restore operations by 86A- and parallel e%ecution message buffers.
3.1.3
This is memory reser#ed for each ser#er process connecting to an Oracle database. It is allocated when a ser#er process is created and deallocated when the ser#er process is terminated. It can only be used by one ser#er process. 3.1.! 'racle Processes In a ,ni%7!inu% en#ironment the Oracle Instance has processes run as indi#idual processesA in 4indows they run as threads. The processes that are running will differ depending on the features that ha#e been enabled for an Oracle Instance. The processes are owned by the Oracle user and can generally be seen by using the following command.
$ps &e$ ' grep oracle
The following list is not e%hausti#e but is to gi#e a general o#er#iew of some of the processes that may be running in the bac ground for an Oracle instance. 6ost of them will be co#ered in detail later. Archi#er (A8(n) (opies online redo log files to dis 7tape after each log switch for databases in A8(LIF"!OJ mode. (hec point ((:/T) ,pdates the headers of all datafiles when a chec point occurs. Database 4riter In most systems on database writer is ade3uate by for systems that modifies data hea#ily more (DB4D or DB4n) than one may be needed. It writes out data from the buffer cache in the 0JA to the database. Dispatcher (Dnnn) 4hen the Oracle Instance is setup with the 6ulti-Threaded-ser#er the dispatcher routes client
DBA Introduction
!og 4riter (!J48) /rocess 6onitor (/6O-) 8eco#erer (8"(O) 0ystem 6onitor (06O-)
re3uests to the ne%t a#ailable shared ser#er process. The log writer process (!J48) writes the redo log buffer to a redo log file on dis . This is basically a cleanup system for processes that fail. It will clean up the database buffer cache$ and free resources that the user>s process was using. 4ith a distributed database configuration this process automatically resol#es failures for the distributed transactions. /erforms system wide house eeping tas s such as crash reco#er$ if necessary$ at instance startup$ cleaning up temporary segments$ coalescing contiguous free e%tents.
3.2
'racle Database
An Oracle Database is 5ust basically a set of files treated as a unit. It pro#ides the actual physical storage of the database data and is mounted by one or more instances. All data is contained within Tablespaces and accessible only when the database is O/"-. There are three basic file types that ma e up the Oracle Database. File Type Datafiles Description A tablespace in an Oracle database consists of one or more physical datafiles. A datafile can be associated with only one tablespace and only one database. Oracle creates a datafile for a tablespace by allocating the specified amount of dis space plus the o#erhead re3uired for the file header. 4hen a datafile is created$ the operating system under which Oracle runs is responsible for clearing old information and authori&ations from a file before allocating it to Oracle. The database control file is a small binary file necessary for the database to start and operate successfully. A control file is updated continuously by Oracle during database use$ so it must be a#ailable for writing whene#er the database is open. If for some reason the control file is not accessible$ then the database cannot function properly. "ach control file is associated with only one Oracle database. It is ad#isable to ha#e multiple copies of the control file being used by the database. A set of files that protect altered database data in memory that has not been written to the datafiles. The redo log can consist of two parts' the online redo log and the archi#ed redo log.
(ontrol @iles
There are three additional types of files that should be part of any bac up policy of an Oracle database. File Type /arameter @iles (initORACLE_SID.ora$ spfileORACLE_SID.ora) /assword @ile Description Minimum Backup Policy
(ontrols aspects of the database instance and is 6onthly and before each change referenced at startup time.
/assword
directory 6onthly and before each change ORACLE_BASE(ORACLE_HOME()A*A+ASE and are named P,)sid%ORA$ where SID identifies the Oracle database instance. /assword files can be used for local or remote connections to an OracleNi database. Optionally$ filled online redo files can be archi#ed Depends on the #olume but at least before being reused$ creating an archi#ed redo log. daily. Archi#ed (offline) redo log files constitute the archi#ed redo log.
files
are
located
in
DBA Introduction
There are primarily two ways to connect to an Oracle Instance. If your user7application resides on the same machine as the Oracle Instance you can do a )local+ connection which can either be through an O0 authenticated account or an Oracle account which re3uires a username and password. A local connection does not pass through the Oracle -et (formerly 01!?-et)$ which is a part of the Oracle -et 0er#ices. This concept is similar to the differences between an Oracle Instance and an Oracle Database. If the user7application (client) resides on a different machine then it is a remote connection and uses the Oracle -et to access the system. @or database security O0 authenticated accounts should ne#er be allowed for remote connections. It should be noted here that e#en when the user7application resides on the same machine as the Oracle Instance$ you can still use Oracle -et to access the system$ and in fact many of the Oracle>s applications and third party software applications do.
Oracle (lient
tnsnames.ora s3lnet.ora !istener /rocess listener.ora
-etwor
Oracle 0er#er
There are se#eral files that control the connection from the client to the database. tnsnames.ora The transparent networ substrate names configuration file$ should reside on any machine that wants to ma e a client connection to the database. This maps -et ser#ice names to connection descriptors. s3lnet.ora !istener.ora This configuration file resides on both the client and ser#er. It contains parameter for domain$ naming methods$ log7trace$ route$ security and access control. This configuration file resides on the ser#er and contains the listener name$ protocol addresses on which the listener accepts connection re3uests$ database ser#ices$ and control parameters. Although @igure O ' "stablishing Database (onnection$ shows the listener on a separate ser#er as the database instance they often reside on the same hardware.
The tnsnames.ora file contains all the connection descriptors for the databases to which you want to connection from the machine on which it resides. It contains information about the destination ser#ice and networ route information.
DBA Introduction
The following is an e%ample of the connect descriptor format' -et<ser#ice<nameM (D"0(8I/TIO-M (ADD8"00M(protocol<address<information)) ((O--"(T<DATAM (0"8FI("<-A6"Mser#ice<name))) The listener listens for client connections. Once it recei#es a session re3uest and establishes the lin between the client and the ser#er$ it then establishes a new process (or pic s from a pool and allocates processes). The client and the ser#er then communicate independently of the listener. 0hutting down or restarting the listener while a client application is running generally will ha#e no effect on the e%isting application session$ but it is not a recommended practice. The !istener (ontrol ,tility (lsnrctl) is used to the control or #iew the listener configuration. It can be used to start7stop or e#en dynamically change some parameters. The lsnrctl status command will display a list of listeners which will include descriptions and ser#ices and their indi#idual status (8"AD=$ B!O(: or ,-:-O4-).
$ lsnrctl status -listener name.
esults! "f t#e listener is up$ results s#ould be somet#in% like! !0-8(T! for 0olaris' Fersion N.C.D.B.D - /roduction on DO-GA--CDDB DP'OQ'OC (opyright (c) CDD; Oracle (orporation. All rights reser#ed.. (onnecting to (D"0(8I/TIO-M(ADD8"00M(/8OTO(O!MI/()(*M".T/8O())) 0TAT,0 of the !I0T"-"8 -----------------------Alias Fersion 0tart Date ,ptime Trace !e#el 0ecurity 0-6/ !istener !og @ile !I0T"-"8 T-0!0-8 for 0olaris' Fersion N.C.D.B.D - /roduction DO-GA--CDDB IB';I'DO IC days IR hr. IR min. ;N sec off O@@ O@@ 7opt7oracle7product7N.C.D7networ 7log7listener.log
!istener /arameter @ile 7opt7oracle7product7N.C.D7networ 7admin7listener.ora The command completed successfully "f t#e listener is do&n esults! 'e(ample) !0-8(T! for 0olaris' Fersion N.C.D.B.D - /roduction on DO-GA--CDDB DN'DD'D; (opyright (c) CDD; Oracle (orporation. All rights (D"0(8I/TIO-M(ADD8"00M(/8OTO(O!MI/()(*M".T/8O())) T-0-ICROI' T-0'no listener reser#ed. (onnecting to
DBA Introduction
T-0-ICRQD' T-0'protocol adapter error T-0-DDRII' -o listener 0olaris "rror' C' -o such file or directory (onnecting to (D"0(8I/TIO-M(ADD8"00M(/8OTO(O!MT(/)(LO0TM)(/O8TMIRCI))) T-0-ICROI' T-0'no listener T-0-ICRQD' T-0'protocol adapter error T-0-DDRII' -o listener 0olaris "rror' IOQ' (onnection refused
!.1
'racle %et
6ost connections issues can be traced to how the Oracle -et 0er#ices and its related components are configured. The Oracle 6anual says that Oracle -et 0er#ices is )a suite of networ ing components that pro#ide enterprise-wide connecti#ity solutions in distributed$ heterogeneous computing en#ironments.+ 0eemingly benign changes to the networ configuration at this layer can bring systems to a halt and debugging at that point is e%tremely difficult. There are many components to Oracle -et 0er#ices including Oracle -et$ listener$ Oracle (onnection 6anager$ Oracle -et (onfiguration Assistant$ and Oracle -et 6anager. Depending on the application and the location of the application on the system not all these components are used. Oracle -et is the communication software that enables a networ session from a client application to connect to an Oracle database ser#er. In other words$ Oracle -et is a )relay+ layer that sits on top of networ protocols and resides at both the client and ser#er ends. Its function is to perform the following critical networ tas s' 8elay calls from the client to the Oracle ser#er and bac /erform character translations between the client character set and the database character set.
4hen you are done reading this section you should ha#e a good understanding of the role and importance of Oracle -et and some base nowledge of its common configuration. In general communication through the networ follows the following steps (@igure R ' (lient 0er#er Architecture). I. Application communicates with Oracle -et on the client C. Oracle -et on the client communicates with the networ ;. The networ carries the communication to the ser#er O. The networ communicates with Oracle -et on the ser#er R. Oracle -et on the ser#er communicates with the 0er#er /rocess
DBA Introduction
(lient Application
-etwor
0er#er /rocess
!.2
6ost database programming interfaces (GDB($ ADO$ ODB($ etc.) and application such as /erl-DBI and /L/ communicate with Oracle -et through the O(I (see @igure Q). Lowe#er$ /ro?(7(SS and other pre-compiler applications communicate through a layer parallel to O(I called 01!!IB. Both of these layers interact with Oracle -et through the ,/I (user /rogram Interface) layer$ which is the lowest layer of the client stac . The preference is that client programs should interact with Oracle at the O(I le#el (01!!IB). There are thin clients that contain limited networ ing capabilities for tal ing to the Oracle -et !ayer and these non-O(I GDB( dri#ers bypass the O(I layer. 0ome see the benefits of this being you don>t ha#e to install the Oracle client$ howe#er since the throughput for these dri#ers is less than that of O(I-based GDB( dri#er the cost is performance.
(lient Application
ODB(
ADO
GDB(
O((I
Oracle (all Interface (O(I) ,ser /rogram Interface (,/I) Oracle -et @oundation !ayer Oracle /rotocol 0upport -etwor /rotocol
!.3
On the ser#er$ Oracle -et 0er#ices introduces the Oracle -et !istener layer between the networ and the Oracle /rotocol 0upport. The Oracle -et !istener basically wor s as a negotiator between the ser#er and the client re3uests. It recei#es a re3uest for a connection from the client and passes off the connection to a ser#er. Once this connection is establish it does not participate in the communication between client and ser#er (see @igure B). Depending on the type
DBA Introduction
of connection your application maintains$ it is entirely possible that the listener goes off-line with out affecting the application. 6any systems ha#e applications that only connect once and then maintain their connection until the system is shutdown. Therefore$ after the system starts up the listener can fail without bringing the entire system down (not recommended)$ but this does pre#ent new connections o#er the networ (local connections are still possible). ( l i e n t
!istener -etw or 0er#er /rocess Initial 8e3uest for (onnection
( l i e n t
(ommunication Land-Off
!.!
There are many different topologies that you could encounter with Oracle -et. 6ost li ely the ones that you will encounter will be of the following' !.!.1 (lient7ser#er architectures 0er#er application architectures Database !in s (including replication) "%ternal /rocedures Client 6 Server Architect*re
The client7ser#er architecture is illustrated abo#e (see @igure R) in which the client application accesses the database across the networ . The Oracle -et resides on both the client and ser#er side of the networ . "#ery user 7 application process connects to a ser#er process on the ser#er side. If the configuration is a dedicated ser#er configuration$ one ser#er process is spawned by the listener per client connection. If the configuration is of shared ser#er type$ then a many-to-one relationship e%ists between client and ser#er connections. !.!.2 Server Application Architect*re
The topology in which the ser#er application accesses the database on the same machine is a #ery minor #ariant of @igure R $ e%cept that this scenario li ely will reduce issues of networ latency. If you use an O0 authenticated account without specifying the instance in the connection string you by pass the listener when connecting to the ser#er.
DBA Introduction
(lient Application
0er#er /rocess
!.!.3
A database lin is li e a referenced ob5ect that e%ists in database A$ while operations actually ta e place o#er the lin on database B (see @igure N). The databases can reside on the same or different machines but re3uires all the proper Oracle -et 0er#ices configurations to be done properly. The basis of replication is a database lin and therefore can be depicted in the same manner.
(lient Application
0er#er .
0er#er =
Oracle -et on 0er#er
Database A
Database !in to DB B
Database B
-ote in this figure that the database and ser#er processes are shown two separate ser#ers but they could 5ust as easily be on the same ser#er. !.!.! - ternal Proced*res
"%ternal procedures are procedures defined e%ternally but declared in the database. 4hen they are called from the database an indi#idual process space is created from which they are e%ecuted. In this manner more O0 interaction can be obtained by the means of the shared libraries or D!!. It also pro#ides a means to use abilities a#ailable in other
DBA Introduction
languages li e ($ ADA or GAFA that are not a part of or as well suited for the database /!701!. 0pea ing from a security stand point$ the e%ternal procedures (e%tproc) should ha#e their own listener. The listener spawns the e%tproc process in a manner similar to the ser#er processes (represented by the dotted line in @igure ID) and communication then happens #ia I/(.
(lient Application
0er#er /rocess
There are other types of connections that are not mentioned here li e the Leterogeneous connection$ which allows communication between an Oracle database and other types of databases' the 4eb-Browser connection$ which is basically an application connection #ia a web-browswer. Lowe#er$ it is more li ely you will encounter on of the abo#e mentioned connections. If you would li e more information then do a google search on Oracle -et (onfigurations.
8*ic, Chec,s
Often there is a need to #erify whether an Oracle database is wor ing. 0ometimes a process running on one ser#er e%tracts data from a database on another ser#er. Tests may need to be performed locally as well as from the remote ser#er.
0.1
The output will #ary depending on the options in use. This output shows that the Oracle processes are running$ including tnslsnr$ often referred to as Tthe listenerT and critical for connections to be made to the local database. $ ps -ef | grep oracle oracle /01 2 0 Oct 22 3 oracle //1 2 0 Oct 22 3 /tnslsnr 8S*E9ER :inherit oracle /0; 2 0 Oct 22 3 oracle /20 2 0 Oct 22 3 oracle /27 2 0 Oct 22 3 oracle /2< 2 0 Oct 22 3 oracle /2; 2 0 Oct 22 3 oracle /21 2 0 Oct 22 3 oracle /70 2 0 Oct 22 3 oracle /77 2 0 Oct 22 3 oracle /7< 2 0 Oct 22 3 oracle =/11 2 0 Oct 72 3 >A))RESS?>PRO*OCO ?+EA@@@ oracle 601 2 0 Oct 22 3 >A))RESS?>PRO*OCO ?+EA@@@ oracle =<2< 2 0 )ec 72 3 /4/5 ora!dbw0!ORC 0400 /opt/oracle/product/6%7%0/bin 040/ 2427 ;4/2 0472 0402 042< 042< 0425 0425 0400 ora!pmon!ORC ora!lgwr!ORC ora!ckpt!ORC ora!smon!ORC ora!reco!ORC ora!snp0!ORC ora!snp2!ORC ora!snp7!ORC ora!snp/!ORC oracleORC >)ESCR8P*8O9?> OCA ?no@ >)ESCR8P*8O9?> OCA ?no@ >)ESCR8P*8O9?> OCA ?no@
DBA Introduction
>A))RESS?>PRO*OCO ?+EA@@@
0.2
T-ST Port
If access to netstat is enabled chec to assure a listener e%ists on the port that Oracle uses (by default IRCI). $ netstat :a ' grep 2572 B%2572 B%B 0 0 0 Oe!prod%/710; oe!prod%2572 /7=;1 0 /7=;1 oe!prod%2572 oe!prod%/710; /7=;1 0 /7=;1 localhost%/71<2 localhost%2572 /7=;1 0 /7=;1 localhost%2572 localhost%/71<2 /7=;1 0 /7=;1 oe!prod%2572 20%6%2%2/%/715< 7<170 0 1=;0 oe!prod%2572 20%6%2%2/%/71;2 7<170 0 1=;0 0 8S*E9 0 ES*A+ 8S"E) 0 ES*A+ 8S"E) 0 ES*A+ 8S"E) 0 ES*A+ 8S"E) 0 ES*A+ 8S"E) 0 ES*A+ 8S"E)
0.3
0.3.1
Connectivity Test
tnsping
This test can usually be done from both the remote and local ser#er. This test uses the information in OracleUs tnsnames.ora file to test connecti#ity. The command Ttnsping O8(!T$ for e%ample$ will loo for a database with a ser#ice name of O8(! and will issue a ping-li e re3uest to the configured port and report on the response. A successful response from tnsping will loo something li e this' $ tnsping ORC *9S Ping UtilitC $or UniD4 Eersion 6%7%0%0%0 : Production on 76:)EC:7005 >c@ CopCright 266= Oracle Corporation% All rights reserFed%
Attempting to contact >A))RESS?>PRO*OCO ?*CP@>"OS*?oe!prod@>POR*?2572@@ OG >22 msec@ The O: indicates that the networ is wor ing correctly and the response to II milliseconds. If Oracle is listening on a port other than IRCI$ the tnsping command will still wor $ assuming that the tnsnames.ora file contains the correct information. A tnsnames.ora entry for a single database will could something li e this' ORC ? >)ESCR8P*8O9 ? >A))RESS! 8S* ? >A))RESS ? >PRO*OCO ? *CP@>"OS* ? oe!prod@>POR* ? 2572@@ @ >CO99EC*!)A*A ? >SERE8CE!9A#E ? ORC @ @ @
Notice how the service name (ORCL) that used in the example tnsping command and the port on which the Oracle listener is responding (1521) are both con igured in this database descriptor!
0.3.2
S8#P#2S
"#lplus can be used to veri $ that Oracle is responding and some s#lplus commands can be used to veri $ that the tables or the content o tables match what is expected! %he s#lplus command ta&es this orm to connect to an Oracle database'
$sqlplus username/password-HserFice!name.
DBA Introduction
*his command speci$ies the usernameI password and SERE8CE!9A#E/S8) in a single command% Once connectedI Farious scripts can be run to Feri$C state o$ the database%
0.!
s3lnet.log listener.log V7bdump V7cdump
V7bdump7alertO8A<0ID.log
0.0
Creating a Script
Depending on the information you want to gather and the tests you want to run could ma e it 3uic er and more assured by writing scripts and display results or create log files. Often people li e to create e%cel spreadsheets to display results and so you may want to create files that are comma delineated. =ou might want to ma e se#eral indi#idual scripts li e a local connection TconnectClocalT and a similar script for connecting to a database on a remote ser#er TconnectCremT and then a wrapping script to e%ecute them both. ,nderstand that when ran from (8O- shell scripts only ta e the minimal shell settings. =ou should store the en#ironment #ariables to be used in a profile that is called within the scripts as needed' J Oracle Settings sttC erase K" eDport ORAC E!+ASE?/opt/oracle eDport ORAC E!"O#E?$ORAC E!+ASE/product/6%7%0 eDport ORAC E!*ER#?Ft200 eDport PA*"?$ORAC E!"O#E/bin4/usr/ccs/bin4/bin4/usr/bin4/usr/local/bin4/usr/ucb eDport ORAC E!S8)?OE!PRO) WX7bin7bash J connect7local4 connect to local db using sqlplus
% L/oracle!pro$ile J check connectiFitC to database tnsping $ORAC E!S8) sqlplus username/passwordH$ORAC E!S8) This is a #ery simple script that displays the results of the tnsping and should lea#e you at an 01! prompt. The ne%t logical step is to either log these results or use the e%it code from the commands to display succinct results.
0.1
Script Creation
=ou can write scripts which contain 01!?/!,0$ 01! and /!701! commands which you can retrie#e$ edit and run. This is especially useful for storing comple% commands or fre3uently used reports. /robably one of the easiest methods of script creation is to ha#e an O0 editor open in one window and the 01!?/lus program open in another. =ou can edit the script and sa#e it then you Y$ YY or 0TA8T commands to e%ecute the scripts. =ou can also use and operating system te%t editor without lea#ing 01!?/lus commands-line by enter the "DIT command at the 01!
DBA Introduction
prompt. 01!2edit =ou can also choose a particular O0 te%t editor by setting the 01!?/lus #ariable <"DITO8. @or e%ample$ to define the editor used by "DIT to be nedit$ enter the following command' D"@I-" <"DITO8 M nedit To create script with a te%t editor$ enter "DIT followed by the name of the file to edit or create$ for e%ample' 01!2"DIT 0A!"0 "DIT adds the filename e%tension .01! to the name unless you specify the file e%tension. If you 5ust type "DIT without a filename the last command stored in the buffer will appear for editing. 01!2select sysdate from dualA 01!2"DIT select sysdate from dual 7 =ou can use a number of 01!?/lus commands to edit the 01! command or /!701! bloc currently stored in the buffer. !ists the 01!?/lus commands that all you to e%amine or change the command in the buffer without re-entering the command.
Table 0+ S8#9Pl*s -diting Commands
Command APPEND text CHANGE /old/new CHANGE /text CLEAR B !!ER DEL DEL n DEL n * DEL LA#$ DEL m n DEL " n 'NP $ 'NP $ text L'#$ L'#$ n L'#$ " L'#$ n " L'#$ LA#$ L'#$ m n Abbreviation A text C/old/new C/text CL B !! Purpose Adds text at the end of the current line Changes old to new in the current line Deletes text from the current line Deletes all lines Deletes the current line Deletes line n Deletes line n through " Deletes the last line Deletes a range of lines %m to n& Deletes the current line through line n Adds one or more lines Adds a line consisting of text Lists all lines in the #)L *uffer Lists line n Lists the current line Lists the n through the current line Lists the last line Lists a range of line m to n
0.1.1
Saving (*ffer
4hen editing the buffer from the 01!?/lus command line you may want to sa#e the buffer to a file for use later. ,sing the 0AF" command will sa#e what is in the buffer to the filename of your choice. The 0AF" commands automatically adds .01! to the file name unless you specify a file e%tension. SQL>SAVE /tmp/mysqlscript This command sa#es a file to the 7tmp directory named mys3lscript.s3l. 0.1.2 Placing Comments ,sing the 01!?/lus 8"6A8: command for or - - for single line comments ,sing the 01! comment delimiters 7?H?7 for single or multi line comments
DBA Introduction
0.1.3
S*ppressing #isting
If you do not want the te%t of the script to be displayed on the screen when you run the file$ then your script needs to contain 0"T "(LO O@@ command. 0.1.! &*nning Scripts
The 0TA8T command retrie#es a script and runs the commands it contains. SQL> START file_name 01!?/lus assumes the file has an .01! e%tension by default. =ou can also use the Y and YY commands run the commands in the specified script in the same manner. SQL>@file_name SQL>@@file_name 0.1.0 &*nning a Script as @o* Start S8#9Pl*s @ollow the 01!/!,0 command with your username$ a slash$ your password$ a space$ Y$ and the name of the file'
To run a script as you start 01!?/lus$ use one of the following options
$SQLPLUS user_name/password @file_name If the /password is eliminated you will be prompted for the password.
0.4
S8# T*ning
01! is declarati#e$ so there are many ways to formulate a 3uery$ each with identical results but with far different e%ecution times. Oracle 01! tuning is a #ery comple% sub5ect with entire boo s written about it. This section pro#ides general ideas where to start researching for performance gains. 0.4.1 'ptimi)ing 'racle S8# - ec*tion eanaly*e statistics only &#en necessary+ It is a common mista e to fre3uently re-analy&e the schema. Lowe#er$ the only purpose to analy&ing the schema is to change the e%ecution plan of the 01!. If there are no complaints on the e%ecution times$ then don>t fi% it. Pre,tune t#e S-. before deployin% / De#elopers should be gi#en an en#ironment the properly reflects the Operational "n#ironment. This may entail e%porting the production (BO statistics into the test7de#elopment databases. This will allow the de#elopers to see how their 01! will e%ecute when it is placed in the production system. A0TOT A12 and T3P OF / ,tilities should be used to interpret 01! e%ecution results. Tune t#e overall system first / (hanges to critical (BO parameters (optimizer_mode, optimizer_index_cost_adj$ and optimizer_index_cachin ) can affect thousands of 01! statements so should be done with great care. $eneral $*idelines for S8# t*ning+ 8eplace unnecessary large-table full-table scans with inde% scans.
0.4.2
If your s3l statement displays less than OD percent of a table then it should not be performing full table scans. (hange the s3l to use an inde%$ chec to statistics to assure (BO is optimal or if needed add an inde%. (ache small-table full tables scans If a small table is being hit often then it should be placed into memory. !ogical reads (consistent gets) are often IDD% faster than a dis read and therefore small often accessed ob5ects should be cached in the :""/ pool. (andidates to be placed in the :""/ pool can be found by analy&ing dba<hist<s3lstat.
DBA Introduction
Ferify optimal inde% usage Ferify optimal GOI- techni3ues Tuning by 0implifying 01! 0ynta% o 8ewrite 3uery into a more efficient form o ,se the 4ITL clause o ,se Jlobal Temporary Tables o ,se 6ateriali&ed Fiews o Tune comple% sub3ueries to remo#e redundant access
The de#eloper should e%amine both inde%es and ensure the Oracle is using the best inde%. 0ome 3ueries perform faster with -"0T"D !OO/ 5oins and some with LA0L 5oins.
All though these see simple enough$ they comprise ND percent of 01! tuning.
DBA Introduction
.ario*s Tips
A 3uic reference sheet is #ery helpful especially when you are in a time crunch and need to ha#e the information right there in front of you. It is easier to eep the 3uic reference sheet up than try to remember the information in a crunch. 0ome of the information is generic but a lot of it is based upon the system. :eep it as a spreadsheet or 5ust in word format$ but eep it handy. It is also #ery useful to be able to pass onto people new to the group.
1.1
Tip Sheet
6etalin webaddress ' www.metalin .oracle.com 6etalin username ' Oracle (ustomer 0er#ice Identifier ((0I)' --------------------------Indi#idual 0ystem 0ystem -ame' 0ystem Description' (ontacts' 8ole (0A$ 00A$ DBA$..) -ame (ontact
0er#er -ame
Description
!ogin
Application ,ser
Directory7@ile !ocations (tnsnames.ora$ listener.ora$bdump$ cdump$ bac up logs$ udump$ s3lnet.ora) 0er#er -ame !ocationZ@ile -ame Description
DBA Introduction
-otes'
1.2
1.2.1
4hen running an script from (8O- or similar scheduling tool$ it only uses the basic shell #ariables therefore you need to set any #ariables li e O8A(!"<LO6" within the script itself. 1.2.2 S8# #ogin Profile
If you want to set your own defaults for when you log into 01! you can set things li e linesi&es$ pagesi&es$ feedbac $ and e#en the format of fields such as dates within the login.s3l in the 01!/ATL. 1.2.3 "%ample SQL>DESC ALL_TAB_COMMENTS
COLUMN OWNER TABLE_NAME TABLE_TYPE COMMENTS DATATYPE NULL VARCHAR2(30) NOT NULL VARCHAR2(30) NOT NULL VARCHAR2(11) VARCHAR2(4000) DESCRIPTION Owner of the object Name of the object Type of the object Comment on the object
If you need to now what fields a table contains use the D"0( ta!lename to #iew the table structure.
1.2.!
A##AB3 D(AAB32S-&ABTables There are many system tables which can be used to determine user7system information. Data dictionary tables are not directly accessible$ but you can access information in them through data dictionary #iews. To list the data dictionary #iews a#ailable to you$ 3uery the #iew DI(TIO-A8=.
SQL>select * from DICTIONARY 6any data dictionary tables ha#e three corresponding #iews' [ An A!!< #iew displays all the information accessible to the current user$ including information from the current userUs schema as well as information from ob5ects in other schemas$ if the current user has access to those ob5ects by way of grants of pri#ileges or roles. [ A DBA< #iew displays all rele#ant information in the entire database. DBA< #iews are intended only for administrators. They can be accessed only by users with the 0"!"(T A-= TAB!" pri#ilege. This pri#ilege is assigned to the DBA role when the system is initially installed.
DBA Introduction
[ A ,0"8< #iew displays all the information from the schema of the current user. -o special pri#ileges are re3uired to 3uery these #iews. "%amples' If you ha#e the proper pri#ileges you can see all the tables within a database by 3uerying the DBA<TAB!"0 #iew. SQL>SELECT OWNER,TABLE_NAME FROM DBA_TABLES; If you want to see all the tables the current user has access to #iew use the following 01! statement. SQL>SELECT OWNER, TABLE_NAME FROM ALL_TABLES; If you only want to see the tables the current user owner use the ne%t 01! statement. SQL>SELECT TABLE_NAME FROM USER_TABLES; I will list a few of the essential ones below and you can do a D"0( on them to see the a#ailable columns. Table -ame ?<A!!<TAB!" 0 ?<(O-0<(O! ,6-0 ?<(O-0T8AIT0 ?<"88O80 ,se Determine Table Information
?<"88O80 describes current errors on stored ob5ects (#iews$ procedures$ functions$ pac ages$ and pac age bodies) in the database. DBA<!O(: lists all loc s or latches held in the database$ and all outstanding re3uests for a loc or latch.
DBA<!O(:$ DBA<!O(:0
1.3
This part describes the dynamic performance #iews$ which are often referred to as V$#iews. These #iews can help in determining the performance of the database during testing or production. I will list a few of the more interesting and userful ones. Table -ame Description
F*DATABA0" Displays information about the database from the control file. F*/8O("00 This #iew contains information about the currently acti#e processes. 4hile the !AT(L4AIT column indicates what latch a process is waiting for$ the !AT(L0/I- column indicates what latch a process is spinning on. On multi-processor machines$ Oracle processes will spin on a latch before waiting on it. This displays the current state of the instanceA
F*I-0TA-("
DBA Introduction
Oracle databases are created with two accounts (0=0$0=0T"6) that ha#e DBA pri#ileges. The database administrator accounts ha#e a lot of power and should only be used when necessary to perform maintenance on they system. The best approach is to ha#e indi#idual accounts to do general trouble shooting$ data manipulation and monitoring of the system. 4hen doing tas s such as database bac ups and restores or trouble shooting it is easiest using a session on the ser#er that contains the actual instance you want to bac up or restore. If you are 5ust performing adhoc 3ueries or data manipulation then remote access is fine. "ach database administrator should ha#e an indi#idual O0 account with the dba group pri#ileges and then a database account with the pri#ileges needed to perform daily tas s.
4.1
S@S
0=0 is the owner of the database and the owner of the data dictionary. -e#er e#er create ob5ects in the 0=0 schema. The ob5ects belonging to 0=0 cannot be e%ported. 0=0 has the 0=0DBA pri#ilege which 0=0T"6 doesnUt. This ma es it possible for 0=0 to become a #ery powerful user. This is the case when connections are made as sys/password as SYSDBA or / as sysdba The as sysdba phrase is a re3uest to ac3uire the pri#ileges associated with the single 0=0DBA system pri#ileges. The difference becomes clear if you try to shutdown the database as ordinary 0=0' you get insufficient pri#ileges as result. Lowe#er$ if connected as 0=0DBA$ itUs possible. Anytime$ someone connects as 0=0DBA$ it turns out itUs being 0=0. That is$ if 0=0DBA is granted to GOL- and Gohn connects as 0=0DBA and select user from dual$ it re#eals heUs actually 0=0. "nsure that your O8A(!"<0ID is set to the correct instance name. If it is not set correctly then If accessing from local ,-I. account with the proper pri#ileges. If accessing remotely *echo *O8A(!"<0ID *e%port O8A(!"<0IDMORACLE_SID *s3lplus 7 as sysdba *s3lplus username7password as sysdba This ma es a sys connection A0 0=0DBA. 4hen using this connection you will need to use a special internal password if appropriate operating-system pri#ileges are not held. This )special+ password is held encrypted in a password file /4D\O8A(!"<0ID2.ora. This file is created by running the utility pro#ided by Oracle called O8A/4D. The use of this file can be limited to one instance$ it can be a shared password file between instances or it can limit connections to only secure networ s. The usage of the password file is controlled by an initiali&ation parameter 8"6OT"<!OJI-</A004O8D@I!" and is used to define the mode of the password file. ".(!,0IF" o The password file can be used with only one database o ,sers other than sys may be gi#en 0=0DBA pri#ileges 0LA8"D o @or use with multiple databases
DBA Introduction
o Only logins by sys are recogni&ed by a shared password file -O-" o -o pri#ileged connections o#er non-secure networ s o Allows remote connections from accounts that are able to acti#e O0DBA roles (this is O0 authentication)
4.2
S@ST-?
0=0T"6 is a pri#ileged administration user$ and typically owns Oracle pro#ided tables other than the dictionary. DonUt create your own ob5ects under 0=0T"6.
DBA Introduction
Database States
8emember that there are$ in essence$ two different entities' the Oracle Instance and the database. The instance is used to access and manipulate the database data and storage structures. An instance can be 0TA8Ted up which builds the 0JA in memory and starts the bac ground processes. The instances can also be 0L,T DO4- which closes the database$ stops the instance and remo#es the memory structures. The database itself may be open$ closed or mounted.
%'T0ometimes systems ha#e ;rd party clustering software li e L/ 0er#iceJuard in place which controls the shutdown and startup of the Oracle Database. If you howe#er a need arises that the DBA must startup7shutdown the instance there are steps that need to ta e place before issuing these commands to pre#ent 0er#iceJuard mo#ing the database pac age to a different node. (hec with your administrators on each system before trying to perform these commands to now the other steps to ta e.
5.1
Database Start*p
0TA8T,/ O/"Alterin% t#e database Opens datafiles and redo logs Ac3uires roolbac segments (alls 06O- if needed 6a es data dictionary a#ailable 0TA8T,/ 6O,-T !in s the instance to a database 8eads control file (hec s the datafiles and redo log files S#uttin% Do&n 'closin%)
"nstance started
S40TDO56
S40TDO56
It can be obser#ed in @igure II that the database can be altered in the upward direction (up the stairs) but not bac down them. In addition to the states there are three additional options that can be combined with the states whose purpose are in the following list.
-O6O,-T 6O,-T O/""ORCE RECO.ER 0tarts up the instance without mounting the database. Acti#ities are limited to things li e creating a database. The database is inaccessible with no dictionary a#ailable for password chec ing. 0tarts up the instance and mounts the database. It allows restricted use of the database for )DBA+ tas s such as file management and database structuring. There is no normal user access possible It starts the instance$ mounts and then opens the database. Other file management acti#ities a#ailable such as 6anipulating log files$ ta ing datafiles offline$ bac ing up control files. -ormal users processing is allowed. Shuts do#n an instance !e$ore startin it up in the speci$ied mode and is the same as per$ormin S%&'DO() A*OR' $ollo#ed !+ a start,up'his is an O/E) option #hich $orces automatic reco0er+ procedures on start,up-
DBA Introduction
RES'RIC'
'his is an O/E) option #hich limits access to the data!ase to users #ho ha0e !een ranted !oth CREA'E SESSIO) A)D RES'RIC'ED SESSIO) s+stem pri0ile es- It is use$ul $or doin tas1s li1e data!ase exports #hile there is no acti0it+ on the data!aseS2L3S'AR'&/ O/E) RES'RIC' Can !e remo0ed #hile open !+ doin the $ollo#in command4 S2L3AL'ER S5S'E6 DISA*LE RES'RIC'ED SESSIO)7
The abo#e options can be combined at the 01! prompt to create the state you wish the database to start. 01!20TA8T,/ ]@O8("^ ]-O6O,-T _ 6O,-T _ O/"- ]open<options^^ ]oracle<sid<name^]/@I!"Mparameter file^A "%amples' 01!20TA8T,/ 6O,-T prodA 01!20TA8T,/ O/"- 8"(OF"8A The database can be mo#ed upward on the state stair step by performing alter commands. 01!2A!T"8 DATABA0" 6O,I-TA 01!2A!T"8 DATABA0" O/"-A
5.2
Database Sh*tdo/n
=ou can not go bac down the stair step depicted in @igure II$ you ha#e to 0L,TDO4- the database completely and then you can open it to the state you need. The 0L,TDO4- command closes the database$ dismounts the database and then shuts down the instance. There are se#eral 0L,TDO4- options that can be employed. 01!20L,TDO4- -O86A! o The database will only 0L,TDO4- when all users ha#e logged off and all wor is committed (or rolled bac ). o -o new connections are allowed. o This option is difficult to use in man en#ironments since the users are applications and all the applications ha#e to be shutdown before the database would shutdown. 01!20L,TDO4- I66"DIAT" o Disconnects all users and performs rollbac on all uncommitted data by using /6Oo Terminates all current 01! statements 01!20L,TDO4- ABO8T o 0huts down without tidying upA a in to system failure and re3uires system reco#ery on start-up o -o rollbac of uncommitted transactions
DBA Introduction
Database (ac,*p
&'e "lannin! o( t'e bac#u" and recover strate!ies o( t'e database 'as to be inte!rated into t'e bac#u" and recover strate!ies o( a s stem and business in !eneral$ Some sam"le items to consider6 ?$ Bac#u" retention "olicies @ &'is ma var de"endin! on 'o. o(ten ou are able to "er(orm a (ull bac#u"$ Business rules ma dictate "olicies$ State or !overnment la.s ma "lace restrictions on retention times$ A$ &a"e retention "olicies @ &'is "robabl !oes 'andBinB'and .it' bac#u" retention "olicies$ &'ere ma be cases 'o.ever t'at ou #ee" one bac#u" onBline and an older one o((site$ C'ere is our o((site ta"e stora!e locationD E$ Detailed ca"acit "lannin! @ &'e bac#u" "lan ou "ut into "lace toda * ma be outdated ne7t ear i( t'e s stem !ro.s immensel $ 8ou s'ould #no. .'at c'an!es are e7"ected .it'in t'e business and (orecast .'at e((ects it .ill 'ave on t'e si/e o( our database and our bac#u"s$ F$ Location o( bac#u"s @ C'ere .ill ou store our bac#u"s$ Cill our bac#u"s !o directl to ta"e or .ill ou .rite t'em to dis# (irst and t'en 'ave t'e s stem .rite t'em to ta"eD G$ I( ou .rite bac#u"s to dis# t'en .'en .ill t'e !et .ritten to a ta"eD Ho. do ou #no. t'at t'e 'ave been .ritten to ta"e so ou can reuse t'e s"ace (or a ne. bac#u"D
DBA Introduction
ecovery Strate%y Different types of failures within an Oracle database re3uire their own reco#ery. This document will document many of types of database failures but all scripts and steps need to be modified for your system and then tested. I. Instance @ailure EInstance failure can usually automatically addressed by Oracle if the ser#er has not failed as well. If the ser#er has failed and can be restarted successfully$ the Oracle ser#er can automatically reco#er itself from the redo logs upon startup. C. 6edia @ailure E 6edia failures re3uire media reco#ery$ which is the process of restoring database files to the most recent point-in-time image prior to the media failure. 6edia reco#ery can be supported by using a combination of bac up files and archi#ed redo log files. ;. 0er#er (-ode) @ailure E This can be dressed by failing o#er to another node if you are in @ail 0afe configuration. A secondary node can share the same dis dri#es and datafiles as the primary node and can be brought up upon node failure. This is not to be confused with 8A($ J8ID or an Oracle standby database. If there is only one se#er then problems with that ser#er will need to be addressed before the database reco#ery can be performed. It can not be emphasi&ed enough that for 3uic reco#ery you don>t want to be sitting at a terminal trying to remember commands or not understanding how to do the steps properly. All scripts and steps should be well documented and tested multiple times to assure they wor properly.