RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN> RMAN>

LIST LIST LIST LIST LIST LIST LIST LIST LIST LIST LIST

BACKUP; BACKUP OF DATABASE; BACKUP SUMMARY; INCARNATION; BACKUP BY FILE; COPY OF DATABASE ARCHIVELOG ALL; COPY OF DATAFILE 1, 2, 3; BACKUP OF DATAFILE 11 SUMMARY; BACKUP OF ARCHIVELOG FROM SEQUENCE 1437; CONTROLFILECOPY "/tmp/cntrlfile.copy"; BACKUPSET OF DATAFILE 1;

RMAN> RMAN> RMAN> RMAN> RMAN>

CROSSCHECK CROSSCHECK CROSSCHECK CROSSCHECK CROSSCHECK

BACKUP; COPY; backup of database; backup of controlfile; archivelog all;

Restore and recover the whole Database: RMAN> RMAN> RMAN> RMAN> STARTUP FORCE MOUNT; RESTORE DATABASE; RECOVER DATABASE; ALTER DATABASE OPEN;

Restore and recover a Tablespace: RMAN> RMAN> RMAN> RMAN> SQL 'ALTER TABLESPACE users OFFLINE'; RESTORE TABLESPACE users; RECOVER TABLESPACE users; SQL 'ALTER TABLESPACE users ONLINE';

Restore and recover a Datafile: RMAN> RMAN> RMAN> RMAN> SQL 'ALTER DATABASE DATAFILE 64 OFFLINE'; RESTORE DATAFILE 64; RECOVER DATAFILE 64; SQL 'ALTER DATABASE DATAFILE 64 ONLINE';

ALTER DATABASE MOUNT.Restore the Control file. } Restore Validation confirms that a restore could be run. this does not generate any output. There are many ways to restore a database using an RMAN backup . Example: RMAN> RESTORE DATABASE VALIDATE.this example assumes you are performing a DisasterRecovery restore of all data and recovering the entire database with the same SID and the same disk/tablespace layout. RESTORE CONTROLFILE. using that control file: STARTUP NOMOUNT. You will need the following information: Database SID: ________ Database SYS password: ________ Disk layout and sizes: ________ Database ID (DBID): ________ There are 5 steps to recover the database: . RESTORE DATABASE. by confirming that all database files exist and are free of physical and logical corruption. (to all locations specified in the parameter file) then restore the database. RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt.

The ORAPWD utility can also be used to change the SYS password. 2) Mount the empty instance SQL> Shutdown immediate.if neccecary use Symbolic Links (or in Windows use disk manager to re-assign drive letters. SQL> Shutdown immediate. or specifying the pfile explicitly: SQL> CREATE PFILE='C:\oracle\Database\initLive.) Ensure you have enough disk space for both the backup files plus the restored database files. set the LOG_ARCHIVE_FORMAT parameter to match the setting in the original database. . SQL> Startup mount. Create a new database with the database configuration assistant (DBCA) and set the SYS password and global database_name to the same as the original database. If the database to be restored is in archive log mode.ora' FROM SPFILE.1) Create a new (empty) database instance 2) Mount the instance 3) Restore the datafiles 4) Recover the database 5) Reset the logs 1) Create a new (empty) database instance Configure the new server with same disk layout as the original database .

For a large database it can take a long time to restore each tablespace .ora 3) Restore the datafiles In this case we have copied the RMAN backup files and archive logs to R:\Rman\ Change the dbid to match that of the database being restored RMAN> SET dbid = 477771234. 4) Recover the database SQL> Recover from 'L:\oradata\live' database until cancel using backup controlfile. This will update all current datafiles and online redo logs and all subsequent archived redo logs with a new RESETLOGS SCN and time stamp.for better performance during a restore place the RMAN backup files on a separate disk to the Oracle datafiles to reduce disk contention. . RMAN> run { ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT 'R:\Rman\%U'.SQL> Startup mount pfile=C:\oracle\Database\initLive. restore database. SQL> cancel 5) Reset the logs SQL> alter database open resetlogs. } At this point the datafiles and tablespaces will be re-created.

