Backup and restore of pluggable databses, CDB in oracle 12c
Note: Please ensure required backup is available , it is mandatory when working on backup and recovery... No backup mean no recovery, as simple as that.
Note: Please ensure required backup is available , it is mandatory when working on backup and recovery... No backup mean no recovery, as simple as that.
run
{
configure controlfile autobackup on;
CONFIGURE BACKUP OPTIMIZATION off;
CONFIGURE DEVICE TYPE DISK PARALLELISM 4;
backup current controlfile spfile;
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG DELETE ALL INPUT format '/tmp/madhav/%d_inc0_%T_%U.bak';
}
select to_char(sysdate,'hh24:mi dd-mm-yyyy'), current_scn from v$database;
TO_CHAR(SYSDATE, CURRENT_SCN
---------------- -----------
08:44 07-10-2016 72629675
--- Point In Time Recovery (PITR) of a Pluggable Database (PDB) in oracle 12c
run
{
alter pluggable database pdborcl close immediate;
restore pluggable database pdborcl;
recover pluggable database pdborcl until time "to_date('08:44 07-10-2016','hh24:mi dd-mm-yyyy')" auxiliary destination '/tmp';
alter pluggable database pdborcl open resetlogs;
}
--- Normal recovery of Pluggable Database (PDB) in oracle 12c
run
{
alter pluggable database pdborcl close immediate;
restore pluggable database pdborcl;
recover pluggable database pdborcl;
alter pluggable database pdborcl open;
}
--- Normal or Full restore, recovery of of oracle 12c CDB and all of its PDBs
-- open cdb in mount status
run
{
restore database;
recover database;
alter database open;
alter pluggable database all open ;
}
--- Restore adn Recover of CDB in oracle 12c -- cdb levle
RUN
{
alter pluggable database all close immediate;
SHUTDOWN IMMEDIATE;
startup mount;
RESTORE DATABASE;
RECOVER DATABASE UNTIL TIME "TO_DATE('09-10-2016 23:40:00','DD-MM-YYYY HH24:MI:SS')" ;
alter database open resetlogs;
alter pluggable database all open;
}
---- Restore and Recover of NOCDB in oracle 12c
Note: Tested with multiple database open resetlogs; hence reset incarnation had to be done.
bash-4.2$ rman target sys/manager
Recovery Manager: Release 12.1.0.2.0 - Production on Sun Oct 9 20:49:45 2016
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: BANUDB (DBID=881160953, not open)
RMAN>
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 BANUDB 881160953 PARENT 1 07-07-2014 05:38:47
2 2 BANUDB 881160953 PARENT 1594143 19-11-2015 03:18:19
3 3 BANUDB 881160953 PARENT 22187971 09-10-2016 03:20:09
4 4 BANUDB 881160953 CURRENT 22189494 09-10-2016 04:11:10
RMAN> reset database to incarnation 3;
database reset to incarnation 3
RMAN>
RMAN> RUN
{
SHUTDOWN IMMEDIATE;
startup mount;
RESTORE DATABASE;
RECOVER DATABASE UNTIL TIME "TO_DATE('09-10-2016 03:30:00','DD-MM-YYYY HH24:MI:SS')" ;
ALTER DATABASE OPEN read only;
}
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 BANUDB 881160953 PARENT 1 07-07-2014 05:38:47
2 2 BANUDB 881160953 PARENT 1594143 19-11-2015 03:18:19
3 3 BANUDB 881160953 CURRENT 22187971 09-10-2016 03:20:09
4 4 BANUDB 881160953 ORPHAN 22189494 09-10-2016 04:11:10
No comments:
Post a Comment