As we know that Oracle introduced multitenant Container Database (CDB)
and Pluggable Database (PDB) in 12c. Using RMAN client we can perform the
backup of entire Container Database (CDB)
or individual Pluggable Database (PDB) and also perform the point-in- time recovery.
Before start the RMAN backup, we should aware about SQL interface for RMAN that another greatest and easiest feature that we can use SQL statement through RMAN. Prior to 12c, very limited SQL statement was
supported with RMAN.
CDB, PCDB
and ROOT Backup:-
We can backup the Container
Database (CDB) as same as non-container
database using below RMAN command.
RMAN> BACKUP
DATABASE PLUS ARCHIVELOG;
Backup Pluggable database (PDB) using below RMAN command.
RMAN> BACKUP
PLUGGABLE DATABASE PDBORCL1, PDBORCL2;
Or connect to Pluggable database (PDB).
$RMAN target sys@PDBORCL1
RMAN> BACKUP
DATABASE;
We can backup root using below.
RMAN> BACKUP
DATABASE ROOT;
CDB,PCDB
and ROOT Restore & Recovery:-
Restoration of container
database (CDB) and non-container
database both are same. We can restore the CDB using below scripts.
RMAN> RUN {
STARTUP MOUNT;
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN;
}
Above script will restore whole container (CDB) and pluggable
database (PDB).
For restoration of ROOT use below script.
RMAN> RUN {
STARTUP MOUNT;
RESTORE DATABASE ROOT;
RECOVER DATABASE ROOT;
ALTER DATABASE OPEN;
}
There are two way to restore Pluggable Database (PDB), either restore from root container or directly
connect to Pluggable Database (PDB).
RMAN> RUN {
RESTORE PLUGGABLE
DATABASE PDBORCL1, PDBORCL2;
RECOVER PLUGGABLE DATABASE
PDBORCL1, PDBORCL2;
ALTER PLUGGABLE
DATABASE PDBORCL1, PDBORCL2 OPEN;
}
Connect Pluggable
database (PDB) and do the Restoration and recovery using below script.
$ RMAN TARGET=sys@PDBORCL
RMAN> RUN {
RESTORE DATABASE;
RECOVER DATABASE;
}
Follow the below steps to recover the database until a specified
SCN, time or log sequence
Step 1: Shutdown and
startup mount the database.
SQL> SHUTDOWN IMMEDAITE;
SQL> STARTUP MOUNT;
Step 2: First of all determine
the SCN, time or log sequence that you want to recovery.
SCN – you can get the SCN from alert.log file
Sequence – v$log_history
Step 3. Perform the
incomplete recovery
If specifying a time, then set NLS_LANG and NLS_DATE_FORMAT
environment variables.
RUN {
SET UNTIL TIME 'SEP 10 2019 12:00:00';
# SET UNTIL SCN 400; # alternatively, specify SCN
# SET UNTIL SEQUENCE 423; # alternatively, specify log seq
RESTORE DATABASE;
RECOVER DATABASE;
}
Note:- If datafile destination different as compare to source database. Use SET NEWNAME FOR DATAFILE and then use SWITCH DATAFILE ALL. Pls check here for more information.
Before execute resetlogs , need to update redologfile and tempfiles. For more info check here.
Step 4. Open database with
resetlogs.
SQL> ALTER DATABASE OPEN RESETLOGS;

No comments:
Post a Comment
Thanks for reading till end. I hope this will help you more to improve your knowledge.
Now it's your turn!
What do you think? Share your experience in the comments box and subscribe for more interesting post.