Oracle Database Administration Fundamentals II Note Sheets

Transcription

Cleaning Up Failed Online Backups 6Oracle Database AdministrationFundamentals II (Note Sheets) v. 1.0On Oracle 9iBy: Ahmed BarakaBacking Up the Initialization Parameter File 6DBVERIFY Utility 7User-Managed Complete Recovery 7User-Managed Complete Recovery in NOARCHIVEMODE 7User-Managed Complete Recovery in ARCHIVEMODE 7Oracle Net Architecture and Configuration 3Recovery of a Datafile Without a Backup 7Oracle Net Configuration Files 3Read-Only Tablespace Recovery 7Connection Methods 3Determining Which Files Need Recovery 7Implementing Spawn and Bequeath Connections inWindows 3Using Archived Redo Log Files During Recovery 7The listener.ora File Parameters 3Restoring Data Files to Different Locations 7Dynamic Service Registration 3User-Managed Incomplete Recovery 7Configure the Listener for Oracle9i JVM: HTTP 3Cancel-Based Recovery 7Listener Control Utility (LSNRCTL) 3Time-Based Recovery 8Naming Methods 4Change-Based Recovery 8Host Naming Method 4Using a Backup Control File During Recovery 8Local Naming 4Oracle Recovery Manager Configuration 8Configuration of the Oracle Shared Server 4Connecting to RMAN without a Recovery Catalog 8The SGA and PGA in the Shared Server 4RMAN Command Line Arguments 8Configuring Oracle Shared Server 4Configuring the RMAN Environment 8Setting DISPATCHERS Parameter 4RMAN Channel Commands 8Other Shared Server Configuration Parameters 5Duration in days of RMAN information in control file 8To Verify Shared-Server Setup 5Dynamic Views of Shared Server 5RMAN Backups 8Using a Dedicated Server with Oracle Shared Server 5Backup Piece Size 8Backup Command 8Configuring the Database Archiving Mode 5Control File Backups 9Setting ARCHIVELOG mode 5Backing Up the Server Parameter File 9View ARCHIVELOG mode of a Database 5Backing Up Archived Redo Logs 9Setting Automatic Archiving 5Multiplexed Backup Sets 9Manually Archiving Logs 5Parallelization of Backup Sets 9Specifying Archive Destinations 6Duplexed Backup Sets 10LOG ARCHIVE MIN SUCCEED DEST Parameter 6Image Copies 10Formatting ArchiveLog Filenames 6Image Copy Parallelization 10Multiple ARCn Processes 6Copying the Whole Database 10Dynamic Performance Views 6Incremental Backups 10User-Managed Backup 6Cold Backup 6Hot or Online Backup 6Backing up Control Files 6Page 1Backup in NOARCHIVELOG Mode 10Tags for Backups and Image Copies 10RMAN Dynamic Views 10Monitoring RMAN Backups 11Oracle Database Administration Fundamentals II (Note Sheets)

Detecting Corruption 11RMAN Complete Recovery 11Recover a Database in ARCHIVELOG Mode 11Restore Datafiles to a New Location 11Recover a Tablespace 11Relocate a Tablespace 11RMAN Incomplete Recovery 11Incomplete Recovery of a Database 11RMAN Maintenance 11Cross Checking Backups and Copies 11Deleting Backups and Copies 12Changing the Availability of RMAN Backups and Copies 12Exempting a Backup or Copy from the Retention Policy 12SQL*Loader Parallel Load Methods 15Copyright and Usage Terms Anyone is authorized to copy this document to anymeans of storage and present it in any format to anyindividual or organization for non-commercial purposefree. No individual or organization is authorized to use thisdocument for commercial purpose without a writtenpermission from the author. There is no warranty of any type for the code orinformation presented in this document. The editor isnot responsible for any loses or damage resulted fromusing the information or executing the code in thisdocument. If any one wishes to correct a statement or a typingerror or add a new piece of information, please sendthe request to ahmed b72@yahoo.com . If themodification is acceptable, it will be added to thedocument, the version of the document will beincremented and the modifier name will be listed inthe version history list.The CATALOG Command 12The CHANGE UNCATALOG Command 12Recovery Catalog Creation and Maintenance 12Creating Recovery Catalog 12To Update The Recovery Catalog Manually 13Version l document.Name1.0Ahmed BarakaResynchronization of the Recovery Catalog 13Resetting a Database Incarnation 13RMAN Catalog Reporting 13Stored Scripts 13Export and Import Utilities 13Requirements 13Invoking Export 13Export Modes 13Direct Path mode 14Invoking Import 14Import Modes 14Invoking Import as SYSDBA 14Import Process Sequence 14Manually Creating Tables Before Importing Data 14Using Parameter File 14Using SQL*Loader 14Direct-Load Insert Operations 14Issuing SQL*Loader 14Control File 14Conventional, Direct-Path and External-Path Loads 15Page 2Oracle Database Administration Fundamentals II (Note Sheets)

