BANNER CON_ID
---------------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0
PL/SQL Release 12.1.0.1.0 - Production 0
CORE 12.1.0.1.0 Production 0
TNS for Linux: Version 12.1.0.1.0 - Production 0
NLSRTL Version 12.1.0.1.0 - Production 0
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TESTPDB READ WRITE NO
2、主库启动force logging
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> alter database force logging;
MEMBER
--------------------------------------------------------------------------------
+DATA/ORARAC/ONLINELOG/group_8.log
+DATA/ORARAC/ONLINELOG/group_9.log
+DATA/ORARAC/ONLINELOG/group_10.log
Recovery Manager: Release 12.1.0.1.0 - Production on Thu Mar 26 14:13:15 2015
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORARAC (DBID=377624869)
connected to auxiliary database: ORARAC (not mounted)
RMAN> duplicate target database for standby from active database nofilenamecheck dorecover;
Starting Duplicate Db at 26-MAR-15
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=414 device type=DISK
current log archived
contents of Memory Script:
{
backup as copy reuse
targetfile '+DATA/orarac/orapworarac' auxiliary format
'/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapworarac' ;
}
executing Memory Script
Starting backup at 26-MAR-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=247 instance=orarac1 device type=DISK
Finished backup at 26-MAR-15
contents of Memory Script:
{
restore clone from service 'orarac' standby controlfile;
}
executing Memory Script
Starting restore at 26-MAR-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/oraracdg/control01.ctl
Finished restore at 26-MAR-15
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
RMAN-05529: WARNING: DB_FILE_NAME_CONVERT resulted in invalid ASM names; names changed to disk group only.
contents of Memory Script:
{
set newname for tempfile 1 to
"+DATA";
set newname for tempfile 2 to
"/u01/app/oracle/oradata/oraracdg/datafile2/pdbseed_temp01.dbf";
set newname for tempfile 3 to
"+DATA";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/oraracdg/system.258.874160123";
set newname for datafile 3 to
"/u01/app/oracle/oradata/oraracdg/sysaux.257.874160067";
set newname for datafile 4 to
"/u01/app/oracle/oradata/oraracdg/undotbs1.260.874160189";
set newname for datafile 5 to
"/u01/app/oracle/oradata/oraracdg/datafile2/system.266.874160245";
set newname for datafile 6 to
"/u01/app/oracle/oradata/oraracdg/users.259.874160187";
set newname for datafile 7 to
"/u01/app/oracle/oradata/oraracdg/datafile2/sysaux.265.874160245";
set newname for datafile 8 to
"/u01/app/oracle/oradata/oraracdg/undotbs2.268.874160743";
set newname for datafile 9 to
"/u01/app/oracle/oradata/oraracdg/datafile3/system.272.874161075";
set newname for datafile 10 to
"/u01/app/oracle/oradata/oraracdg/datafile3/sysaux.273.874161075";
set newname for datafile 11 to
"/u01/app/oracle/oradata/oraracdg/datafile3/users.275.874161105";
restore
from service 'orarac' clone database
;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to +DATA in control file
renamed tempfile 2 to /u01/app/oracle/oradata/oraracdg/datafile2/pdbseed_temp01.dbf in control file
renamed tempfile 3 to +DATA in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 26-MAR-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/oraracdg/system.258.874160123
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/oraracdg/sysaux.257.874160067
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/oraracdg/undotbs1.260.874160189
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/oraracdg/datafile2/system.266.874160245
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/oraracdg/users.259.874160187
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/oraracdg/datafile2/sysaux.265.874160245
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/oraracdg/undotbs2.268.874160743
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/oraracdg/datafile3/system.272.874161075
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/oraracdg/datafile3/sysaux.273.874161075
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/oraracdg/datafile3/users.275.874161105
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 26-MAR-15
sql statement: alter system archive log current
current log archived
contents of Memory Script:
{
restore clone force from service 'orarac'
archivelog from scn 3855569;
switch clone datafile all;
}
executing Memory Script
Starting restore at 26-MAR-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=103
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=104
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=105
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=2 sequence=71
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=2 sequence=72
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=2 sequence=73
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service orarac
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=2 sequence=74
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 26-MAR-15
contents of Memory Script:
{
set until scn 3855975;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 26-MAR-15
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 103 is already on disk as file /u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_1_103_bk79gson_.arc
archived log for thread 1 with sequence 104 is already on disk as file /u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_1_104_bk79gtqk_.arc
archived log for thread 1 with sequence 105 is already on disk as file /u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_1_105_bk79gvso_.arc
archived log for thread 2 with sequence 72 is already on disk as file /u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_2_72_bk79gxxh_.arc
archived log for thread 2 with sequence 73 is already on disk as file /u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_2_73_bk79gz01_.arc
archived log for thread 2 with sequence 74 is already on disk as file /u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_2_74_bk79h024_.arc
archived log file name=/u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_1_103_bk79gson_.arc thread=1 sequence=103
archived log file name=/u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_2_72_bk79gxxh_.arc thread=2 sequence=72
archived log file name=/u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_2_73_bk79gz01_.arc thread=2 sequence=73
archived log file name=/u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_1_104_bk79gtqk_.arc thread=1 sequence=104
archived log file name=/u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_1_105_bk79gvso_.arc thread=1 sequence=105
archived log file name=/u01/app/oracle/oradata/oraracdg/fra/ORARACDG/archivelog/2015_03_26/o1_mf_2_74_bk79h024_.arc thread=2 sequence=74
media recovery complete, elapsed time: 00:00:00
Finished recover at 26-MAR-15
Finished Duplicate Db at 26-MAR-15
12、打开备库并启动apply
查看备库:
[oracle@oracletest admin]$ sqlplus "/as sysdba"
SQL*Plus: Release 12.1.0.1.0 Production on Thu Mar 26 14:25:11 2015
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> select status from v$instance;
STATUS
------------
MOUNTED
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED MOUNTED
3 TESTPDB MOUNTED
SQL> alter database open;
Database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TESTPDB MOUNTED
SQL> alter pluggable database testpdb open;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TESTPDB READ ONLY NO
SQL> select log_mode,open_mode,database_role from v$database;