point-in time is probably the most common recovery scenario. 2003. Notes: The DBID can be retrieved in several places. if the database is running: Select dbid from V$DATABASE. Oracle. If you are running in Archive log mode and recover without specifying a date/time then RMAN will apply all Archived logs it can find. connected to target database: RDBMS (DBID=7776644123) There are many ways to restore a database using an RMAN backup . this is important as should you suffer a second failure you will not be able to perform a second recovery because after resetting the logs the SCN numbers will no longer match any older backup files.this example assumes you are running RMAN without a Catalog and are performing a Restore & Point-In-Time Recovery of all data back to a particular date/time in the past. The RMAN client displays the dbid at startup when connecting to a database: Copyright (c) 1995. ofter recovering the database right back to the time when you started the restore operation! If you are running in Archive log mode (and you should be).As soon as you have done a resetlogs run a full backup. All rights reserved. You will need the following information: Database SID: ________ Database SYS password: ________ .

Restore and recover the datafiles RMAN> run { allocate channel dev1 type disk. RMAN:> startup mount. .The Date and Time to restore to : ________ There are 5 steps to recover the database: 1) Restore backup files from tape 2) Mount the instance 3) Restore the datafiles 4) Recover the database 5) Reset the logs Restore backup files from tape If you are looking to restore the database to a time of (say 09:00) you will need the most recent RMAN backup files prior to the date (say 23:00 from the previous day) plus all the archive logs from the backup time until the restore time.g. in this case from 23:00 until 09:00. 'yyyy-dd-mm:hh24:mi:ss')". Mount the instance C:\> Set ORACLE_SID=Live C:\> rman TARGET SYS/Password NOCATALOG RMAN:> shutdown immediate. archived to tape) restore them to the default locations on the oracle database server. If any of these files have been moved (e. set until time "to_date('2010-30-12:00:00:00'.

this is important as should you suffer a second failure you will not be able to perform a second recovery because after resetting the logs the SCN numbers will no longer match any older backup files. recover database.for better performance during a restore place the RMAN backup files on a separate disk to the Oracle datafiles to reduce disk contention. Open the database and reset logs RMAN> alter database open resetlogs. Example Change an ordinary backup into a long-term backup: CHANGE BACKUPSET 431 KEEP FOREVER NOLOGS.restore database. This will update all current datafiles and online redo logs and all subsequent archived redo logs with a new RESETLOGS SCN and time stamp. } For a large database it can take a long time to restore each tablespace . . As soon as you have done a resetlogs run a full backup. Examples Show all configurable settings: RMAN>SHOW ALL.

Configure RMAN to back up the control file after each backup RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON.Write disk backups to the /tmp directory: (%U will be replaced with unique filenames) RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/tmp/%U'. Retain three backups of each datafile: RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3. Delete backups no longer required by the retention policy: RMAN> DELETE OBSOLETE . By default. RMAN automatically names control file backups and stores them in the flash recovery area. Backup using a flash recovery area rather than disk RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT CLEAR. To configure RMAN to write control file backups to the /cfilebackups directory: ( %F will generate a unique filename) RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/cfilebackups/cf%F'. Ensure that RMAN retains all backups needed to recover the database to any point in time in the last 7 days: RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS.