TRACE DIRECTORY lstname : directory of the trace fileOracle Net Architecture and ConfigurationTRACE FILE lstname : filename of the trace fileOracle Net Configuration FilesSAVE CONFIG ON STOP lstname : whether changesmade by LSNRCTL SET command are made permanent(FLASE)Following are the configuration files:o listener.orao tnsnames.oraDynamic Service Registrationo names.oraConfigure Registrationo sqlnet.oraThe following initialization parameters must be configured:o ldap.orao SERVICE NAMES: specifies one or more names for thedatabase service to which this instance connects.Generally Oracle Net searches for those files in the followingorder:1. The directory specified by the TNS ADMIN environmentvariable.2. The ORACLE HOME\network\admin directoryo INSTANCE NAME: the instance nameExamplesSERVICE NAMES sales.us.oracle.comINSTANCE NAME salesdbRegistering Information with the ListenerConnection Methods Spawn and Bequeath : The listener passes or bequeathsthe connection to a spawned process. This method is usedin a dedicated server configuration only. Direct Hand-Off Connections: The listener will hand offa connection to a dispatcher when an Oracle Shared Serveris used. This method is not possible with dedicated serverprocesses. Redirected Session: A connection may be redirected bythe listener to a dispatcher if a Shared Server is used.Implementing Spawn and BequeathConnections in WindowsSet USE SHARED SOCKET environment variable (in theregistry) to TRUE to allow multiple connections to use a singlesocket. When the value is FALSE (default), bequeathconnections are not possible so a redirect session is initiatedinstead.The listener.ora File ParametersLISTENER (ADDRESS LIST (ADDRESS (PROTOCOL TCP)(Host stc-sun02)(Port 1521)))SID LIST LISTENER (SID LIST (SID DESC (ORACLE HOME /home/oracle)(GLOBAL DBNAME ORCL.us.oracle.com)(SID NAME ORCL)))Other Parameters:LOGGING lstname : turn logging on and off (ON) By default, PMON registers with a local listener on theserver on the default local address of TCP/IP, port 1521 PMON can register with a non default listener if:o LOCAL LISTENER initialization parameter is definedo LISTENERS attribute of the DISPATCHERS initializationparameter is defined for Oracle Shared ServerConfigure the Listener for Oracle9i JVM: HTTP If both the listener and database are Oracle9i, configurationoccurs dynamically during service registration. If the database is Oracle8i or earlier, configure listeningaddresses statically using the following procedure, evenif an Oracle9i listener is used.1. Configure listener with TCP/IP or TCP/IP with SSLprotocol2. Enter the host name of the database in the Host field.3. Enter port 2481 in the Port field if the chosen protocolis TCP/IP, or enter port 2482 in the Port field if thechosen protocol is TCP/IP with SSL.4. Dedicate the address for JServer connections.listener DESCRIPTION LIST (DESCRIPTION (ADDRESS (PROTOCOL tcp)(HOST server1)(PORT 2481))(PROTOCOL STACK (PRESENTATION GIOP)(SESSION raw))))Listener Control Utility (LSNRCTL)Invoke the utilityLsnrctlLOG DIRECTORY lstname : directory of the log fileLOG FILE lstname : filename of the log fileTRACE LEVEL lstname: Turns tracing off or on to a specificlevel. Possible values: Off, User, Admin, SupportPage 3Starting a listenerSTART listener nameOracle Database Administration Fundamentals II (Note Sheets)

