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';

} Restore Validation confirms that a restore could be run. There are many ways to restore a database using an RMAN backup . by confirming that all database files exist and are free of physical and logical corruption. ALTER DATABASE MOUNT. this does not generate any output. RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt. (to all locations specified in the parameter file) then restore the database.Restore the Control file.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. 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: . using that control file: STARTUP NOMOUNT. RESTORE CONTROLFILE. Example: RMAN> RESTORE DATABASE VALIDATE. RESTORE DATABASE.

set the LOG_ARCHIVE_FORMAT parameter to match the setting in the original database.ora' FROM SPFILE. SQL> Shutdown immediate. or specifying the pfile explicitly: SQL> CREATE PFILE='C:\oracle\Database\initLive. 2) Mount the empty instance SQL> Shutdown immediate. . The ORAPWD utility can also be used to change the SYS password. If the database to be restored is in archive log mode. SQL> Startup mount.if neccecary use Symbolic Links (or in Windows use disk manager to re-assign drive letters.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 .) Ensure you have enough disk space for both the backup files plus the restored database files. 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.

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

All rights reserved. You will need the following information: Database SID: ________ Database SYS password: ________ . 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).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. point-in time is probably the most common recovery scenario. The RMAN client displays the dbid at startup when connecting to a database: Copyright (c) 1995. Oracle.As soon as you have done a resetlogs run a full backup. 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. Notes: The DBID can be retrieved in several places. if the database is running: Select dbid from V$DATABASE. 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. 2003.

. Restore and recover the datafiles RMAN> run { allocate channel dev1 type disk. set until time "to_date('2010-30-12:00:00:00'. archived to tape) restore them to the default locations on the oracle database server. Mount the instance C:\> Set ORACLE_SID=Live C:\> rman TARGET SYS/Password NOCATALOG RMAN:> shutdown immediate. RMAN:> startup mount. If any of these files have been moved (e.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. in this case from 23:00 until 09:00.g. 'yyyy-dd-mm:hh24:mi:ss')".

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. Examples Show all configurable settings: RMAN>SHOW ALL. } For a large database it can take a long time to restore each tablespace . This will update all current datafiles and online redo logs and all subsequent archived redo logs with a new RESETLOGS SCN and time stamp. As soon as you have done a resetlogs run a full backup.restore database.for better performance during a restore place the RMAN backup files on a separate disk to the Oracle datafiles to reduce disk contention. recover database. Example Change an ordinary backup into a long-term backup: CHANGE BACKUPSET 431 KEEP FOREVER NOLOGS. . Open the database and reset logs RMAN> alter database open resetlogs.

Write disk backups to the /tmp directory: (%U will be replaced with unique filenames) RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/tmp/%U'. 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. By default. 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 . 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. 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'. Configure RMAN to back up the control file after each backup RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON.

KEEP (or CHANGE. day. year. SHOW DEFAULT DEVICE TYPE. Unique filenames are: DBID. 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 }. month. .use BACKUP.To override the configured retention policy for individual backups . Examples SHOW RETENTION POLICY. KEEP) Configure backups to run in parallel by assigning two sbt channels: RMAN> CONFIGURE DEVICE TYPE sbt PARALLELISM 2.. and sequence number. 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. RMAN> CONFIGURE RETENTION POLICY CLEAR.

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

2. Recover the datafiles with the RECOVER command. Restore the necessary files with the RESTORE command. RMAN> RECOVER DATAFILE 64. Mount or open the database. 4. 3. 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 . or open the database when performing online tablespace recovery. open it or bring recovered tablespaces online.RMAN> SQL 'ALTER TABLESPACE users ONLINE'. use the SET UNTIL command to specify the time. SCN. RMAN> SQL 'ALTER DATABASE DATAFILE 64 ONLINE'. specify the UNTIL clause on the RESTORE and RECOVER commands. Restore and recover a datafile RMAN> SQL 'ALTER DATABASE DATAFILE 64 OFFLINE'. For example. Steps for media recovery: 1. Mount the database when performing whole database recovery. To perform incomplete recovery. 5. or log sequence number at which recovery terminates. Alternatively. RMAN> RESTORE DATAFILE 64. Place the database in its normal state.

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

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