You are on page 1of 47

Note:$ORACLE_HOME/rdbms/admin/prgrmanc.

sql col algorithm_name format a15 col algorithm_description format a25
Encryption Algorithms

SELECT * FROM gv$rman_encryption_algorithms;
The default encryption algorithm is 128-bit AES.

Data Dictionary Objects

DBA_HIST_INSTANCE_RECOVER GV_$RECOVERY_STATUS Y V_$FLASH_RECOVERY_AREA_U DBA_RECOVERABLE_SCRIPT SAGE DBA_RECOVERABLE_SCRIPT_BL V_$INSTANCE_RECOVERY OCKS DBA_RECOVERABLE_SCRIPT_ER V_$RECOVER_FILE RORS DBA_RECOVERABLE_SCRIPT_PA V_$RECOVERY_FILE_DEST RAMS GV_$INSTANCE_RECOVERY V_$RECOVERY_FILE_STATUS GV_$RECOVER_FILE V_$RECOVERY_LOG GV_$RECOVERY_FILE_STATUS V_$RECOVERY_PROGRESS GV_$RECOVERY_LOG V_$RECOVERY_STATUS GV_$RECOVERY_PROGRESS
Format Description Current database activation id Zero-filled activation ID The copy number of the backup piece within a set of duplexed backup pieces.bMaximum value is 256 Database name Current day of the month from the Gregorian calendar in format DD Archived log sequence number Absolute file number Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name Archived redo log thread number DBID Month in the Gregorian calendar in the format MM Database name, padded on the right with x characters to a total length of eight characters Tablespace name. Only valid when backing up datafiles as image copies. Piece number within the backup set. This value starts at 1 for each

Format Directives

%a %A %c %d %D %e %f %F %h %I %M %n %N %p

backup set and is incremented by 1 for each backup piece created. If a PROXY is specified, the %p variable must be included in the FORMAT string either explicitly or implicitly within %U.

%r %s

Resetlogs ID Backup set number. This number is a counter in the control file that is incremented for each backup set. The counter value starts at 1 and is unique for the lifetime of the control file. If you restore a backup control file, then duplicate values can result. CREATE CONTROLFILE initializes the counter at 1. Zero-filled sequence number Backup set time stamp, a 4-byte value derived as the number of seconds elapsed since a fixed reference time. The combination of %s and %t can be used to form a unique name for the backup set. Year, month, and day in the Gregorian calendar in the format: YYYYMMDD An 8-character name constituted by compressed representations of the backup set or image copy number and the time the backup set or image copy was created A system-generated unique filename (default). %U is different for image copies and backup pieces. For a backup piece, %U is a shorthand for %u_%p_%c and guarantees uniqueness in generated backup filenames. For an image copy of a datafile, %U means the following: data-D-%d_id-%I_TS-%N_FNO-%f_%u For an image copy of an archived redo log, %U means the following: arch-D_%d-id-%I_S-%e_T-%h_A-%a_%u For an image copy of a control file, %U means the following: cf-D_%d-id-%I_%u Year in this format: YYYY Percent (%) character. For example, %%Y translates to the string %Y

%S %t

%T %u %U

%Y %%
Repository Initialization Parameters

compatible=10.2.0 log_archive_format=RMAN_%s_%r_%d.arc remote_login_passwordfile=SHARED show parameter archive_format -- as root $ unmount /mnt $ mkdir /u01 $ chown oracle:dba /u01 $ chmod 755 /u01 $ cd /etc $ vi fstab 192.168.2.200:/vol/vol1/alpha1 /u01 nfs rw,bg,intr,hard,rsize=32768,wsize=32768,noac,noloc k,tcp,vers=3 0 0

To create a permanent NAS Mount

Create RMAN Repository and Catalog

/* as Linux user oracle modify the TNSNAMES.ORA to point to the database that will host the repository catalog: Then ... */ $ sqlplus / as sysdba -- using OMF SQL> CREATE TABLESPACE cat_tbs; SQL> CREATE USER repoomega IDENTIFIED BY oracle1 DEFAULT TABLESPACE cat_tbs TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON cat_tbs; RMAN> RMAN> RMAN> - for GRANT create session TO repoomega GRANT recovery_catalog_owner TO repoomega; GRANT execute ON dbms_stats TO repoomega; demos

-- in the operating system shell $ rman target / catalog repoomega/oracle1@repos RMAN> create catalog tablespace cat_tbs; RMAN> register database; RMAN> report schema; RMAN> configure default device type to disk; RMAN> configure device type disk parallelism 2 backup type to copy; RMAN> configure retention policy to recovery window of 7 days; RMAN> configure backup optimization on;
Put the database into ARCHIVELOG mode

/* as Linux user oracle modify the TNSNAMES.ORA to point to the database that will host the repository catalog: Then ... */ $ sqlplus / as sysdba col name format a30 col value format a30 SELECT name, value

FROM gv$parameter WHERE name LIKE '%arch%'; -- alter the SPFILE as required shutdown immediate; startup mount; alter database archivelog; alter database open; archive log list; alter system switch logfile; archive log list; RMAN> BACKUP TAG Q107 DATABASE KEEP FOREVER; Commands @ @<path_and_file_name>
Execute a series of script of RMAN commands stored in an operating system file. Do not leave whitespace between the @ and filename.

rman TARGET / @backup_db.rcv or RMAN> RUN { @backup_db.rman }

@@
Execute script files located in the same directory as the file from which it has been called

@@<path_and_file_name> TBD

ADVISE FAILURE
Displays repair options for the specified failures. Prints a summary of the failures identified by the Data Recovery Advisor and implicitly closes all open failures that are already fixed.

ADVISE FAILURE <ALL | CRITICAL | HIGH | LOW | failure_number_list> EXCLUDE FAILURE <failure_number_list> RMAN> LIST FAILURE; RMAN> ADVISE FAILURE ALL; RMAN> REPAIR FAILURE;