Stopping a listenerSTOP listener name2. Configure HOSTNAME as the First Naming MethodIn the sqlnet.ora file:NAMES.DIRECTORY PATH (hostname, tnsnames)Additional Commands:3. Set Up Host Name Resolution EnvironmentThe service name must be resolved through an IPaddress translation mechanism, such as DNS, NIS, or acentrally-maintained TCP/IP host file.o RELOAD: shuts down everything except listener addressesand rereads the listener.ora file.o CHANGE PASSWORD: dynamically changes the encryptedpassword of a listener.o EXIT quits the LSNRCTL utility.o QUIT same as EXITo HELP display list of the utility commandso SAVE CONFIG creates a backup of your listenerconfiguration file (called listener.bak) and updates thelistener.ora file itself to reflect any changeso SERVICES provides detailed information about servicesand instances registered and the service handlersallocated to each instance.o SET par sets a listener parameter. SET modifiers are:CURRENT LISTENERLOG DIRECTORYLOG FILELOG STATUSPASSWORDSAVE CONFIG ON STOPTRC DIRECTORYTRC FILETRC LEVELo SHOW par lists the value of a listener parameter.o STATUS provides basic status information about alistener, including a summary of listener configurationsettings, the listening protocol addresses, and a summaryof services registered with the listener.4. Connect to the DatabaseCONNECT username/password@sales.us.acme.comLocal Naming1. Configure tnsnames.ora FileSAMPLE (DESCRIPTION (ADDRESS LIST (ADDRESS (PROTOCOL TCP)(HOST sun1)(PORT 8461)))(CONNECT DATA (SERVICE NAME U461)))2. Configure The sqlnet.ora FileNAMES.DIRECTORY PATH (TNSNAMES)Configuration of the Oracle Shared ServerThe SGA and PGA in the Shared ServerCursor state and user session data will be stored in thelarge pool area, if configured. Otherwise they will be storedin SGA, specifically in shared pool.Configuring Oracle Shared Server Naming Methods Required initialization parameters:o DISPATCHERSo SHARED SERVERSHost naming Local naming Directory naming Optional initialization parameters:o MAX DISPATCHERS Oracle Nameso MAX SHARED SERVERS External namingo CIRCUITSo SHARED SERVER SESSIONSHost Naming MethodPrerequisites: Oracle Net Services software installed on client and server Client and server are connecting using TCP/IP protocol An IP address translation mechanism, such as DomainName System (DNS) or a centrally maintained TCP/IPhosts file, to resolve names. No advanced features such as Oracle Connection Manageror security options are usedTo configure the host naming method:1. Configure the ListenerRegister the database dynamically or statically.Page 4Note: The parameters have reasonable defaults. On manysystems, the only parameter that should be configured isDISPATCHERS.Setting DISPATCHERS Parameter Parameter type: String (Specify as a quoted string) Parameter class: Dynamic (use ALTER SYSTEM to modify) Default value: NULLParameter Attributes:o PROTOCOL: the network protocolo ADDRESS : network protocol address of the endpointon which the dispatchers listenOracle Database Administration Fundamentals II (Note Sheets)

o DESCRIPTION: the network description of the endpoint onwhich the dispatchers listen, including the networkprotocol address For example:(DESCRIPTION (ADDRESS .))o DISPATCHERS:The initial number of dispatchers to start(default is 1). Use the following formula: Initial number ofdispatchers CEIL (Average number of concurrentsessions/Connections per dispatcher)o SESSIONS: The maximum number of network sessionsfor each dispatcher. Mostly the default is16Ko CONNECTIONS: the maximum number of networkconnections to allow for each dispatcher. The default is1024 for Sun Solaris and Windows NT.Example:DISPATCHERS "(PROTOCOL TCP)(DISPATCHERS 3)"Note: All attributes can be ab

Oracle Net Configuration Files Following are the configuration files: o listener.ora o tnsnames.ora o names.ora o sqlnet.ora o ldap.ora Generally Oracle Net searches for those files in the following order: 1. The directory specified by the TNS_ADMIN environment variable. 2. The ORACLE_HOME\network\admin directory Connection Methods