Oracle Database 12c Using duplicate standby database from active database Created Active DataGuard

来源:互联网 发布:服务器远程软件下载 编辑:程序博客网 时间:2024/05/02 16:19

primary database

db_name=zwc, db_unique_name=zwc


standby database

db_name=zwc, db_unique_name=standby


on primary database

[oracle@vmdb12c ~]$ sqlplus sys/oracle@zwc as sysdbaSQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:12:10 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> col username for a10SQL> select * from v$pwfile_users;USERNAME   SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM     CON_ID---------- ----- ----- ----- ----- ----- ----- ----------SYS        TRUE  TRUE  FALSE FALSE FALSE FALSE          0SYSDG      FALSE FALSE FALSE FALSE TRUE  FALSE          1SYSBACKUP  FALSE FALSE FALSE TRUE  FALSE FALSE          1SYSKM      FALSE FALSE FALSE FALSE FALSE TRUE           1SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options[oracle@vmdb12c ~]$ sqlplus sys/oracle@zwc as sysdgSQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:12:20 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.ERROR:ORA-01031: insufficient privilegesEnter user-name: ERROR:ORA-01017: invalid username/password; logon deniedEnter user-name: ERROR:ORA-01017: invalid username/password; logon deniedSP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus[oracle@vmdb12c ~]$ [oracle@vmdb12c ~]$ [oracle@vmdb12c ~]$ [oracle@vmdb12c ~]$ sqlplus sys/oracle@zwc as sysbackupSQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:12:37 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.ERROR:ORA-01031: insufficient privilegesEnter user-name: ERROR:ORA-01017: invalid username/password; logon deniedEnter user-name: ERROR:ORA-01017: invalid username/password; logon deniedSP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

unlock SYSBACKUP,SYSDG users

[oracle@vmdb12c ~]$ sqlplus sys/oracle@zwc as sysdba   SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:14:39 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> col username for a10SQL> select username,account_status from dba_users where username in('SYSBACKUP','SYSDG','SYS');USERNAME   ACCOUNT_STATUS---------- --------------------------------SYSDG      EXPIRED & LOCKEDSYSBACKUP  EXPIRED & LOCKEDSYS        OPENSQL> alter user sysdg identified by oracle account unlock;User altered.SQL> alter user sysbackup identified by oracle account unlock;User altered.SQL> select username,account_status from dba_users where username in('SYSBACKUP','SYSDG','SYS');USERNAME   ACCOUNT_STATUS---------- --------------------------------SYS        OPENSYSBACKUP  OPENSYSDG      OPENSQL> 


retry

[oracle@vmdb12c ~]$ sqlplus sysbackup/oracle@zwc as sysbackupSQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:53:42 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options[oracle@vmdb12c ~]$ sqlplus sysdg/oracle@zwc as sysdg      SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:53:52 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options[oracle@vmdb12c ~]$ 

create pdb tablespace,user

[oracle@vmdb12c ~]$ sqlplus sys/oracle@zhongwc1 as sysdbaSQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:20:45 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> show pdbs    CON_ID CON_NAME                       OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ----------         3 ZHONGWC1                       READ WRITE NOSQL> create tablespace zwc datafile '/u01/app/oracle/oradata/zwc/zhongwc1/zwc01.dbf' size 50M autoextend on;Tablespace created.SQL> select name from v$datafile;NAME--------------------------------------------------------------------------------/u01/app/oracle/oradata/zwc/undotbs01.dbf/u01/app/oracle/oradata/zwc/zhongwc1/system01.dbf/u01/app/oracle/oradata/zwc/zhongwc1/sysaux01.dbf/u01/app/oracle/oradata/zwc/zhongwc1/zhongwc1_users01.dbf/u01/app/oracle/oradata/zwc/zhongwc1/zwc01.dbfSQL> create user zwc identified by zwc default tablespace zwc;User created.SQL> grant dba to zwc;Grant succeeded.SQL> conn zwc/zwc@zhongwc2ERROR:ORA-01017: invalid username/password; logon deniedWarning: You are no longer connected to ORACLE.SQL> conn zwc/zwc@zwcERROR:ORA-01017: invalid username/password; logon deniedSQL> conn zwc/zwc@zhongwc1Connected.SQL> create table t_01 as select * from dba_objects where rownum<101;Table created.SQL> commit;Commit complete.SQL> select count(*) from t_01;  COUNT(*)----------       100SQL> show pdbs    CON_ID CON_NAME                       OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ----------         3 ZHONGWC1                       READ WRITE NOSQL> 