Reset any CONFIGURE setting to its default by running the command with the CLEAR option RMAN> CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR. SHOW DEVICE TYPE. .To override the configured retention policy for individual backups .. KEEP) Configure backups to run in parallel by assigning two sbt channels: RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 2. Unique filenames are: DBID. KEEP (or CHANGE.use BACKUP.. Examples SHOW RETENTION POLICY. SHOW DEFAULT DEVICE TYPE. RMAN> CONFIGURE RETENTION POLICY CLEAR. and sequence number. year. month. day. SHOW { RETENTION POLICY | [DEFAULT] DEVICE TYPE | [AUXILIARY] CHANNEL [FOR DEVICE TYPE deviceSpecifier] | MAXSETSIZE | { DATAFILE | ARCHIVELOG } BACKUP COPIES | BACKUP OPTIMIZATION | SNAPSHOT CONTROLFILE NAME | AUXNAME | EXCLUDE | CONTROLFILE AUTOBACKUP [FORMAT] | ALL }.

} Examples Restore and recover the whole database RMAN> STARTUP FORCE MOUNT.. RMAN> ALTER DATABASE OPEN. Syntax: RUN { .64).SHOW CHANNEL. ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT '/fs2/%U'. RMAN> RECOVER DATABASE.finance. Restore and recover a tablespace RMAN> SQL 'ALTER TABLESPACE users OFFLINE'. RMAN> RESTORE TABLESPACE users. RMAN> RESTORE DATABASE. SHOW MAXSETSIZE. RMAN> RECOVER TABLESPACE users. BACKUP (TABLESPACE system..63. SHOW ALL. . } Example RUN { ALLOCATE CHANNEL dev1 DEVICE TYPE DISK FORMAT '/fs1/%U'.marketing FILESPERSET 20) (DATAFILE 62.

Mount or open the database. or log sequence number at which recovery terminates. RMAN> RESTORE DATAFILE 64. Syntax: BACKUP FULL Options BACKUP FULL AS (COPY | BACKUPSET) Options BACKUP INCREMENTAL LEVEL [=] integer Options BACKUP INCREMENTAL LEVEL [=] integer AS (COPY | BACKUPSET) Options BACKUP AS (COPY | BACKUPSET) Options BACKUP AS (COPY | BACKUPSET) (FULL | INCREMENTAL LEVEL [=] integer) Options . SCN. use the SET UNTIL command to specify the time. or open the database when performing online tablespace recovery. Place the database in its normal state. RMAN> SQL 'ALTER DATABASE DATAFILE 64 ONLINE'. Mount the database when performing whole database recovery. Restore and recover a datafile RMAN> SQL 'ALTER DATABASE DATAFILE 64 OFFLINE'. Steps for media recovery: 1. RMAN> RECOVER DATAFILE 64. 5. For example. Recover the datafiles with the RECOVER command. specify the UNTIL clause on the RESTORE and RECOVER commands. To perform incomplete recovery. 4.RMAN> SQL 'ALTER TABLESPACE users ONLINE'. 3. Restore the necessary files with the RESTORE command. 2. Alternatively. open it or bring recovered tablespaces online.

Examples Back up the database. tools. created on disk) RMAN> BACKUP AS COPY DATABASE. RMAN> STARTUP MOUNT. Backup controlfile: RMAN> BACKUP CURRENT CONTROLFILE TO '/backup/cntrlfile. 'ORACLE_HOME/oradata/trgt/tools01. and then the control file: (which contains a record of the backup) RMAN> BACKUP DATABASE.copy'. . users. Create a consistent backup and keep the backup for 1 year: (exempt from the retention policy) RMAN> SHUTDOWN.dbf'. Backup tablespace: RMAN> BACKUP TABLESPACE system. Backup everything: RMAN> BACKUP BACKUPSET ALL. Backup parameter file: RMAN> BACKUP SPFILE. Backup archive logs: RMAN> BACKUP ARCHIVELOG COMPLETION TIME BETWEEN 'SYSDATE-28' AND 'SYSDATE-7'. RMAN> BACKUP CURRENT CONTROLFILE. Backup all datafiles in the database: (bit-for-bit copies.dbf'. Backup datafiles: RMAN> BACKUP AS BACKUPSET DATAFILE 'ORACLE_HOME/oradata/trgt/users01.

this does not generate any output. . Backup Validation confirms that a backup could be run. by confirming that all database files exist and are free of physical and logical corruption.RMAN> BACKUP DATABASE UNTIL 'SYSDATE+365' NOLOGS. Example: RMAN> BACKUP VALIDATE DATABASE ARCHIVELOG ALL.

Sign up to vote on this title
UsefulNot useful