12c-RECOVER PLUGGABLE DATABASE

yyp2009發表於2014-06-07

[oracle@orat3 ~]$ export ORACLE_SID=prd12cdb1
[oracle@orat3 ~]$  rman target /

Recovery Manager: Release 12.1.0.1.0 - Production on Fri Jun 6 23:59:18 2014

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


connected to target database: PRD12CDB (DBID=3299715205)

RMAN>
RMAN> backup database plus archivelog ;


Starting backup at 06-JUN-14
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=7 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=115 STAMP=849361491
input archived log thread=1 sequence=6 RECID=116 STAMP=849365370
input archived log thread=1 sequence=7 RECID=117 STAMP=849571167
channel ORA_DISK_1: starting piece 1 at 06-JUN-14
channel ORA_DISK_1: finished piece 1 at 06-JUN-14
piece handle=/data01/PRD12CDB/backupset/2014_06_06/o1_mf_annnn_TAG20140606T235928_9s3sc15r_.bkp tag=TAG20140606T235928 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 06-JUN-14

Starting backup at 06-JUN-14
using channel ORA_DISK_1
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 06-JUN-14
channel ORA_DISK_1: finished piece 1 at 07-JUN-14
piece handle=/data01/PRD12CDB/backupset/2014_06_06/o1_mf_nnndf_TAG20140606T235932_9s3sc4mh_.bkp tag=TAG20140606T235932 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00013 name=/data01/13.dbf
input datafile file number=00012 name=/data01/12.dbf
input datafile file number=00018 name=/data01/18.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/F6ACE29ECAE0576BE0430254800A9CD6/backupset/2014_06_07/o1_mf_nnndf_TAG20140606T235932_9s3sf5sn_.bkp tag=TAG20140606T235932 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/data01/7.dbf
input datafile file number=00005 name=/data01/5.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/F6AC7D86579C49A9E0430254800A174B/backupset/2014_06_07/o1_mf_nnndf_TAG20140606T235932_9s3sfnxy_.bkp tag=TAG20140606T235932 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 07-JUN-14

Starting backup at 07-JUN-14
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=118 STAMP=849571278
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_annnn_TAG20140607T000118_9s3sggb6_.bkp tag=TAG20140607T000118 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 07-JUN-14

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

RMAN>

[root@orat3 ~]# su - oracle
[oracle@orat3 ~]$ export ORACLE_SID=prd12cdb1
[oracle@orat3 ~]$ sqlplus '/ as sysdba'

SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 7 00:10:28 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>
SQL> sho pdbs   

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         4 OSSPORTALDB                    READ WRITE NO

QL> COLUMN PDB_ID FORMAT 999
SQL> COLUMN PDB_NAME FORMAT A8
SQL> COLUMN FILE_ID FORMAT 9999
SQL> COLUMN TABLESPACE_NAME FORMAT A10
COLUMN FILE_NAME FORMAT A45
SELECT p.PDB_ID, p.PDB_NAME, d.FILE_ID, d.TABLESPACE_NAME, d.FILE_NAME
FROM DBA_PDBS p, CDB_DATA_FILES d
WHERE p.PDB_ID = d.CON_ID
ORDER BY p.PDB_ID;SQL> SQL>   2    3    4 

PDB_ID PDB_NAME FILE_ID TABLESPACE FILE_NAME
------ -------- ------- ---------- ---------------------------------------------
     2 PDB$SEED       5 SYSTEM     /data01/5.dbf
     2 PDB$SEED       7 SYSAUX     /data01/7.dbf
     4 OSSPORTA      13 SYSAUX     /data01/13.dbf
       LDB

     4 OSSPORTA      12 SYSTEM     /data01/12.dbf
       LDB

     4 OSSPORTA      18 JTITSM     /data01/18.dbf
       LDB


SQL>

SQL> alter pluggable database  OSSPORTALDB close;

Pluggable database altered.

SQL> host
[oracle@orat3 ~]$ ls
d:123.csv
[oracle@orat3 ~]$ cd /data01
[oracle@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
[oracle@orat3 data01]$ rm 13.dbf
[oracle@orat3 data01]$ rm 12.dbf
[oracle@orat3 data01]$ rm 18.dbf
[oracle@orat3 data01]$ exit
exit

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         4 OSSPORTALDB                    MOUNTED
SQL> alter pluggable database  OSSPORTALDB open; 
alter pluggable database  OSSPORTALDB open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 18 - see DBWR trace file
ORA-01110: data file 18: '/data01/18.dbf'


SQL>

RMAN>  RESTORE PLUGGABLE DATABASE OSSPORTALDB;

Starting restore at 07-JUN-14
using channel ORA_DISK_1

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 00012 to /data01/12.dbf
channel ORA_DISK_1: restoring datafile 00013 to /data01/13.dbf
channel ORA_DISK_1: restoring datafile 00018 to /data01/18.dbf
channel ORA_DISK_1: reading from backup piece /data01/PRD12CDB/F6ACE29ECAE0576BE0430254800A9CD6/backupset/2014_06_07/o1_mf_nnndf_TAG20140606T235932_9s3sf5sn_.bkp
channel ORA_DISK_1: piece handle=/data01/PRD12CDB/F6ACE29ECAE0576BE0430254800A9CD6/backupset/2014_06_07/o1_mf_nnndf_TAG20140606T235932_9s3sf5sn_.bkp tag=TAG20140606T235932
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 07-JUN-14

RMAN> RECOVER PLUGGABLE DATABASE OSSPORTALDB;

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 pluggable database  OSSPORTALDB open;

Statement processed



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

相關文章