create standby logfile

[oracle@vmdb12c ~]$ sqlplus / as sysdbaSQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:24:11 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> show con_nameCON_NAME------------------------------CDB$ROOTSQL> alter database force logging;Database altered.SQL> select group#,bytes/1024/1024 "size M" from v$log;    GROUP#     size M---------- ----------         1         50         2         50         3         50SQL> alter database add standby logfile group 4 size 50M;Database altered.SQL> alter database add standby logfile group 5 size 50M;Database altered.SQL> alter database add standby logfile group 6 size 50M;Database altered.SQL> alter database add standby logfile group 7 size 50M;Database altered.SQL> select group#,bytes/1024/1024 "size M" from v$log;    GROUP#     size M---------- ----------         1         50         2         50         3         50SQL> select group#,bytes/1024/1024 "size M" from v$standby_log;    GROUP#     size M---------- ----------         4         50         5         50         6         50         7         50SQL> select member from v$logfile;MEMBER--------------------------------------------------------------------------------/u01/app/oracle/oradata/zwc/redo03.log/u01/app/oracle/oradata/zwc/redo02.log/u01/app/oracle/oradata/zwc/redo01.log/u01/app/oracle/fast_recovery_area/ZWC/onlinelog/o1_mf_4_947vvsg7_.log/u01/app/oracle/fast_recovery_area/ZWC/onlinelog/o1_mf_5_947vvwvr_.log/u01/app/oracle/fast_recovery_area/ZWC/onlinelog/o1_mf_6_947vw4dg_.log/u01/app/oracle/fast_recovery_area/ZWC/onlinelog/o1_mf_7_947vw7x5_.log7 rows selected.
SQL> archive log listDatabase log mode              Archive ModeAutomatic archival             EnabledArchive destination            /u01/app/oracle/archOldest online log sequence     16Next log sequence to archive   18Current log sequence           18

tns,listener

[oracle@vmdb12c admin]$ cat tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora# Generated by Oracle configuration tools.ZWC =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = vmdb12c)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = zwc)    )  )zhongwc1 =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = vmdb12c)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = zhongwc1)    )  )zhongwc2 =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = vmdb12c)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = zhongwc2)    )  )standby =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = standby12c)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = standby)    )  )LISTENER_ZWC =  (ADDRESS = (PROTOCOL = TCP)(HOST = vmdb12c)(PORT = 1521))[oracle@vmdb12c admin]$ cat listener.ora # listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora# Generated by Oracle configuration tools.LISTENER =  (DESCRIPTION_LIST =    (DESCRIPTION =      (ADDRESS = (PROTOCOL = TCP)(HOST = vmdb12c)(PORT = 1521))      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))    )  )

scp  file

[oracle@vmdb12c admin]$ scp listener.ora tnsnames.ora oracle@standby12c:$ORACLE_HOME/network/adminoracle@standby12c's password: listener.ora                                                                                      100%  335     0.3KB/s   00:00    tnsnames.ora                                                                                      100%  944     0.9KB/s   00:00    [oracle@vmdb12c admin]$ cd ../../dbs[oracle@vmdb12c dbs]$ scp orapwzwc oracle@standby12c:$ORACLE_HOME/dbs                 oracle@standby12c's password: orapwzwc                                                                                          100% 7680     7.5KB/s   00:00    [oracle@vmdb12c dbs]$ 

on standby

rename pwdfile,create init.ora

[oracle@standby12c dbs]$ mv orapwzwc orapwstandby[oracle@standby12c dbs]$ echo "db_name=zwc" > initstandby.ora

create dir