ALLOCATE CHANNEL d2 DEVICE TYPE DISK FORMAT '/u02/backups/%U'. Manually allocated channels apply only to the RUN job in which you issue the command. operating system resources are not allocated until you open a file for reading or writing. Allocate one DEVICE TYPE DISK channel for ach disk RMAN RUN { ALLOCATE CHANNEL tape1 DEVICE TYPE sbt. then each connection operates on a separate backup set or disk copy. If you establish multiple connections. Each connection initiates an database server session on the target or auxiliary instance: this server session performs the work of backing up.ALLOCATE CHANNEL To manually allocate a channel. BACKUP DATABASE PLUS ARCHIVELOG. On other platforms. restoring. Manually allocated channels (allocated by using ALLOCATE) should be distinguished from automatically allocated channels (specified by using CONFIGURE). <channel_id>. You can always override automatic channel configurations by manually allocating channels within a RUN command. Allocating multiple channels simultaneously allows a single job to read or write multiple backup sets or disk copies in parallel. or recovering RMAN backups. Each channel operates on one backup set or image copy at a time. You can control the degree of parallelism within a job by allocating the desired number of channels. . On some platforms. RELEASE CHANNEL. which is a connection between RMAN and a database instance. Allocating a Single Backup Channel Allocate a disk channel ALLOCATE [AUXILIARY] CHANNEL <channel_name> [. operating system resources are allocated at the time the command is issued. RMAN automatically releases the channel at the end of the job. } RUN { ALLOCATE CHANNEL d1 DEVICE TYPE DISK FORMAT '/u01/backups/%U'. Whether ALLOCATE CHANNEL causes operating system resources to be allocated immediately depends on the operating system. Automatic channels apply to any RMAN job in which you do not manually allocate channels. DEVICE TYPE <device_type_name>[allocation_operand_list] SQL> desc gv$backup_device SQL> SELECT * FROM gv$backup_device. RMAN> RUN { ALLOCATE CHANNEL d1 DEVICE TYPE DISK FORMAT '/u01/backups/%U'. } Allocates a tape channel for a whole database and archived redo log backup Spread the backup across several disk drives. BACKUP DATABASE PLUS ARCHIVELOG. RELEASE CHANNEL.

TBD ALTER DATABASE ALTER DATABASE <MOUNT | OPEN | OPEN RESETLOGS>. ALTER DATABASE OPEN RESETLOGS. . RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK. # AS COPY is the default. datafile (current or copy). Mount and open the database resetlogs RUN { ALLOCATE CHANNEL ch1 DEVICE TYPE sbt.. Mount and open the database RMAN> RMAN> RMAN> RMAN> STARTUP NOMOUNT. tablespace. BACKUP DATAFILE 1 FORMAT '/u01/backups/%U'. RECOVER DATABASE. RESTORE DATABASE. so RMAN creates image copies BACKUP DATABASE PLUS ARCHIVELOG.drive and specify the format string so that the filenames are on different disks When creating multiple copies of a backup. ALTER DATABASE MOUNT. } RUN { ALLOCATE CHANNEL c1 DEVICE TYPE DISK MAXPIECESIZE 5M.. SET UNTIL SCN 1024. ALTER DATABASE OPEN. and then creates two identical backups of datafile 1 to two different file systems *Allocates a channel in preparation for a CHANGE. you can specify the SET BACKUP COPIES command.Back up a database. } Allocate Maintenance Channel ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE <device_specifier> [allocation_operand_list]. RELEASE CHANNEL. control file (current or copy).| ALTER CLONE ? ALTER CLONE . SPFILE. or CROSSCHECK. SET BACKUP COPIES = 2. This cannot be used within a RUN block. '/u02/backups/%U'. DELETE. BACKUP DATABASE.. The following example generates a single backup of the database to disk. } BACKUP -. BACKUP DATABASE PLUS ARCHIVELOG.

. BACKUP AUXILIARY .Back up a database. or backup set.. 6. NEW> | FORMAT <formatSpec> <forRecoveryOfSpec> FULL <keep option> MAXSETSIZE <sizeSpec> <notBackedUpSpec> NO CHECKSUM NO EXCLUDE POOL <integer> PROXY [ONLY] REUSE SECTION SIZE <sizeSpec> <skipSpec> TAG '<tag_name>' VALIDATE -.. NEW> | FORMAT <formatSpec> <forRecoveryOfSpec> INCREMENTAL <LEVEL | FROM SCN> <integer> <keep option> MAXSETSIZE <sizeSpec> <notBackedUpSpec> NO CHECKSUM NO EXCLUDE POOL <integer> PROXY [ONLY] REUSE SECTION SIZE <sizeSpec> <skipSpec> TAG '<tag_name>' VALIDATE BACKUP ARCHIVELOG Backs up copy of each distinct log sequence number BACKUP AUXILIARY ? BACKUP ARCHIVELOG <ALL | . tablespace. 7) BACKUP AS BACKUPSET In the first RMAN places datafiles 3 through 7 into one backup set and datafiles 8 and 9 into .. TBD BACKUP AS BACKUPSET DEVICE TYPE <device_identifier> COPIES <integer> DATABASE FORMAT '<location_and_format>' . BACKUP <BackupOperand> CHANNEL '<channel_id>' CHECK LOGICAL COPIES <integer> CUMULATIVE DEVICE TYPE <deviceSpecifier> DISKRATIO <integer> DURATION <FileNameConversionSpecification> FILERPERSET <integer> FORCE < AUXILIARY FORMAT <formatSpec. archived log.. datafile (current or copy).archived log.... control file (current or copy). BACKUP AS BACKUPSET (DATAFILE 3.> . or backup set. 5. 4. RMAN> BACKUP ARCHIVELOG ALL.. SPFILE.. BACKUP <BackupOperand> CHANNEL '<channel_id>' CHECK LOGICAL COPIES <integer> CUMULATIVE DEVICE TYPE <deviceSpecifier> DISKRATIO <integer> DURATION <FileNameConversionSpecification> FILERPERSET <integer> FORCE < AUXILIARY FORMAT <formatSpec..

5. BACKUP AS COPY TABLESPACE system.. 9. BACKUP BLOCKS ? BACKUP CHANNEL Manually allocate a channel. '/u02/db_%U'. tools. BACKUP AS COPY CURRENT CONTROLFILE. } .. Back up only logs without 2 backups on disk RUN { ALLOCATE CHANNEL d2 DEVICE TYPE DISK PARMS='ENV=(NSR_DATA_VOLUME_POOL=first_copy)'. users. undotbs. BACKUP AS BACKUPSET DATAFILE 3. BACKUP AS COPY BACKUP AS COPY <backup_specification> . 8. in order to specify that the backup run by this channel should go to both pools first_copy and second_copy. 7... TBD BACKUP CHANNEL '<channel_id>' ... 9). } BACKUP BLOCKS . ALLOCATE CHANNEL d1 DEVICE TYPE DISK PARMS='ENV=(NSR_DATA_VOLUME_POOL=second_copy)'..another.. BACKUP AS COMPRESSED BACKUPSET Create two copies of a compressed backupset. (DATAFILE 8.. BACKUP AS COMPRESSED BACKUPSET DEVICE TYPE <device_identifier> COPIES <integer> DATABASE FORMAT '<location_and_format>' BACKUP AS COMPRESSED BACKUPSET DEVICE TYPE DISK COPIES 2 DATABASE FORMAT '/u01/db_%U'. ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT '/u02/%U'. 4. 6. Backing up as an image copy RUN { ALLOCATE CHANNEL dev1 DEVICE TYPE DISK FORMAT '/u01/%U'. In the second all datafiles go into a single backup set. BACKUP CHANNEL d2 ARCHIVELOG UNTIL TIME 'SYSDATE' NOT BACKED UP 2 TIMES TAG FIRST_COPY. BACKUP CHANNEL d1 ARCHIVELOG UNTIL TIME 'SYSDATE' NOT BACKED UP 2 TIMES TAG SECOND_COPY.

} BACKUP CONTROLFILECOPY BACKUP CONTROLFILECOPY ..7. BACKUP DATABASE PLUS ARCHIVELOG. ? BACKUP COPY ? BACKUP COPIES TBD BACKUP COPY . TBD BACKUP CURRENT CONTROLFILE [TO DESTINATION <destination_path>].. RUN { BACKUP CURRENT CONTROLFILE TO DESTINATION '/u01/backups'.....8 TO 1. BACKUP CHECK LOGICAL DATABASE. } RUN { ALLOCATE CHANNEL d1 DEVICE TYPE DISK.6. BACKUP CHECK [LOGICAL] <database_specifications> RUN { SET MAXCORRUPT FOR DATAFILE 5. BACKUP DATABASE. Define the number of backup copies to create RUN { BACKUP COPIES 2 DEVICE TYPE sbt BACKUPSET ALL. } RUN { ALLOCATE CHANNEL d1 DEVICE TYPE DISK...BACKUP CHECK SET MAXCORRUPT indicates that no more than 1 corruption should be tolerated in each datafile.... RMAN checks for both physical and logical corruption. } BACKUP CUMMULATIVE .. Because the CHECK LOGICAL option is specified on the BACKUP command. BACKUP CUMMULATIVE ? BACKUP CURRENT Backup the current Control File to the default or specified location BACKUP DATABASE Backup Database Backup Database Plus Archivelog . TBD BACKUP COPIES <integer> .

DELETE COPY TAG 'LATESTCOPY'. RMAN> { BACKUP DEVICE TYPE sbt DATAFILECOPY FROM TAG 'LATESTCOPY' FORMAT 'Datafile%f_Database%d'... BACKUP DATAFILE 1 FORMAT '/u01/backups/%U'. '/u02/backups/%U'. } BACKUP DATAFILECOPY ? BACKUP DATAFILECOPY .enable BACKUP DURATION <HH:MI> <backup_specification> .. backs them up to tape....} BACKUP DATAFILE Datafile backup to multiple locations BACKUP DATAFILE <integer> [FORMAT '<location_and_name_format>'] BACKUP DATAFILE <integer> [TO '<location>'] RUN { ALLOCATE CHANNEL d1 DEVICE TYPE DISK. } BACKUP DB_FILE_NAME_CONVERT ? BACKUP DB_RECOVERY_FILE_DEST ? BACKUP DEVICE TYPE RMAN locates all datafile copies with the tag LATESTCOPY.disable RMAN> BACKUP DISKRATIO 5.. -.. and names the backups by means of substitution variables. BACKUP DATAFILE 6 TO '/u01/backups'. TBD BACKUP DB_RECOVERY_FILE_DEST . '/u02/backups'. After the datafile copies are on tape. BACKUP DISKRATIO Populate each backup set with datafiles from the specified number of disks. -. TBD BACKUP DB_FILE_NAME_CONVERT ... BACKUP DURATION Backup will stop if it is RMAN> BACKUP DISKRATIO 0. To disable set to 0. the example deletes all image copies with the tag LATESTCOPY. TBD BACKUP DEVICE TYPE <DISK | SBT> ...

TBD BACKUP FILESPERSET .... TBD BACKUP .. RMAN > BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_upd' DATABASE FORMAT '/oradata/rman/161932/inc_%d_%T_%t_%s_%p'.. . BACKUP FROM . Maintain a 7 day window.... This command will give me a level 1 backup to be used to recover level 0 backup to the latest level Alters the RECOVER COPY... WITH TAG to perform incomplete recovery of the datafile copies to the point in time in the past where you want your window of recoverability to begin.not completed in the specified duration [MINIMIZE <LOAD | TIME>] BACKUP DURATION <HH:MI> <backup_specification> PARTIAL RMAN> BACKUP DURATION 3:30 DATABASE... BACKUP FILE ? BACKUP FILE . RUN { RECOVER COPY OF DATABASE WITH TAG 'incr_update' UNTIL TIME 'SYSDATE-7'.. BACKUP FORCE Forces RMAN to ignore backup optimization even if CONFIGURE BACKUP OPTIMIZATION is ON BACKUP FORMAT BACKUP FORCE <backup_specification> RMAN> BACKUP FORCE DATABASE..... } BACKUP FILESPERSET ? BACKUP . FOR RECOVER OF . FOR RECOVER OF COPY WITH TAG ..... TBD BACKUP FULL RMAN> BACKUP FULL. Specify Backup Format BACKUP FROM ? BACKUP FULL Creates a backup of all blocks of datafiles included in the backup RMAN> BACKUP FORMAT = 'UW_%d/%t/%s/%p' ARCHIVELOG LIKE '%arc_dest%'... BACKUP FORMAT <format_specification> . BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_upd' DATABASE.

. BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE..... BACKUP INCREMENTAL LEVEL 0 DATABASE. TBD BACKUP MAXSETSIZE .BACKUP INCREMENTAL Incremental Backup Level 0 Incremental Backup Level 1 Run to back up blocks that have changed since most recent level 0 or 1 BACKUP INCREMENTAL LEVEL <level_number> [CUMULATIVE | DIFFERENTIAL> . TBD BACKUP NOT .. TBD BACKUP NOEXCLUDE . RMAN> ALTER DATABASE OPEN. RMAN> STARTUP MOUNT. TBD BACKUP NOKEEP ..... TBD BACKUP NOCHECKSUM .... Copies two datafiles and exempts them from the retention policy forever BACKUP KEEP ? BACKUP KEEP . RMAN> BACKUP KEEP FOREVER FORMAT '?/dbs/%U_longterm. BACKUP KEEP <FOREVER | UNTIL TIME 'date_string' [RESTORE POINT <restore_point_name>] RMAN> SHUTDOWN IMMEDIATE.... BACKUP INCREMENTAL LEVEL 1 CUMULATIVE SKIP INACCESSIBLE DATABASE.... BACKUP INCREMENTAL LEVEL 1 DIFFERENTIAL TABLESPACE users.cpy' TAG LNGTRM_BCK DATAFILE 5 DATAFILE 6.. TBD BACKUP MAXSETSIZE ? BACKUP NOCHECKSUM ? BACKUP NOEXCLUDE ? BACKUP NOKEEP ? BACKUP NOT ? BACKUP PROXY ..

. BACKUP TABLESPACE .. ? BACKUP SETSIZE ? TBD BACKUP SETSIZE ..... TBD BACKUP POOL . TBD BACKUP SKIP READONLY ... TBD BACKUP SPFILE [TO DESTINATION <destination_path>] RMAN> BACKUP SPFILE TO DESTINATION '/u01/backups'... TBD BACKUP REUSE .. TBD BACKUP TO ... BACKUP SKIP READONLY ? BACKUP SPFILE Backup the Server Parameter file to the default or specified location BACKUP TAG Backup the database and apply a user specified tag BACKUP TABLESPACE ? BACKUP TO ? BACKUP VALIDATE ? ...... BACKUP TAG '<tag_name>' ...... TBD BACKUP VALIDATE .? BACKUP POOL ? BACKUP RECOVERY ? BACKUP REUSE ? BACKUP SECTION BACKUP PROXY . RMAN> BACKUP TAG 'weekly_full_db_bkup' DATABASE MAXSETSIZE 10M...... TBD BACKUP RECOVERY ...... TBD BACKUP SECTION .

. block corruption is reported in error messages in trace files.. TBD BLOCKRECOVER COPY ... TBD BLOCKRECOVER AUXILIARY . TBD BLOCKRECOVER ARCHIVELOG ....TBD BLOCKRECOVER Block media recovery recovers an individual data block or set of data blocks within a datafile. TBD BLOCKRECOVER DATABASE .. TBD BLOCKRECOVER CLEAR . TBD BLOCKRECOVER CORRUPTION . TBD BLOCKRECOVER ARCHIVELOG ? BLOCKRECOVER AUXILIARY ? BLOCKRECOVER CHECK ? BLOCKRECOVER CLEAR ? BLOCKRECOVER COPY ? BLOCKRECOVER CORRUPTION ? BLOCKRECOVER DATABASE ? BLOCKRECOVER DATAFILE .... This type of recovery is useful if the data loss or corruption applies to a small number of blocks rather than to an entire datafile... Typically. TBD BLOCKRECOVER CHECK ........ Block-level data loss usually results from:   I/O errors causing minor data loss Memory corruptions that get flushed to disk BLOCKRECOVER ALLOW ? BLOCKRECOVER ALLOW .....

. TBD BLOCKRECOVER FROM ...5 TABLESPACE sales DBA 4194405.... RMAN> BLOCKRECOVER DATAFILE 2 BLOCK 12..... 4194409.4. BLOCKRECOVER DELETE ? BLOCKRECOVER DEVICE ? BLOCKRECOVER EXCLUDE ? BLOCKRECOVER FROM ? BLOCKRECOVER NOFILE UPDATE ? BLOCKRECOVER NOPARALLEL ? BLOCKRECOVER NOREDO ? .Recover corrupt blocks in 3 data files BLOCKRECOVER DATAFILE <data_file_number> BLOCK <block_list> RMAN> BLOCKRECOVER DATAFILE 2 BLOCK 12.99 DATAFILE 4 BLOCK 19.. TBD BLOCKRECOVER DEVICE .. Limit block recovery by restoration type BLOCKRECOVER DATAFILE <data_file_number> BLOCK <block_list> TABLESPACE <tablespace_name> FROM DATAFILECOPY RUN { BLOCKRECOVER DATAFILE 3 BLOCK 2.3.. 4194412 FROM DATAFILECOPY...13 DATAFILE 3 BLOCK 5. TBD BLOCKRECOVER NOREDO .13... } BLOCKRECOVER DATAFILECOPY ? BLOCKRECOVER DATAFILECOPY ... TBD BLOCKRECOVER DELETE ...... TBD BLOCKRECOVER NOFILE UPDATE .98. TBD BLOCKRECOVER EXCLUDE . TBD BLOCKRECOVER NOPARALLEL .

... TBD BLOCKRECOVER SKIP READONLY .. BLOCKRECOVER CORRUPTION LIST Limit block recovery by time Repair all corrupt blocks in the database using gv$database_block_c orruption BACKUP VALIDATE DATABASE........ BLOCKRECOVER PREVIEW ? BLOCKRECOVER RESTORE ? TBD BLOCKRECOVER SAVE . 4194405 FROM TAG "weekly_backup".. BLOCKRECOVER CORRUPTION LIST.. BLOCKRECOVER SAVE ? BLOCKRECOVER SKIP READONLY ? BLOCKRECOVER SAVE ? BLOCKRECOVER TABLESPACE Limit block recovery by backup tag BLOCKRECOVER TABLESPACE SYSTEM DBA 4194404.. 4194405 RESTORE UNTIL TIME 'SYSDATE-2'.... BLOCKRECOVER TABLESPACE SYSTEM DBA 4194404.. TBD BLOCKRECOVER PREVIEW ... TBD BLOCKRECOVER RESTORE ... TBD BLOCKRECOVER TABLESPACE <tablespace_name> .TBD BLOCKRECOVER PARALLEL ? BLOCKRECOVER PARALLEL .. BLOCKRECOVER TABLESPACE <tablespace_name> .. TBD BLOCKRECOVER UNDO ? . TBD BLOCKRECOVER SAVE . BLOCKRECOVER TEST ? BLOCKRECOVER TEST ..... TBD BLOCKRECOVER UNDO .

.dbf'.BLOCKRECOVER VALIDATE ? BLOCKRECOVER VALIDATE ...ctl' CATALOG DATAFILECOPY Specifies that the datafile copy should be recorded as a level 0 incremental backup (0 is the only valid value of LEVEL) DATAFILECOPY <file_name_list> LEVEL <integer> RMAN> CATALOG DATAFILECOPY '/stage/users01. TBD CATALOG Adds information about file copies and user-managed backups to the repository CATALOG ARCHIVELOG Back the named archive log CATALOG BACKUP Catalogs the backups specified CATALOG ARCHIVELOG '<file_name_list>' RMAN> CATALOG ARCHIVELOG ' CATALOG BACKUP ... CATALOG CLONE .. RMAN> CATALOG BACKUP . TBD CATALOG CONTROLFILECOPY <controlfilecopy_name_list> CATALOG CLONE ? CATALOG CONTROLFILECOPY Catalog the control files identified RMAN> COPY CURRENT CONTROLFILE TO '/stage'.. USING target database control file instead of recovery catalog cataloged backup piece backup piece handle=/u01/c-874220581-20080315-01 RECID=8 STAMP=607695990. CATALOG DB_RECOVERY_FILE_DEST . RMAN> LIST COPY.. RMAN> CATALOG DATAFILECOPY '/u02/backup/users01.bak' LEVEL 0. CATALOG BACKUPPIECE <file_name_list> CATALOG BACKUPPIECE Catalogs the backup pieces in the new location RMAN> CATALOG BACKUPPIECE '/u01/c-87422058120080315-01'.. RMAN> CATALOG CONTROLFILECOPY '/stage/control01.

To alter the repository status of usable backups and copies from prior incarnations. CHANGE ARCHIVELOG ALL UNCATALOG. .. or you do not want a specific backup or copy to be eligible to be restored but also do not want to delete it. copies. uncatalog them.. CHANGE BACKUP OF ARCHIVELOG ALL NOKEEP.    CHANGE ARCHIVELOG CHANGE ARCHIVELOG . CATALOG START WITH <path_name> [NOPROMPT] CATALOG RECOVERY Catalog all files in the currently enabled flash recovery area CATALOG START Catalog all files in a named disk location RMAN> CATALOG START WITH '/u02/archivelog' NOPROMPT. Move all archived logs to a new directory.. To specify that a backup or copy should either abide by the currently configured retention policy or be exempt from it.. and then recatalog them in the new location CHANGE BACKUP HOST 'mv $ORACLE_HOME/oradata/trgt/arch/* /fs2/arch'. To remove catalog records for backups and copies. ? TBD CATALOG RECOVERY AREA RMAN> CATALOG RECOVERY AREA.. CATALOG DEVICE . CATALOG START WITH '/fs2/arch'.. Change the status of all backups of server parameter files created more than a day ago to CHANGE BACKUP OF SPFILE COMPLETED BEFORE 'SYSDATE1' UNAVAILABLE. and archived logs in the repository to AVAILABLE or UNAVAILABLE. CHANGE To make the following changes:  To change the status of backups. CHANGE BACKUP . This feature is useful when a previously unavailable file is made available again. This feature is useful when you remove a file by using an operating system command rather than the RMAN CHANGE command. and want to remove its repository record as well.Catalog the Backup Pieces held in the location set by DB_RECOVERY_FIL E_DEST CATALOG DEVICE CATALOG DB_RECOVERY_FILE_DEST RMAN> CATALOG DB_RECOVERY_FILE_DEST. and update the corresponding records in the target control file to status DELETED.

. CHANGE BACKUPSET 42 UNAVAILABLE. RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE . RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK. TBD CHANGE CHANGEFAILURE ? CHANGE CONTROLFILECOPY ? CHANGE COPY ? CHANGE DATAFILECOPY ? CHANGE DB_UNIQUE_NAME_FROM ? CONFIGURE To configure persistent settings affecting RMAN backup.. CHANGE CHANGEFAILURE . TBD CHANGE COPY . TBD CHANGE CONTROLFILECOPY .. CHANGE BACKUP TAG 'consistent_db_bkup' KEEP FOREVER NOLOGS. TBD CHANGE DATAFILECOPY . restore.. RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'. These configurations are in effect for any RMAN session until the configuration is cleared or changed.. TBD CHANGE DB_UNIQUE_NAME_FROM . RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF. RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1.. duplication. RMAN> CONFIGURE BACKUP OPTIMIZATION OFF.... RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO NONE. CHANGE BACKUPSET . $ rman Configuration Defaults RMAN> SHOW ALL RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1..UNAVAILABLE CHANGE BACKUPSET Change the status a backup set Change an ordinary backup into a longterm backup CHANGE BACKUPSET ... and maintenance jobs...

RMAN> CONFIGURE RMAN> CONFIGURE RMAN> CONFIGURE RMAN> CONFIGURE RMAN> CONFIGURE ENCRYPTION FOR DATABASE OFF.. RMAN> CONFIGURE CLONENAME CONFIGURE COMPATIBLE . RMAN> CONFIGURE AUXILARY CONFIGURE AUXNAME FOR DATAFILE <data_file_number> TO <path_and_file_name> CONFIGURE AUXNAME FOR DATAFILE CLEAR RMAN> CONFIGURE AUXNAME FOR DATAFILE 5 TO '/home/oracle/auxfiles/aux1. RMAN> CONFIGURE COMPRESSION ALGORITHM 'ZLIB'..f'.TO BACKUPSET. CONFIGURE AUXILIARY ? CONFIGURE AUXILIARY CHANNEL <DEVICE. ? CONFIGURE COMPATIBLE ? CONFIGURE COMPRESSION Configure a backup compression algorithm CONFIGURE CONTROLFILE Enable autobackup and configure the default autobackup format for a DISK device CONFIGURE CONTROLFILE AUTOBACKUP CONFIGURE CONTROLFILE AUTOBACKUP ON. algorithm_description FROM v$rman_compression_algorithm. RMAN> CONFIGURE COMPATIBLE CONFIGURE COMPRESSION ALGORITHM <CLEAR | '<quoted_string>'> SELECT algorithm_name. SNAPSHOT CONTROLFILE NAME TO '/app/oracle/product/flash_recovery_area/snapshot. CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE . ENCRYPTION ALGORITHM 'AES128'....ctl'... RMAN> CONFIGURE AUXNAME FOR DATAFILE 4 CLEAR. CONFIGURE AUXNAME Set and clear an auxiliary name for a datafile CONFIGURE CHANNEL ? CONFIGURE CHANNEL <DEVICE TYPE | INTEGER> <configuration | CLEAR> RMAN> CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' CLEAR... CONFIGURE CLONENAME . INTEGER> . RETENTION POLICY TO REDUNDANCY 1. MAXSETSIZE TO 2 G.

RMAN> CONFIGURE ENCRYPTION CLEAR. CONFIGURE DB_UNIQUE_NAME ? CONFIGURE DB_UNIQUE_NAME '<db_unique_name>' <CLEAR | CONNECT IDENTIFIER '<quoted_string>'> TBD CONFIGURE ENCRYPTION ALGORITHM <CLEAR | encryption_algorithm> SQL> col algorithm_name format a20 SQL> col algorithm_description format a25 SQL> SELECT algorithm_name.. auxiliary. CONFIGURE ENCRYPTION FOR <DATABASE | TABLESPACE <tablespace_name>> <ON | OFF | CLEAR> Set and clear encryption Configure Database or Tablespace Encryption RMAN> CONFIGURE ENCRYPTION FOR DATABASE ON.TYPE DISK TO '/u02/%F'. algorithm_description FROM v$rman_encryption_algorithms. ? CONFIGURE EXCLUDE . or recovery catalog database Auxiliary CONNECT AUXILIARY <user_id>/<password>@<instance> $ rman auxiliary oracle/oracle1@prodb CONNECT $ rman catalog repoomega/oracle1@repos $ rman RMAN> connect catalog repoomega/oracle1@repos CONNECT TARGET <user_id>/<password>@<instance> Catalog Target only $ rman target / $ rman> RMAN> connect target / catalog . TBD CONNECT Creates a connection between RMAN and a target. RMAN> CONFIGURE ENCRYPTION FOR TABLESPACE uwdata OFF.. RMAN> CONFIGURE ENCRYPTION ALGORITHM 'AES256'.

'/stage/dbfiles'. '/tmp/transport_from_solaris/hr'. CONVERT TABLESPACE . '/tmp/transport_from_aix/u03/users02.'/stage/oradata'. tablespace or database to the format of a destination platform.repoomega/oracle1@repos CONNECT Target and Catalog $ rman target / catalog repoomega/oracle1@repos $ rman> RMAN> connect target / catalog repoomega/oracle1@repos CONNECT Target without a catalog $ rman RMAN> connect target omega1/omega1@emrep NOCATALOG CONVERT Converts a datafile. CONVERT DATAFILE Converts the datafiles to be transported to the destination host format and deposits the results in /u02/oradata CONVERT DATAFILE <datafile_name_list> DB_FILE_NAME_CONVERT '<source_location> <destination_location>' FROM PLATFORM <original_platform_name> CONVERT DATAFILE '/tmp/transport_from_aix/u01/uwdata01.dbf'. '/tmp/transport_from_aix/u01/uwdata02.dbf' DB_FILE_NAME_CONVERT '/app/oracle/product/oradata'. in preparation for transport across different platforms CONVERT DATABASE Uses CONVERT DATABASE NEW DATABASE to convert datafiles and generate a transport script CONVERT DATABASE NEW DATABASE '<db_name>' TRANSPORT SCRIPT '<script_location>' TO PLATFORM '<platform_name>' DB_FILE_NAME_CONVERT '<source_location> <destination_location>' CONVERT DATABASE NEW DATABASE 'prodb' TRANSPORT SCRIPT '/tmp/convertdb/transportscript' TO PLATFORM 'Linux IA (64-bit)' DB_FILE_NAME_CONVERT '/u01/oradata'.dbf'.dbf'.'/stage/oradata' FROM PLATFORM 'Linux IA (64-bit)'. '/tmp/transport_from_aix/u03/users01.

RMAN> COPY DATAFILE COPY DATAFILECOPY ...... RMAN> COPY DATAFILECOPY COPY KEEP .. nochecksum. users TO PLATFORM 'Linux IA (64-bit)' FORMAT '/app/oracle/product/flash_recovery_area/linux64/% U'... endian_format FROM v$transportable_platform. SQL> conn repoomega/oracle1@repos ... RMAN> COPY KEEP ? ? ? ? ? ? ? CREATE CREATE CATALOG CREATE [VIRTUAL] CATALOG. RMAN> COPY BACKUP COPY CHECK . RMAN> COPY CURRENT COPY DATAFILE . (level. nokeep. Create a recovery catalog or a virtual private catalog RMAN> CREATE CATALOG... CONVERT TABLESPACE uwdata.. COPY ? COPY ARCHIVELOG .. RMAN> COPY CHECK COPY CONTROLFILECOPY .Convert a tablespaces to 64 bit Linux CONVERT TABLESPACE <tablespace_name_list> TO PLATFORM <platform_name> FORMAT '<format_string>' desc v$transportable_platform SELECT platform_name. reuse. RMAN> COPY CONTROLFILECOPY COPY CURRENT . tag) RMAN> COPY ARCHIVELOG COPY BACKUP ...

The following objects can be crosschecked: . } Creates a stored script called backup_whole that backs up the database and archived redo logs CROSSCHECK Verify the status of backups and copies recorded in the RMAN repository against media such as disk or tape. Object is not available for use by RMAN.SQL> SELECT object_type. CREATE RESTORE POINT CREATE RESTORE POINT <restore_point_name> Create a restore point CREATE SCRIPT Creates a stored script called backup_whole that backs up the database and archived redo logs RMAN> CREATE RESTORE POINT app_patch. Object is not found either in file system (for DISK) or in the media manager (for sbt). with logs" { BACKUP DATABASE PLUS ARCHIVELOG. COUNT(*) FROM user_objects. Status AVAILABLE EXPIRED UNAVAILABLE Description The Object is available for use by RMAN. For a backup set to be AVAILABLE. SQL> SELECT object_type. all backup pieces must be UNAVAILABLE. For a backup set to be UNAVAILABLE. RMAN> DROP RESTORE POINT app_patch. COUNT(*) FROM user_objects. all backup pieces in the set must be EXPIRED. } CREATE GLOBAL SCRIPT global_backup_db COMMENT "backup any database from the recovery catalog. The CROSSCHECK command only processes files created on the same device type as the channels running the crosscheck. CREATE [GLOBAL] SCRIPT '<script_name>' COMMENT '<comment>' {RMAN_command_list} FROM FILE '<file_name>' CREATE SCRIPT backup_whole COMMENT "backup whole database and logs" { BACKUP INCREMENTAL LEVEL 0 TAG b_whole_l0 DATABASE PLUS ARCHIVELOG. all set backup pieces must be AVAILABLE. RMAN> DROP CATALOG. Note that for a backup set to be EXPIRED. EXPIRED does not mean the same as OBSOLETE.

..S TATUS of affected archivelogs from "A" for AVAILABLE to "X" for EXPIRED.. RMAN> CROSSCHECK BACKUPPIECE CROSSCHECK BACKUPSET OF <backupset identifier>. crosscheck backups in a date range and release the channel after use RMAN> RUN { ALLOCATE CHANNEL d1 FOR MAINTENANCE DEVICE TYPE DISK. } CROSSCHECK BACKUP . CROSSCHECK COPY . CROSSCHECK ARCHIVELOG ALL. RMAN> CROSSCHECK CONTROLFILECOPY . RMAN> CROSSCHECK BACKUPSET OF TABLESPACE UWDATA. RELEASE CHANNEL.. RMAN will no longer attempt to backup this archivelog file.. Checks that specific controlfile copies still exist RMAN> CROSSCHECK COPY OF ARCHIVELOG ALL.. CROSSCHECK BACKUP Allocate a channel.. CROSSCHECK BACKUPPIECE Checks that specific backuppieces still exist CROSSCHECK BACKUPSET Checks that specific backupsets still exist CROSSCHECK COPY Checks for the physical existence of archivelog files and will change the V$ARCHIVED_LOG.. CROSSCHECK CONTROLFILECOPY CROSSCHECK CONTROLFILECOPY .ARCHIVELO BACKU BACKUPPIEC BACKUPSE CONTROLFILECO COP DATAFILECOP PROX G P E T PY Y Y Y CROSSCHECK ARCHIVELOG CROSSCHECK <archivelogRecordSpecifier> Allocate a channel and crosscheck all archivelogs RMAN> RUN { ALLOCATE CHANNEL d1 FOR MAINTENANCE DEVICE TYPE DISK. } CROSSCHECK BACKUPPIECE . CROSSCHECK BACKUP DEVICE TYPE DISK COMPLETED BETWEEN '01-JUL-08' AND '30-SEP-08'.. RELEASE CHANNEL.. Once the archivelog file has a status of X..

CROSSCHECK PROXY *RMAN> CROSSCHECK PROXY 941. RMAN> CROSSCHECK FOREIGN ARCHIVELOG ALL. CROSSCHECK FOREIGN Crosscheck all foreign archived redo logs CROSSCHECK PROXY Crosscheck the existence of a specific proxy copy DEBUG DEBUG <AFFINITY | ALL | DUPLICATE | IO | KRB | MISC | NODEVALS | OFF | ON | PACKAGES | PLSQL | RCVCAT | RCVMAN | RECOVER | RESTORE | RESYNC | RPC | SQL> *RMAN> DEBUG ALL. DELETE ARCHIVELOG DELETE ARCHIVELOG <ALL | FROM | HIGH | LIKE | LOGSEQ | LOW | QUOTED_STRING | SCN | SEQUENCE | TIME | UNTIL> . .. CROSSCHECK FOREIGN ARCHIVELOG <ALL | FROM | HIGH | LOGSEQ | LOW | SCN | SEQUENCE | TIME | UNTIL> . DELETE To delete physical backups and copies as well as do the following:   Update their repository records in the target control file to status DELETED Remove their repository records from the recovery catalog (if you use a catalog) Commands for the RMAN debugger When running RMAN interactively. RMAN> CROSSCHECK ARCHIVELOG LIKE '%'. DELETE displays a list of the files and prompts you for confirmation before deleting any file in the list. Wildcard Delete RMAN> LIST ARCHIVELOG LIKE '%'... RMAN will not prompt for confirmation. *RMAN> DEBUG OFF.. ? DELETE BACKUPSET Delete Backup Set *DELETE NOPROMPT BACKUP OF DATABASE COMPLETED BEFORE 'SYSDATE-7'..CROSSCHECK DATAFILECOPY Checks that specific bdatafile copies still exist CROSSCHECK DATAFILECOPY <ALL | INTEGER | LIKE | QUOTED_STRING> RMAN> CROSSCHECK DATAFILECOPY ALL. When reading commands from a command file. RMAN> DELETE ARCHIVELOG LIKE '%'..

RMAN> DELETE FORCE OBSOLETE.? Delete both Disk and Tape Backup Sets # back up datafile to disk and tape BACKUP DEVICE TYPE DISK DATAFILE 1 TAG "weekly_bkup". . DELETE EXPIRED Deletes expired backup records DELETE [FORCE | NOPROMPT] EXPIRED <maintenance_spec> [for db_unique_name_option]. ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE SBT. No demo is shown as this is something I would strongly recommend against doing within RMAN. BACKUP DEVICE TYPE sbt DATAFILE 1 TAG "weekly_bkup". *See CREATE CATALOG Demo Above DROP DATABASE. # manually allocate disk and sbt channels ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK. DELETE [GLOBAL] SCRIPT '<script_name>' Deletes a stored script b_whole_10 from the recovery catalog rman TARGET / CATALOG rman/cat@catdb RMAN> DELETE SCRIPT b_whole_10. Drop DROP CATALOG Drop the RMAN catalog DROP DATABASE Use RMAN to issue the drop database command DROP CATALOG. DELETE OBSOLETE Delete Obsolete DELETE SCRIPT DELETE [FORCE | NOPROMPT] OBSOLETE [obsOperandList] [device_type] [device_specifier]. RMAN> DELETE GLOBAL SCRIPT b_whole_10. RMAN> CROSSCHECK BACKUPSET OF TABLESPACE uwdata DEVICE TYPE disk COMPLETED BEFORE SYSDATE-15. RMAN> CROSSCHECK BACKUP. DELETE BACKUPSET TAG "weekly_bkup". RMAN> DELETE EXPIRED BACKUP. RMAN> DELETE NOPROMPT EXPIRED BACKUPSET OF TABLESPACE uwdata DEVICE TYPE disk COMPLETED BEFORE SYSDATE-15.

TYPE DISK.log' SIZE '?/oradata/aux1/redo03. } TYPE DISK.DROP RESTORE POINT Drop a restore point DROP RESTORE POINT <restore_point_name> *See CREATE RESTORE POINT Demo Above DUPLICATE Allocates axiliary channels and duplicates the target database as newdb DUPLICATE [TARGET] DATABASE TO <new_name> LOGFILE '<redo_log_file_path_and_name>' SIZE <integer> <K | M> [SKIP READONLY] [NOFILENAMECHECK] RUN { ALLOCATE AUXILIARY CHANNEL d1 DEVICE ALLOCATE AUXILIARY CHANNEL d2 DEVICE DUPLICATE TARGET DATABASE TO newdb LOGFILE '?/oradata/aux1/redo01. RMAN> FLASHBACK DATABASE Returns the database to its state at a previous time or SCN FLASHBACK DATABASE TO SCN=<integer> *RMAN> FLASHBACK DATABASE TO SCN=42678315. 50M. or RMAN> HOST. 50M. GRANT GRANT <privilege> TO <schema_name> Grant privileges to a recovery catalog user *RMAN> GRANT CATALOG FOR DATABASE orabase TO repoomega.log' SIZE SKIP READONLY NOFILENAMECHECK. . 50M EXIT EXIT Exit from RMAN or a terminal window RMAN> target / *RMAN> EXIT.log' SIZE '?/oradata/aux1/redo02. *$ EXIT.

ts#=ts.ts# group by b.file#=b. v$datafile f where b. v$tablespace ts.checkpoint_time order by 1. select distinct to_char((b. was kind enough to send in this useful bit of code that will give you a list of the most recent Level 0 backups. *RMAN> LIST COPY.file# and f. *RMAN> LIST DB_UNIQUE_NAME ALL. *RMAN> LIST ARCHIVELOG ALL. PRINT SCRIPT .CHECKPOINT_TIME). HOST Shell out of RMAN to the operating system for command execution HOST *See EXIT Demo Above IMPORT IMPORT CATALOG Imports the metadata from one recovery catalog into a different recovery catalog IMPORT RCVCAT ? ? ? ? ? LIST Produce a detailed listing of the indicated items LIST <ARCHIVELOG | COPY | DB_UNIQUE_NAME | FAILURE> ALL.incremental_level = 0 and INCLUDED_IN_DATABASE_BACKUP='YES' and f.*RMAN> GRANT REGISTER DATABASE TO repoomega. *For LIST FAILURE See Advise Failure Demo Above List the most recent Level 0 backups Lisa T. 'YYYY-MM-DD HH:MI.SS') t from v$backup_datafile b.

in order to update them to a specified time RECOVER TBD REGISTER DATABASE Register a Target in the Database Recovery Catalog REGISTER DATABASE *RMAN> REGISTER DATABASE.Display a stored script PRINT <IDENTIFIER | QUOTED_STRING> See CREATE SCRIPT Demos Above PURGE ? PURGE See "CREATE SCRIPT" Demos Above QUIT Exit the RMAN executable QUIT *RMAN> QUIT. RELEASE CHANNEL Release a channel that was allocated with an ALLOCATE CHANNEL command or ALLOCATE CHANNEL FOR MAINTENANCE command RELEASE CHANNEL See ? Demo Above REPAIR FAILURE Repair one or more failures recorded in the automated diagnostic repository REPAIR FAILURE [<NO | NOPROMPT | PREVIEW | USING> *See Advise Failure Demo Above . RECOVER Apply redo logs and incremental backups to datafiles or data blocks restored from backup or datafile copies.

RMAN> LIST INCARNATION OF DATABASE orabase. then REPLACE SCRIPT creates it REPLACE SCRIPT TBD REPORT Perform detailed analyses on recovery catalog metadata REPORT RMAN> REPORT SCHEMA. RMAN> RECOVER DATABASE UNTIL SCN 4208974.REPLACE SCRIPT Replace an existing script stored in the recovery catalog. RMAN> validate backupset 1. RMAN> RESTORE DATABASE UNTIL SCN 4208974. SQL> COMMIT. . RMAN> restore database. RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP. RMAN> LIST INCARNATION OF DATABASE orabase. $ rman target / nocatalog RMAN> STARTUP NOMOUNT. RESTORE RESTORE Restore files from backup sets or from disk copies to the default or a new location RMAN> target / catalog rman/rman@rman RMAN> backup database. If the script does not exist. RMAN> ALTER DATABASE MOUNT. RMAN> ALTER DATABASE OPEN RESETLOGS. RESET DATABASE Reset the incarnation of the target database in the RMAN repository to a previous database incarnation RESET DATABASE TO INCARNATION <incarnation_identifier>. SQL> conn scott/tiger SQL> DELETE FROM emp WHERE rownum < 6. RMAN> RESET DATABASE TO INCARNATION 1.

*RMAN> RESYNC CATALOG. then open the database After adding a datafile to an existing tablespace RESYNC CATALOG FROM CONTROLFILECOPY '<file_name>' RESYNC FROM DB_UNIQUE_NAME ALL RESYNC FROM DB_UNIQUE_NAME '<db_unique_name>' $ rman target / RMAN> STARTUP FORCE MOUNT. which creates a snapshot control file and then copies any new or changed information from that snapshot control file to the recovery catalog. RMAN> ALTER DATABASE OPEN.RESYNC Perform a full resynchronization. RMAN> RESYNC CATALOG FROM CONTROLFILECOPY '/u01/cfile. This example performs a full resynchronization of the target database after archiving all unarchived redo logs Mount the target database. Revoke Revoke privileges from a recovery catalog user REVOKE TBD Run Execute a script of RMAN commands RUN { <script commands> } See "Allocate A Single Backup Channel" Demo Above Send Send a vendor-specific quoted string to one or more specific channels SEND CHANNEL Specify commands by CHANNEL SEND DEVICE_TYPE Specify a tape drive for a backup of the SEND CHANNEL '<channel_id>' '<command_string>' PARMS '<channel_params>' TBD SEND DEVICE_TYPE '<device_specifier>' '<command_string>' PARMS '<channel_params>' .dbf'. update the repository in the current control file with metadata from a backup control file.

CONFIGURE DATAFILE COPIES FOR DEVICE TYPE sbt TO 3. } RMAN> run { SET UNTIL TIME = "TO_DATE('03/15/08 10:42:07'.OB_DEVICE_2=stape2)'.'MM/DD/RR HH24:MI:SS')".users tablespace to Oracle Secure Backup RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt. Restore database and recover until the specified date and time . SEND 'OB_DEVICE stape1'. BACKUP DATABASE PLUS ARCHIVELOG. BACKUP TABLESPACE users. * SET BACKUP COPIES 2. } Set Set the value of various attributes that affect RMAN behavior for the duration of a RUN block or a session SET <OFF | ON> [FOR ALL TABLESPACES] ? TBD SET ARCHIVELOG DESTINATION TO '< SET BACKUP COPIES <integer> SET COMPRESSION ALGORITHM '<compression_algorithm_name>' SET DECRYPTION IDENTIFIED BY <password> SET ECHO <ON | OFF> SET ENCRYPTION ALGORITHM '<algorithm_name>' SET IDENTIFIED BY <password> [ONLY] SET MAXCORRUPT FOR DATAFILE <dataFileSpec> TO <integer> SET NEWNAME FOR DATAFILE <dataFileSpec> TO '<file_name>' SET NEWNAME FOR DATAFILE <dataFileSpec> TO NEW SET NEWNAME FOR TEMPFILE <tempFileSpec> TO '<quoted_string>' SET NEWNAME FOR TEMPFILE <tempFileSpec> TO NEW SET TO RESTORE POINT <restore_point_name> SET UNTIL <TIME | SCN> CONFIGURE ARCHIVELOG COPIES FOR DEVICE TYPE sbt TO 3. RMAN> run { ALLOCATE CHANNEL dev1 DEVICE TYPE sbt PARMS 'ENV=(OB_DEVICE_1=stape1.

SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT'. } RMAN> SET DBID 3257174182. ALLOCATE CHANNEL d2 DEVICE TYPE DISK FORMAT '/u02/%U'. RMAN> STARTUP FORCE NOMOUNT. BACKUP INCREMENTAL LEVEL 0 DATABASE. RMAN> RUN { ALLOCATE CHANNEL t1 DEVICE TYPE sbt. RESTORE CONTROLFILE FROM AUTOBACKUP MAXSEQ 100. RECOVER DATABASE. RECOVER DATABASE. RESTORE SPFILE FROM AUTOBACKUP.bak'. RMAN> RUN { SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/cf_%F. SET COMMAND ID TO 'rman'. # RMAN restarts database with restored SPFILE $ rman target / RMAN> STARTUP FORCE NOMOUNT RMAN> SET DBID 28014364. } ? SET AUXILIARY INSTANCE PARAMETER FILE TO '<file_name> SET COMMAND ID TO '<string>' SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE <deviceSpecifier> TO <formatSpec> SET DBID <integer> RMAN> RUN { ALLOCATE CHANNEL d1 DEVICE TYPE DISK FORMAT '/u01/%U'. } STARTUP FORCE. } ALTER DATABASE MOUNT. .RESTORE DATABASE.

AUXNAME $ rman target / catalog repoomega1/oracle1@repos RMAN> show auxname. ENCRYPTION ALGORITHM $ rman target / catalog repoomega1/oracle1@repos RMAN> show encryption algorithm. Show ALL All $ rman target / catalog repoomega1/oracle1@repos RMAN> show all. EXCLUDE $ rman target / catalog repoomega1/oracle1@repos Auxname Backup Copies Backup Optimization Channel Control File AutoBackup Control File AutoBackup Format Database Encryption Device Type Encryption Algorithm Exclude . {DATAFILE | ARCHIVELOG} BACKUP COPIES $ rman target / catalog repoomega1/oracle1@repos RMAN> show datafile backup copies. ENCRYPTION FOR DATABASE $ rman target / catalog repoomega1/oracle1@repos RMAN> show encryption for database.ALTER DATABASE OPEN RESETLOGS. CONTROLFILE AUTOBACKUP FORMAT <format mask> $ rman target / catalog repoomega1/oracle1@repos RMAN> show controfile autobackup. BACKUP OPTIMIZATION $ rman target / catalog repoomega1/oracle1@repos RMAN> show backup optimization. [DEFAULT] DEVICE TYPE $ rman target / catalog repoomega1/oracle1@repos RMAN> show device type. CONTROLFILE AUTOBACKUP [FORMAT] $ rman target / catalog repoomega1/oracle1@repos RMAN> show controfile autobackup. RMAN> show archivelog backup copies. [AUXILIARY] CHANNEL [FOR DEVICE TYPE <deviceSpecifier>] $ rman target / catalog repoomega1/oracle1@repos RMAN> show channel.

Spool SPOOL LOG OFF Write RMAN output to a log file SPOOL LOG TO <file_name> [APPEND] CONFIGURE DEFAULT DEVICE TYPE TO sbt.log'. SQL SQL '<SQL_statement>' Execute a SQL statement from within RMAN RUN { SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT'.RMAN> show exclude. SHOW ALL. BACKUP DATABASE. SPOOL LOG OFF. SNAPSHOT CONTROLFILE NAME $ rman target / catalog repoomega1/oracle1@repos RMAN> SHOW SNAPSHOT CONTROLFILE NAME. Retention Policy Snapshot Control File Name Shutdown Shutdown the target database SHUTDOWN <ABORT | IMMEDIATE | NORMAL | TRANSACTIONAL> RMAN> SHUTDOWN ABORT. SPOOL LOG TO '/home/oracle/rman. RMAN> show retention policy to redundancy. SPOOL LOG OFF. } Startup STARTUP <DBA | FORCE | MOUNT | NOMOUNT> Startup a Database STARTUP PFILE '<file_name>' . RETENTION POLICY $ rman target / catalog repoomega1/oracle1@repos RMAN> show retention policy. SPOOL LOG TO '/tmp/current_config.log'. MAXSETSIZE Maximum Backup Set Size $ rman target / catalog repoomega1/oracle1@repos RMAN> show maxsetsize.

Switch Specify that a datafile copy is now the current datafile. then RESTORE the missing datafile. the datafile pointed to by the control file. SWITCH DATAFILE ALL RUN { ALLOCATE CHANNEL d1 DEVICE TYPE DISK. SWITCH TABLESPACE users TO COPY. . SET NEWNAME FOR DATAFILE '/u01/oradata/users01.$ rman TARGET / CATALOG repoomega/oracle1@repos RMAN> STARTUP MOUNT. Run SWITCH to point the control file to the new datafile and then RECOVER. RECOVER TABLESPACE users. RESTORE TABLESPACE uwclass. SQL "ALTER TABLESPACE users ONLINE". SQL "ALTER TABLESPACE uwdata OFFLINE IMMEDIATE". Assume all datafiles of the USERS tablespace are damaged but image copies exist in the FRA. SET NEWNAME to rename the datafile. } SWITCH TABLESPACE '<tablespace_name>' TO COPY SQL "ALTER TABLESPACE users OFFLINE IMMEDIATE". SQL "ALTER TABLESPACE uwclass ONLINE". Connecting to the TARGET. This command is equivalent to the SQL statement ALTER DATABASE RENAME FILE as it applies to datafiles Switch the controlfile to point to an ImageCopy of the data file SWITCH DATABASE TO COPY TBD SWITCH DATAFILE '<data_file_specification>' TO COPY TBD SWITCH DATAFILE '<data_file_specification>' TO DATAFILECOPY '<file_name>' TBD SWITCH DATAFILE '<data_file_specification>' TO DATAFILECOPY TAG '<tag_name>' TBD A disk fails.dbf' TO '/u02/oradata/users01. forcing a datafile restore to a new disk location. SWITCH DATAFILE ALL. Connect to the TARGET and use SWITCH to point the control file to the new datafiles then RECOVER. that is. RECOVER TABLESPACE uwclass.dbf'.

UNREGISTER DB_UNIQUE_NAME '<db_unique_name>' [INCLUDING BACKUPS [NOPROMPT]] RMAN> LIST DB_UNIQUE_NAME ALL. RMAN scans all of the backup pieces in the specified backup sets and looks at the checksums to verify that the contents can be successfully restored Validate archivelogs VALIDATE ARCHIVELOG VALIDATE ARCHIVELOG VALIDATE ARCHIVELOG VALIDATE ARCHIVELOG <integer> VALIDATE ARCHIVELOG VALIDATE ARCHIVELOG [THREAD <integer>] VALIDATE ARCHIVELOG <integer>] VALIDATE ARCHIVELOG ALL LIKE '<string_pattern>' FROM SCN <integer> BETWEEN SCN <integer> AND SCN UNTIL SCN <integer> FROM SEQUENCE <integer> SEQUENCE <integer> [THREAD SEQUENCE BETWEEN <integer> AND . RMAN> UNREGISTER DB_UNIQUE_NAME 'ORADATA'. Validate Examine a backup set and report whether its data is intact. Upgrade Catalog Upgrade the recovery catalog schema from an older version to the version required by RMAN UPGRADE CATALOG RMAN> UPGRADE CATALOG.SWITCH TEMPFILE <temp_file_specification> TO '<file_name>' TBD SWITCH TEMPFILE ALL TBD Transport Tablespace Create transportable tablespace sets from backup for one or more tablespaces TRANSPORT TABLESPACE TBD Unregister UNREGISTER DATABASE '<database_name>' [NOPROMPT] Unregister a Database from the Catalog RMAN> UNREGISTER DATABASE.

VALIDATE RECOVERY AREA RMAN> VALIDATE RECOVERY AREA. ? Validate the current control file Validate the complete database VALIDATE <blockObject> TBD VALIDATE CURRENT CONTROLFILE RMAN> VALIDATE CURRENT CONTROLFILE. VALIDATE SPFILE RMAN> VALIDATE SPFILE. VALIDATE DATAFILE '<file_name>' VALIDATE DATAFILE <file_number> Validate the identified datafile RMAN> VALIDATE DATAFILE 'C:\ORACLE\PRODUCT\ORADATA\ORABASE\UWDATA01'. VALIDATE DATABASE RMAN> VALIDATE DATABASE. COPY COPY COPY COPY OF OF OF OF DATABASE DATAFILE '<file_name>' DATAFILE <file_number> TABLESPACE '<tablespace_name>' Validate all control files copies VALIDATE Validate all database. RMAN> VALIDATE DATAFILE 9. VALIDATE DB_RECOVERY_FILE_DEST RMAN> VALIDATE DB_RECOVERY_FILE_DEST. ? VALIDATE BACKUPSET <primaryKey> TBD VALIDATE CONTROLFILECOPY ALL VALIDATE CONTROLFILECOPY '<file_name>' VALIDATE CONTROLFILECOPY LIKE '<string_pattern>' RMAN> VALIDATE CONTROLFILECOPY ALL.<integer> VALIDATE ARCHIVELOG UNTIL SEQUENCE <integer> [THREAD <integer>] TIME BETWEEN '<date_string>' AND '<date_string>' UNTIL TIME '<date_string>' RMAN> VALIDATE ARCHIVELOG ALL. or tablespace VALIDATE VALIDATE copies RMAN> VALIDATE COPY OF TABLESPACE 'UWDATA'. VALIDATE RECOVERY FILES RMAN> VALIDATE RECOVERY FILES. VALIDATE datafile. VALIDATE TABLESPACE <tablespace_name_list> Validate the recovery file destination Validate the recovery area Validate recovery the files Validate the server parameter file Validate the named .

%p. RMAN> DELETE OBSOLETE.0. RMAN> CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1.3/dbs/snapcf_pnbdb .1. RMAN> LIST BACKUP. # The following were default provided to PSOUG by RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR member Andrea DEVICE TYPE DISK Sparling TO '%F'. RMAN> LIST ARCHIVELOG ALL. RMAN Demos RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1.%c. RMAN> connect target / Incremental Level 0 Backup RMAN> BACKUP INCREMENTAL LEVEL 0 TAG full_backup FORMAT '/u03/backup/rman_fullbackup_%d_%t.backup'. RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET. # default RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF. RMAN> CONFIGURE BACKUP OPTIMIZATION OFF. RMAN> CONFIGURE MAXSETSIZE TO 2 G. RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO NONE. # default RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1.tablespace RMAN> VALIDATE TABLESPACE uwdata.%s. RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO Using a target database controlfile instead of recovery catalog '/u01/app/oracle/product/10.f'. RMAN> CROSSCHECK ARCHIVELOG ALL.bus' DATABASE. RMAN> CROSSCHECK BACKUP. RMAN> COPY CURRENT CONTROLFILE TO '/u03/backup/ctrlfile. RMAN> DELETE EXPIRED ARCHIVELOG ALL. Incremental #!/bin/sh ################################################## ### . # default RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK.

0.3. if multiple Oracle SID's the env var ORACLE_SID must be set .rcv >> $LOGFILE returncode=$? echo $returncode return code >> $LOGFILE df >> $LOGFILE echo "Ended " >> $LOGFILE date >> $LOGFILE if [ $returncode -ne 0 ]. export LD_LIBRARY_PATH=/u01/app/oracle/product/10./rman/logs directory age out in 14-30 days # get env IMPORTANT.0. oracle disk is u01) HEAD=/u03 WORK=$HEAD/backup/scripts cd $WORK # unique logfile DATE=`date +"%Y%m%d-%H%M%S"` LOGFILE='/u03/backup/rman/logs/rman_full_backup_'$ {DATE}'.edu -s"RMAN ERROR LOG for parnassus pnbdb backup" < $LOGFILE . # set relative head of directory (work disk is u03. /etc/bashrc export ORACLE_BASE=/u01/app/oracle.3/l ib:/lib:/usr/lib.1.log' echo "log: "${LOGFILE} > $LOGFILE echo "Started " >> $LOGFILE date >> $LOGFILE echo instance $ORACLE_SID >> $LOGFILE ################################################## ######################## ${ORACLE_HOME}/bin/rman @${WORK}/rman_full.# script to take a rman full backup # this script must be run # as the trusted user 'oracle10g' 'oracle9i' etc ################################################## ### # create output logs with that number and the current date in the .1.washington. export ORACLE_HOME=$ORACLE_BASE/product/10. export ORACLE_SID=pnbdb. then echo " email error log " >> $LOGFILE mail csds_opb@u.

SELECT * FROM v_$recovery_file_dest.ctl ls -la SQL> conn hr/hr (after unlocking account) SQL> desc jobs SQL> INSERT INTO jobs VALUES (987. Any backups not accessible from at least one of the nodes are marked EXPIRED after the crosscheck. CROSSCHECK BACKUP. RMAN Related Queries ? SELECT recovery_estimated_ios. target_redo_blks.washington.'TEST'. you perform a crosscheck of backups on two nodes of an Oracle Real Application Clusters configuration. actual_redo_blks. It is assumed here that all backups are accessible by at least one of the two nodes used in the crosscheck. RMAN on a RAC Cluster ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK CONNECT 'sys/oracle1@inst1'.mail amspar@u. target_mttr. SELECT COUNT(*) FROM dba_hist_instance_recovery. estimated_mttr FROM gv$instance_recovery. ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK CONNECT 'sys/oracle1@inst2'.also build a dummy table .edu -s"RMAN ERROR LOG for parnassus pnbdb backup" < $LOGFILE fi exit RAC Demo Crosschecking on Multiple Nodes of an Oracle Real Application Clusters Configuration: Example In this example. SQL> COMMIT. where each node has access to a subset of backups.log rm control02.1). -. cd /app/oracle/product/OracleHomes/oradata/orcl ls -la cd /app/oracle/product/OracleHomes/admin/orcl/bdump tail alert_orcl.0.

RESTORE DATABASE. restore controlfile.} tail the alert log -. RESTORE CONTROLFILE. ORA-00210: cannot open the specified control file ORA-00202: control file: '/app/oracle/product/OracleHomes/oradata/orcl/cont rol02.lets do a shutdown and restart SQL> shutdown immediate.now we have a problem SQL> shutdown abort. ls -la shows control files back rman done -.hadn't done a backup after last restore RMAN> run {startup force nomount. tail the alert log and we know what happened RUN { STARTUP FORCE NOMOUNT.ctl' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 -.look at /app/oracle/OracleHomes/oradata/orcl . alter database mount.log -.tail alert_orcl. SQL> shutdown immediate. -. RECOVER DATABASE. SQL> conn / as sysdba Connected. DATABASE MOUNT. } alter database open resetlogs.no one knows anything bad has happened SQL> select file_name from mgmt$db_controlfiles.

log -.the file is restored ls -la conn / as sysdba shutdown immediate. . This has a slight performance overhead.f�. SQL> alter system set db_block_checking = true scope=both. or I/O system problems. as less blocks will be backed up. Turn on block tracking when using RMAN backups (if running 10g or above) REASON: This will allow RMAN to backup only those blocks that have changed since the last full backup.1 1. tail alert_orcl.note error message SQL> startup ORACLE instance started.-. SQL> alter database enable block change tracking using file �/u01/oradata/ora1/change_tracking. Turn on block checking REASON: The aim is to detect. very early the presence of corrupt blocks in the database. Total System Global Area 440401920 bytes Fixed Size 1219880 bytes Variable Size 130024152 bytes Database Buffers 306184192 bytes Redo Buffers 2973696 bytes Database mounted. 2.next dumped controlfiles 1 and 3 shutdown immediate fails shutdown abort connect to RMAN Backup and Recovery Practices Best Practices Metalink Note: 388422. which will reduce the time taken to back up. storage system. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open SQL> startup mount. but Checksums allow Oracle to detect early corruption caused by underlying disk. startup -.

ensure that your controlfile record keep time instance parameter matches your retention policy. RMAN> backup check logical database plus archivelog delete input.log' to group 1. This is the best way to ensure that you will get a good backup. Have each datafile in a single backup piece REASON: When doing a partial restore RMAN must read through the entire piece to get the datafile/archivelog requested. If not using a catalog. SQL> alter system set log_archive_dest_2='location=/new/location/archive2' scope=both. 5. RMAN> backup database filesperset 1 plus archivelog delete input. The smaller the backup piece the quicker the restore can complete. Maintain your RMAN catalog/controlfile REASON: Choose your retention policy carefully. by having multiple copies in multiple locations. requirements for backup recovery strategy.3. This will keep 21 days of backup records. This is the best method to determine if your backup is good and usable before being in a situation where it is critical and issues exist. 6. the other logs will still be available and could be used. Test your backup REASON: This will do everything except actually restore the database. This is especially relevent with tape backups of large databases or where the restore is only on indiviDUAL / few files. RMAN> restore validate database. SQL> alter database add logfile member '/new/location/redo21. Duplex log groups and members and have more than one archive log dest REASON: If an archivelog is corrupted or lost. SQL> alter system set control_file_record_keep_time=21 scope=both. 4. When backing up the database use the 'check logical' parameter REASON: This will cause RMAN to check for logical corruption within a block as well as the normal head/tail checksumming. If an online log is deleted or becomes corrupt. 7. you will have another member that can be used to recover if required. . Make sure that it compliments your tape subsystem retention policy.

RMAN> delete obsolete. Related Topics Archivelogs Block Change Tracking DBMS_IR DBMS_RCVMAN DDL Event Triggers Flashback Database Flashback Query . Prepare for loss of controlfiles set autobackup on REASON: This will ensure that you always have an up to date controlfile available that has been taken at the end of the current backup not during. locations on controlfile backups that can be utilised if complete loss occurs. that it will not be eligible.Run regular catalog maintenance. RMAN> crosscheck backup. 10. The next backup will back up those from location 2 as well as new logs from location 1. SQL> recover database test. This means that you will have the archivelogs since the last backup available on disk in location 2 (as well as backed up once) and two copies backup up prior to the previous backup. the catalog will continue to grow until performance becomes an issue. REASON: Delete obsolete will remove backups that are outside your retention policy. then delete all that are backed up. and can avoid having to restore source datafiles again. keep your backup logs REASON: The backup log contains parameters for your tape access. To remove the expired backups from the catalog/controlfile use the delete expired command. If obsolete backups are not deleted. 9. 8. If a backup is missing. REASON: crosschecking will check that the catalog/controlfile matches the physical backups. Test your recovery REASON: During a recovery situation this will let you know how the recovery will go without actually doing it. it will set the piece to 'EXPIRED' so when a restore is started. RMAN> delete expired backup. and an earlier backup will be used. Do not specify 'delete all input' when backing up archivelogs REASON: Delete all input' will backup from one destination then delete both copies of the archivelog where as 'delete input' will backup from one location and then delete what has been backed up. RMAN> configure controlfile autobackup on.

Flashback Table RMAN Demo System Event Triggers .