12c-How To Recover Root Container

yyp2009發表於2014-06-07
接下來分享一下對root容器的備份與恢復:
root容器的備份其實就是cdb的備份,完全沒有pdb的備份:
[oracle@orat3 ~]$ export ORACLE_SID=prd12cdb1
[oracle@orat3 ~]$
[oracle@orat3 ~]$
[oracle@orat3 ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Sat Jun 7 14:38:42 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PRD12CDB (DBID=3299715205)

RMAN> BACKUP DATABASE ROOT;

Starting backup at 07-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=4624 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/data01/3.dbf
input datafile file number=00001 name=/data01/1.dbf
input datafile file number=00004 name=/data01/4.dbf
input datafile file number=00008 name=/data01/8.dbf
input datafile file number=00006 name=/data01/6.dbf
channel ORA_DISK_1: starting piece 1 at 07-JUN-14
channel ORA_DISK_1: finished piece 1 at 07-JUN-14
piece handle=/data01/PRD12CDB/backupset/2014_06_07/o1_mf_nnndf_TAG20140607T143900_9s5dw4fp_.bkp tag=TAG20140607T143900 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 07-JUN-14

Starting Control File and SPFILE Autobackup at 07-JUN-14
piece handle=/bak/orabakdata/controlfile/controlc-3299715205-20140607-01 comment=NONE
Finished Control File and SPFILE Autobackup at 07-JUN-14

RMAN>
*****************************************************
[root@orat3 ~]# cd /data01
[root@orat3 data01]# ls
10.dbf  12.dbf  16.dbf  18.dbf  1.dbf   3.dbf  5.dbf  7.dbf  9.dbf  current.256.844530693  lost+found  PROD12C
11.dbf  13.dbf  17.dbf  19.dbf  20.dbf  4.dbf  6.dbf  8.dbf  bak    current.261.844530693  PRD12CDB
[root@orat3 data01]# rm 1.dbf
rm: remove regular file `1.dbf'? y
[root@orat3 data01]# ls
******************************************************
[oracle@orat3 ~]$ sqlplus '/ as sysdba'

SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 7 14:45:20 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         4 OSSPORTALDB                    READ WRITE NO
SQL> shut abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 4.0486E+10 bytes
Fixed Size                  2692048 bytes
Variable Size            6979324976 bytes
Database Buffers         3.3420E+10 bytes
Redo Buffers               84176896 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/data01/1.dbf'

[oracle@orat3 ~]$ rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Sat Jun 7 14:47:01 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PRD12CDB (DBID=3299715205, not open)

RMAN> restore DATABASE ROOT;

Starting restore at 07-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=4 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /data01/1.dbf
channel ORA_DISK_1: restoring datafile 00003 to /data01/3.dbf
channel ORA_DISK_1: restoring datafile 00004 to /data01/4.dbf
channel ORA_DISK_1: restoring datafile 00006 to /data01/6.dbf
channel ORA_DISK_1: restoring datafile 00008 to /data01/8.dbf
channel ORA_DISK_1: reading from backup piece /data01/PRD12CDB/backupset/2014_06_07/o1_mf_nnndf_TAG20140607T143900_9s5dw4fp_.bkp
channel ORA_DISK_1: piece handle=/data01/PRD12CDB/backupset/2014_06_07/o1_mf_nnndf_TAG20140607T143900_9s5dw4fp_.bkp tag=TAG20140607T143900
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:36
Finished restore at 07-JUN-14

RMAN> recover database root;

Starting recover at 07-JUN-14
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 07-JUN-14
RMAN> alter database open;

Statement processed

RMAN> alter pluggable database all open;

Statement processed

************************************************************

SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL>
SQL>
SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         4 OSSPORTALDB                    READ WRITE NO
SQL> select  sysdate from dual;

SYSDATE
---------
07-JUN-14

root容器的備份就是cdb的備份。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13750068/viewspace-1177669/,如需轉載,請註明出處,否則將追究法律責任。

相關文章