[oracle@standby12c ~]$ mkdir -p /u01/app/oracle/fast_recovery_area[oracle@standby12c ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/{a,dp}dump[oracle@standby12c ~]$ mkdir -p $ORACLE_BASE/oradata/standby[oracle@standby12c ~]$ mkdir -p $ORACLE_BASE/oradata/standby/pdbseed[oracle@standby12c ~]$ mkdir -p $ORACLE_BASE/oradata/standby/zhongwc1[oracle@standby12c ~]$ mkdir -p $ORACLE_BASE/oradata/standby/zhongwc2

tns,listener

[oracle@standby12c admin]$ cat tnsnames.ora # tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora# Generated by Oracle configuration tools.ZWC =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = vmdb12c)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = zwc)    )  )zhongwc1 =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = vmdb12c)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = zhongwc1)    )  )zhongwc2 =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = vmdb12c)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = zhongwc2)    )  )standby =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = standby12c)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = standby)    )  )LISTENER_ZWC =  (ADDRESS = (PROTOCOL = TCP)(HOST = standby12c)(PORT = 1521))[oracle@standby12c admin]$ cat listener.ora # listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora# Generated by Oracle configuration tools.SID_LIST_LISTENER =  (SID_LIST =    (SID_DESC =      (GLOBAL_DBNAME = standby)      (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)      (SID_NAME = standby)    )  )LISTENER =  (DESCRIPTION_LIST =    (DESCRIPTION =      (ADDRESS = (PROTOCOL = TCP)(HOST = standby12c)(PORT = 1521))    )    (DESCRIPTION =      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))    )  )ADR_BASE_LISTENER = /u01/app/oracle

startup nomount

[oracle@standby12c ~]$ sqlplus / as sysdbaSQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:49:15 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to an idle instance.SQL> startup nomountORACLE instance started.Total System Global Area  217157632 bytesFixed Size                  2286656 bytesVariable Size             159386560 bytesDatabase Buffers           50331648 bytesRedo Buffers                5152768 bytes

on primary
[oracle@vmdb12c ~]$ sqlplus sys/oracle@standby as sysdba   SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:50:39 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> select status from v$instance;STATUS------------------------STARTEDSQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options[oracle@vmdb12c ~]$ sqlplus sys/oracle@zwc as sysdba    SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:50:48 2013Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> select status from v$instance;STATUS------------OPEN

RMAN create standby database

[oracle@vmdb12c ~]$ rmanRecovery Manager: Release 12.1.0.1.0 - Production on Thu Sep 26 17:18:36 2013Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.RMAN> connect target "sysbackup/oracle@zwc as sysbackup"connected to target database: ZWC (DBID=581429757)RMAN> connect auxiliary "sysbackup/oracle@standby as sysbackup"connected to auxiliary database: ZWC (not mounted)RMAN> duplicate target database for standby nofilenamecheck2> from active database3> dorecover4> spfile5> set db_unique_name="standby"set control_files='/u01/app/oracle/oradata/standby/control01.ctl','/u01/app/oracle/oradata/standby/control02.ctl'set log_archive_dest_2='service=zwc async register valid_for=(online_logfile,primary_role) db_unique_name=zwc'set memory_target='0'set audit_file_dest='/u01/app/oracle/admin/standby/adump'10> set fal_client='zwc'11> set fal_server='standby'12> set db_file_name_convert='zwc','standby'13> set log_file_name_convert='zwc','standby'14> set pdb_file_name_convert='zwc','standby'15> set standby_file_management='AUTO';Starting Duplicate Db at 26-SEP-13using target database control file instead of recovery catalogallocated channel: ORA_AUX_DISK_1channel ORA_AUX_DISK_1: SID=20 device type=DISKcurrent log archivedcontents of Memory Script:{   backup as copy reuse   targetfile  '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwzwc' auxiliary format  '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwstandby'   ;   restore clone from service  'zwc' spfile to  '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilestandby.ora';   sql clone "alter system set spfile= ''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilestandby.ora''";}executing Memory ScriptStarting backup at 26-SEP-13allocated channel: ORA_DISK_1channel ORA_DISK_1: SID=66 device type=DISKFinished backup at 26-SEP-13Starting restore at 26-SEP-13using channel ORA_AUX_DISK_1channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: restoring SPFILEoutput file name=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilestandby.orachannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01Finished restore at 26-SEP-13sql statement: alter system set spfile= ''/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilestandby.ora''contents of Memory Script:{   sql clone "alter system set  db_unique_name =  ''standby'' comment= '''' scope=spfile";   sql clone "alter system set  control_files =  ''/u01/app/oracle/oradata/standby/control01.ctl'', ''/u01/app/oracle/oradata/standby/control02.ctl'' comment= '''' scope=spfile";   sql clone "alter system set  log_archive_dest_2 =  ''service=zwc async register valid_for=(online_logfile,primary_role) db_unique_name=zwc'' comment= '''' scope=spfile";   sql clone "alter system set  memory_target =  0 comment= '''' scope=spfile";   sql clone "alter system set  audit_file_dest =  ''/u01/app/oracle/admin/standby/adump'' comment= '''' scope=spfile";   sql clone "alter system set  fal_client =  ''zwc'' comment= '''' scope=spfile";   sql clone "alter system set  fal_server =  ''standby'' comment= '''' scope=spfile";   sql clone "alter system set  db_file_name_convert =  ''zwc'', ''standby'' comment= '''' scope=spfile";   sql clone "alter system set  log_file_name_convert =  ''zwc'', ''standby'' comment= '''' scope=spfile";   sql clone "alter system set  pdb_file_name_convert =  ''zwc'', ''standby'' comment= '''' scope=spfile";   sql clone "alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfile";   shutdown clone immediate;   startup clone nomount;}executing Memory Scriptsql statement: alter system set  db_unique_name =  ''standby'' comment= '''' scope=spfilesql statement: alter system set  control_files =  ''/u01/app/oracle/oradata/standby/control01.ctl'', ''/u01/app/oracle/oradata/standby/control02.ctl'' comment= '''' scope=spfilesql statement: alter system set  log_archive_dest_2 =  ''service=zwc async register valid_for=(online_logfile,primary_role) db_unique_name=zwc'' comment= '''' scope=spfilesql statement: alter system set  memory_target =  0 comment= '''' scope=spfilesql statement: alter system set  audit_file_dest =  ''/u01/app/oracle/admin/standby/adump'' comment= '''' scope=spfilesql statement: alter system set  fal_client =  ''zwc'' comment= '''' scope=spfilesql statement: alter system set  fal_server =  ''standby'' comment= '''' scope=spfilesql statement: alter system set  db_file_name_convert =  ''zwc'', ''standby'' comment= '''' scope=spfilesql statement: alter system set  log_file_name_convert =  ''zwc'', ''standby'' comment= '''' scope=spfilesql statement: alter system set  pdb_file_name_convert =  ''zwc'', ''standby'' comment= '''' scope=spfilesql statement: alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfileOracle instance shut downconnected to auxiliary database (not started)Oracle instance startedTotal System Global Area     321548288 bytesFixed Size                     2287864 bytesVariable Size                264242952 bytesDatabase Buffers              50331648 bytesRedo Buffers                   4685824 bytescontents of Memory Script:{   restore clone from service  'zwc' standby controlfile;}executing Memory ScriptStarting restore at 26-SEP-13allocated channel: ORA_AUX_DISK_1channel ORA_AUX_DISK_1: SID=19 device type=DISKchannel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: restoring control filechannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03output file name=/u01/app/oracle/oradata/standby/control01.ctloutput file name=/u01/app/oracle/oradata/standby/control02.ctlFinished restore at 26-SEP-13contents of Memory Script:{   sql clone 'alter database mount standby database';}executing Memory Scriptsql statement: alter database mount standby databasecontents of Memory Script:{   set newname for tempfile  1 to  "/u01/app/oracle/oradata/standby/temp01.dbf";   set newname for tempfile  2 to  "/u01/app/oracle/oradata/standby/pdbseed/pdbseed_temp01.dbf";   set newname for tempfile  3 to  "/u01/app/oracle/oradata/standby/zhongwc1/temp01.dbf";   set newname for tempfile  4 to  "/u01/app/oracle/oradata/standby/zhongwc2/temp01.dbf";   switch clone tempfile all;   set newname for datafile  1 to  "/u01/app/oracle/oradata/standby/system01.dbf";   set newname for datafile  3 to  "/u01/app/oracle/oradata/standby/sysaux01.dbf";   set newname for datafile  4 to  "/u01/app/oracle/oradata/standby/undotbs01.dbf";   set newname for datafile  5 to  "/u01/app/oracle/oradata/standby/pdbseed/system01.dbf";   set newname for datafile  6 to  "/u01/app/oracle/oradata/standby/users01.dbf";   set newname for datafile  7 to  "/u01/app/oracle/oradata/standby/pdbseed/sysaux01.dbf";   set newname for datafile  8 to  "/u01/app/oracle/oradata/standby/zhongwc1/system01.dbf";   set newname for datafile  9 to  "/u01/app/oracle/oradata/standby/zhongwc1/sysaux01.dbf";   set newname for datafile  10 to  "/u01/app/oracle/oradata/standby/zhongwc1/zhongwc1_users01.dbf";   set newname for datafile  11 to  "/u01/app/oracle/oradata/standby/zhongwc2/system01.dbf";   set newname for datafile  12 to  "/u01/app/oracle/oradata/standby/zhongwc2/sysaux01.dbf";   set newname for datafile  13 to  "/u01/app/oracle/oradata/standby/zhongwc2/zhongwc2_users01.dbf";   set newname for datafile  14 to  "/u01/app/oracle/oradata/standby/zhongwc1/standby01.dbf";   restore   from service  'zwc'   clone database   ;   sql 'alter system archive log current';}executing Memory Scriptexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMErenamed tempfile 1 to /u01/app/oracle/oradata/standby/temp01.dbf in control filerenamed tempfile 2 to /u01/app/oracle/oradata/standby/pdbseed/pdbseed_temp01.dbf in control filerenamed tempfile 3 to /u01/app/oracle/oradata/standby/zhongwc1/temp01.dbf in control filerenamed tempfile 4 to /u01/app/oracle/oradata/standby/zhongwc2/temp01.dbf in control fileexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEStarting restore at 26-SEP-13using channel ORA_AUX_DISK_1channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/standby/system01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/standby/sysaux01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/standby/undotbs01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/standby/pdbseed/system01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/standby/users01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/standby/pdbseed/sysaux01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/standby/zhongwc1/system01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/standby/zhongwc1/sysaux01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/standby/zhongwc1/zhongwc1_users01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/standby/zhongwc2/system01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/standby/zhongwc2/sysaux01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/standby/zhongwc2/zhongwc2_users01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01channel ORA_AUX_DISK_1: starting datafile backup set restorechannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup setchannel ORA_AUX_DISK_1: restoring datafile 00014 to /u01/app/oracle/oradata/standby/zhongwc1/standby01.dbfchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01Finished restore at 26-SEP-13sql statement: alter system archive log currentcurrent log archivedcontents of Memory Script:{   restore clone force from service  'zwc'            archivelog from scn  1983825;   switch clone datafile all;}executing Memory ScriptStarting restore at 26-SEP-13using channel ORA_AUX_DISK_1channel ORA_AUX_DISK_1: starting archived log restore to default destinationchannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: restoring archived logarchived log thread=1 sequence=21channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01channel ORA_AUX_DISK_1: starting archived log restore to default destinationchannel ORA_AUX_DISK_1: using network backup set from service zwcchannel ORA_AUX_DISK_1: restoring archived logarchived log thread=1 sequence=22channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01Finished restore at 26-SEP-13datafile 1 switched to datafile copyinput datafile copy RECID=3 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/system01.dbfdatafile 3 switched to datafile copyinput datafile copy RECID=4 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/sysaux01.dbfdatafile 4 switched to datafile copyinput datafile copy RECID=5 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/undotbs01.dbfdatafile 5 switched to datafile copyinput datafile copy RECID=6 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/pdbseed/system01.dbfdatafile 6 switched to datafile copyinput datafile copy RECID=7 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/users01.dbfdatafile 7 switched to datafile copyinput datafile copy RECID=8 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/pdbseed/sysaux01.dbfdatafile 8 switched to datafile copyinput datafile copy RECID=9 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc1/system01.dbfdatafile 9 switched to datafile copyinput datafile copy RECID=10 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc1/sysaux01.dbfdatafile 10 switched to datafile copyinput datafile copy RECID=11 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc1/zhongwc1_users01.dbfdatafile 11 switched to datafile copyinput datafile copy RECID=12 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc2/system01.dbfdatafile 12 switched to datafile copyinput datafile copy RECID=13 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc2/sysaux01.dbfdatafile 13 switched to datafile copyinput datafile copy RECID=14 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc2/zhongwc2_users01.dbfdatafile 14 switched to datafile copyinput datafile copy RECID=15 STAMP=827169835 file name=/u01/app/oracle/oradata/standby/zhongwc1/standby01.dbfcontents of Memory Script:{   set until scn  1984399;   recover   standby   clone database    delete archivelog   ;}executing Memory Scriptexecuting command: SET until clauseStarting recover at 26-SEP-13using channel ORA_AUX_DISK_1starting media recoveryarchived log for thread 1 with sequence 21 is already on disk as file /u01/app/oracle/arch1_21_825450046.dbfarchived log for thread 1 with sequence 22 is already on disk as file /u01/app/oracle/arch1_22_825450046.dbfarchived log file name=/u01/app/oracle/arch1_21_825450046.dbf thread=1 sequence=21archived log file name=/u01/app/oracle/arch1_22_825450046.dbf thread=1 sequence=22media recovery complete, elapsed time: 00:00:02Finished recover at 26-SEP-13Finished Duplicate Db at 26-SEP-13RMAN> 

SQL> alter system set log_archive_dest_2='service=standby lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=standby';System altered.SQL> alter system set standby_file_management='AUTO';System altered.SQL> alter system set db_file_name_convert='standby','zwc' scope=spfile;System altered.SQL> alter system set log_file_name_convert='standby','zwc' scope=spfile;System altered.SQL> alter system set pdb_file_name_convert='standby','zwc' scope=spfile;System altered.

on standby

SQL> select DATABASE_ROLE,PROTECTION_MODE,open_mode from v$database;DATABASE_ROLE    PROTECTION_MODE      OPEN_MODE---------------- -------------------- --------------------PHYSICAL STANDBY MAXIMUM PERFORMANCE  MOUNTEDSQL> alter database recover managed standby database using current logfile disconnect from session;Database altered.

SQL> alter database recover managed standby database cancel;Database altered.SQL> alter database open;Database altered.SQL> alter database recover managed standby database using current logfile disconnect from session;Database altered.SQL> select DATABASE_ROLE,PROTECTION_MODE,open_mode from v$database;DATABASE_ROLE    PROTECTION_MODE      OPEN_MODE---------------- -------------------- --------------------PHYSICAL STANDBY MAXIMUM PERFORMANCE  READ ONLY WITH APPLYSQL> show pdbs    CON_ID CON_NAME                       OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ----------         2 PDB$SEED                       READ ONLY  NO         3 ZHONGWC1                       READ ONLY  NO         4 ZHONGWC2                       READ ONLY  NO

alert_sid.log

alter database recover managed standby database using current logfile disconnect from sessionThu Sep 26 18:48:32 2013Attempt to start background Managed Standby Recovery process (standby)Starting background process MRP0Thu Sep 26 18:48:32 2013MRP0 started with pid=26, OS id=7565 Thu Sep 26 18:48:32 2013MRP0: Background Managed Standby Recovery process started (standby)Thu Sep 26 18:48:37 2013Serial Media Recovery startedManaged Standby Recovery starting Real Time ApplyThu Sep 26 18:48:37 2013Waiting for all non-current ORLs to be archived...Thu Sep 26 18:48:37 2013All non-current ORLs have been archived.Thu Sep 26 18:48:37 2013Recovery of Online Redo Log: Thread 1 Group 4 Seq 26 Reading mem 0  Mem# 0: /u01/app/oracle/fast_recovery_area/STANDBY/onlinelog/o1_mf_4_947z9kmq_.logCompleted: alter database recover managed standby database using current logfile disconnect from sessionThu Sep 26 18:49:20 2013Using STANDBY_ARCHIVE_DEST parameter default value as /u01/app/oracle/archThu Sep 26 18:49:20 2013RFS[1]: Assigned to RFS process (PID:7575)RFS[1]: Selected log 4 for thread 1 sequence 26 dbid 581429757 branch 825450046Thu Sep 26 18:49:20 2013Archived Log entry 6 added for thread 1 sequence 26 ID 0x22a7c6fd dest 1:Thu Sep 26 18:49:21 2013Media Recovery Waiting for thread 1 sequence 27Thu Sep 26 18:49:23 2013RFS[2]: Assigned to RFS process (PID:7579)RFS[2]: Selected log 4 for thread 1 sequence 27 dbid 581429757 branch 825450046Thu Sep 26 18:49:23 2013Recovery of Online Redo Log: Thread 1 Group 4 Seq 27 Reading mem 0  Mem# 0: /u01/app/oracle/fast_recovery_area/STANDBY/onlinelog/o1_mf_4_947z9kmq_.logThu Sep 26 18:49:23 2013Archived Log entry 7 added for thread 1 sequence 27 ID 0x22a7c6fd dest 1:Thu Sep 26 18:49:24 2013Media Recovery Waiting for thread 1 sequence 28RFS[2]: Selected log 4 for thread 1 sequence 28 dbid 581429757 branch 825450046Thu Sep 26 18:53:36 2013Primary database is in MAXIMUM PERFORMANCE modeRFS[3]: Assigned to RFS process (PID:7640)RFS[3]: Selected log 5 for thread 1 sequence 29 dbid 581429757 branch 825450046Thu Sep 26 18:53:36 2013Archived Log entry 8 added for thread 1 sequence 28 ID 0x22a7c6fd dest 1:Thu Sep 26 18:53:36 2013Media Recovery Log /u01/app/oracle/arch1_28_825450046.dbfMedia Recovery Waiting for thread 1 sequence 29 (in transit)Thu Sep 26 18:53:36 2013Recovery of Online Redo Log: Thread 1 Group 5 Seq 29 Reading mem 0  Mem# 0: /u01/app/oracle/fast_recovery_area/STANDBY/onlinelog/o1_mf_5_947z9lwn_.log


原创粉丝点击