STARTUP NOMOUNT;
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
RESTORE CONTROLFILE;
ALTER DATABASE MOUNT;
RESTORE DATABASE;
}
Configure the new server with same disk layout as the original
database - if neccecary use Symbolic Links (or in Windows use
disk manager to re-assign drive letters.)
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.
SQL> CREATE
PFILE='C:\oracle\Database\initLive.ora' FROM
SPFILE;
SQL> Shutdown immediate;
SQL> Startup mount
pfile=C:\oracle\Database\initLive.ora
In this case we have copied the RMAN backup files and archive
logs to R:\Rman\
RMAN> run {
ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT
'R:\Rman\%U';
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.
Notes:
If you are running in Archive log mode (and you should be),
point-in time is probably the most common recovery scenario.
RMAN> run
{
allocate channel dev1 type disk;
set until time "to_date('2010-30-12:00:00:00',
'yyyy-dd-mm:hh24:mi:ss')";
restore database;
recover 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.
As soon as you have done a resetlogs run a full 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.
Example
Examples
RMAN>SHOW ALL;
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
SHOW RETENTION POLICY;
SHOW DEVICE TYPE;
SHOW DEFAULT DEVICE TYPE;
SHOW CHANNEL;
SHOW MAXSETSIZE;
SHOW ALL;
Syntax:
RUN {
...
}
Example
RUN
{
ALLOCATE CHANNEL dev1 DEVICE TYPE DISK FORMAT
'/fs1/%U';
ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT
'/fs2/%U';
BACKUP
(TABLESPACE system,finance,marketing
FILESPERSET 20)
(DATAFILE 62,63,64);
}
Examples
Restore and recover the whole database
RMAN> STARTUP FORCE MOUNT;
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN;
Syntax:
Examples
Backup datafiles:
RMAN> BACKUP AS BACKUPSET DATAFILE
'ORACLE_HOME/oradata/trgt/users01.dbf',
'ORACLE_HOME/oradata/trgt/tools01.dbf';
Backup all datafiles in the database:
(bit-for-bit copies, created on disk)
RMAN> BACKUP AS COPY DATABASE;
Backup tablespace:
RMAN> BACKUP TABLESPACE system, users, tools;
Backup controlfile:
RMAN> BACKUP CURRENT CONTROLFILE TO
'/backup/cntrlfile.copy';
Backup everything:
RMAN> BACKUP BACKUPSET ALL;