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

时间:2023-03-08 19:22:07

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 sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:12:10 2013

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> col username for a10
SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS SYSBA SYSDG SYSKM CON_ID
---------- ----- ----- ----- ----- ----- ----- ----------
SYS TRUE TRUE FALSE FALSE FALSE FALSE 0
SYSDG FALSE FALSE FALSE FALSE TRUE FALSE 1
SYSBACKUP FALSE FALSE FALSE TRUE FALSE FALSE 1
SYSKM FALSE FALSE FALSE FALSE FALSE TRUE 1 SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@vmdb12c ~]$ sqlplus sys/oracle@zwc as sysdg SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:12:20 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. ERROR:
ORA-01031: insufficient privileges Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied SP2-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 sysbackup SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:12:37 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. ERROR:
ORA-01031: insufficient privileges Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied SP2-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 2013

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> col username for a10
SQL> select username,account_status from dba_users where username in('SYSBACKUP','SYSDG','SYS'); USERNAME ACCOUNT_STATUS
---------- --------------------------------
SYSDG EXPIRED & LOCKED
SYSBACKUP EXPIRED & LOCKED
SYS OPEN SQL> 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 OPEN
SYSBACKUP OPEN
SYSDG OPEN SQL>

retry

[oracle@vmdb12c ~]$ sqlplus sysbackup/oracle@zwc as sysbackup

SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:53:42 2013

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> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With 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 2013 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> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@vmdb12c ~]$

create pdb tablespace,user

[oracle@vmdb12c ~]$ sqlplus sys/oracle@zhongwc1 as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:20:45 2013

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> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 ZHONGWC1 READ WRITE NO
SQL> 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.dbf SQL> create user zwc identified by zwc default tablespace zwc; User created. SQL> grant dba to zwc; Grant succeeded. SQL> conn zwc/zwc@zhongwc2
ERROR:
ORA-01017: invalid username/password; logon denied Warning: You are no longer connected to ORACLE.
SQL> conn zwc/zwc@zwc
ERROR:
ORA-01017: invalid username/password; logon denied SQL> conn zwc/zwc@zhongwc1
Connected.
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(*)
----------
100 SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 ZHONGWC1 READ WRITE NO
SQL>

create standby logfile

[oracle@vmdb12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:24:11 2013

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> show con_name CON_NAME
------------------------------
CDB$ROOT
SQL> 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 50 SQL> 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 50 SQL> select group#,bytes/1024/1024 "size M" from v$standby_log; GROUP# size M
---------- ----------
4 50
5 50
6 50
7 50 SQL> 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_.log 7 rows selected.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/arch
Oldest online log sequence 16
Next log sequence to archive 18
Current 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/admin
oracle@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 sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 26 16:49:15 2013

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started. Total System Global Area 217157632 bytes
Fixed Size 2286656 bytes
Variable Size 159386560 bytes
Database Buffers 50331648 bytes
Redo 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 2013

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
------------------------
STARTED SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With 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 2013 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
------------
OPEN

RMAN create standby database

[oracle@vmdb12c ~]$ rman

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Sep 26 17:18:36 2013

Copyright (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 nofilenamecheck
2> from active database
3> dorecover
4> spfile
5> 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-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
current log archived contents 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 Script Starting backup at 26-SEP-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=66 device type=DISK
Finished backup at 26-SEP-13 Starting restore at 26-SEP-13
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 zwc
channel ORA_AUX_DISK_1: restoring SPFILE
output file name=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/spfilestandby.ora
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 26-SEP-13 sql 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 Script sql statement: alter system set db_unique_name = ''standby'' comment= '''' scope=spfile sql statement: alter system set control_files = ''/u01/app/oracle/oradata/standby/control01.ctl'', ''/u01/app/oracle/oradata/standby/control02.ctl'' comment= '''' scope=spfile sql statement: 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 statement: alter system set memory_target = 0 comment= '''' scope=spfile sql statement: alter system set audit_file_dest = ''/u01/app/oracle/admin/standby/adump'' comment= '''' scope=spfile sql statement: alter system set fal_client = ''zwc'' comment= '''' scope=spfile sql statement: alter system set fal_server = ''standby'' comment= '''' scope=spfile sql statement: alter system set db_file_name_convert = ''zwc'', ''standby'' comment= '''' scope=spfile sql statement: alter system set log_file_name_convert = ''zwc'', ''standby'' comment= '''' scope=spfile sql statement: alter system set pdb_file_name_convert = ''zwc'', ''standby'' comment= '''' scope=spfile sql statement: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile Oracle instance shut down connected to auxiliary database (not started)
Oracle instance started Total System Global Area 321548288 bytes Fixed Size 2287864 bytes
Variable Size 264242952 bytes
Database Buffers 50331648 bytes
Redo Buffers 4685824 bytes contents of Memory Script:
{
restore clone from service 'zwc' standby controlfile;
}
executing Memory Script Starting restore at 26-SEP-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service zwc
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/standby/control01.ctl
output file name=/u01/app/oracle/oradata/standby/control02.ctl
Finished restore at 26-SEP-13 contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script sql statement: alter database mount standby database contents 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 Script executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME renamed tempfile 1 to /u01/app/oracle/oradata/standby/temp01.dbf in control file
renamed tempfile 2 to /u01/app/oracle/oradata/standby/pdbseed/pdbseed_temp01.dbf in control file
renamed tempfile 3 to /u01/app/oracle/oradata/standby/zhongwc1/temp01.dbf in control file
renamed tempfile 4 to /u01/app/oracle/oradata/standby/zhongwc2/temp01.dbf 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 executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 26-SEP-13
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 zwc
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/standby/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service zwc
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/standby/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service zwc
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/standby/undotbs01.dbf
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 zwc
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/standby/pdbseed/system01.dbf
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 zwc
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/standby/users01.dbf
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 zwc
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/standby/pdbseed/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service zwc
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/standby/zhongwc1/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service zwc
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/standby/zhongwc1/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service zwc
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/standby/zhongwc1/zhongwc1_users01.dbf
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 zwc
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/standby/zhongwc2/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service zwc
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/standby/zhongwc2/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service zwc
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00013 to /u01/app/oracle/oradata/standby/zhongwc2/zhongwc2_users01.dbf
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 zwc
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00014 to /u01/app/oracle/oradata/standby/zhongwc1/standby01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 26-SEP-13 sql statement: alter system archive log current
current log archived contents of Memory Script:
{
restore clone force from service 'zwc'
archivelog from scn 1983825;
switch clone datafile all;
}
executing Memory Script Starting restore at 26-SEP-13
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 zwc
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=21
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 zwc
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=22
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 26-SEP-13 datafile 1 switched to datafile copy
input datafile copy RECID=3 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=4 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=6 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/pdbseed/system01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=7 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/users01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=8 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/pdbseed/sysaux01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=9 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc1/system01.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=10 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc1/sysaux01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=11 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc1/zhongwc1_users01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=12 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc2/system01.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=13 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc2/sysaux01.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=14 STAMP=827169834 file name=/u01/app/oracle/oradata/standby/zhongwc2/zhongwc2_users01.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=15 STAMP=827169835 file name=/u01/app/oracle/oradata/standby/zhongwc1/standby01.dbf contents of Memory Script:
{
set until scn 1984399;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script executing command: SET until clause Starting recover at 26-SEP-13
using channel ORA_AUX_DISK_1 starting media recovery archived log for thread 1 with sequence 21 is already on disk as file /u01/app/oracle/arch1_21_825450046.dbf
archived log for thread 1 with sequence 22 is already on disk as file /u01/app/oracle/arch1_22_825450046.dbf
archived log file name=/u01/app/oracle/arch1_21_825450046.dbf thread=1 sequence=21
archived log file name=/u01/app/oracle/arch1_22_825450046.dbf thread=1 sequence=22
media recovery complete, elapsed time: 00:00:02
Finished recover at 26-SEP-13
Finished Duplicate Db at 26-SEP-13 RMAN>
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 MOUNTED SQL> 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 APPLY SQL> 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 session
Thu Sep 26 18:48:32 2013
Attempt to start background Managed Standby Recovery process (standby)
Starting background process MRP0
Thu Sep 26 18:48:32 2013
MRP0 started with pid=26, OS id=7565
Thu Sep 26 18:48:32 2013
MRP0: Background Managed Standby Recovery process started (standby)
Thu Sep 26 18:48:37 2013
Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Thu Sep 26 18:48:37 2013
Waiting for all non-current ORLs to be archived...
Thu Sep 26 18:48:37 2013
All non-current ORLs have been archived.
Thu Sep 26 18:48:37 2013
Recovery 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_.log
Completed: alter database recover managed standby database using current logfile disconnect from session
Thu Sep 26 18:49:20 2013
Using STANDBY_ARCHIVE_DEST parameter default value as /u01/app/oracle/arch
Thu Sep 26 18:49:20 2013
RFS[1]: Assigned to RFS process (PID:7575)
RFS[1]: Selected log 4 for thread 1 sequence 26 dbid 581429757 branch 825450046
Thu Sep 26 18:49:20 2013
Archived Log entry 6 added for thread 1 sequence 26 ID 0x22a7c6fd dest 1:
Thu Sep 26 18:49:21 2013
Media Recovery Waiting for thread 1 sequence 27
Thu Sep 26 18:49:23 2013
RFS[2]: Assigned to RFS process (PID:7579)
RFS[2]: Selected log 4 for thread 1 sequence 27 dbid 581429757 branch 825450046
Thu Sep 26 18:49:23 2013
Recovery 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_.log
Thu Sep 26 18:49:23 2013
Archived Log entry 7 added for thread 1 sequence 27 ID 0x22a7c6fd dest 1:
Thu Sep 26 18:49:24 2013
Media Recovery Waiting for thread 1 sequence 28
RFS[2]: Selected log 4 for thread 1 sequence 28 dbid 581429757 branch 825450046
Thu Sep 26 18:53:36 2013
Primary database is in MAXIMUM PERFORMANCE mode
RFS[3]: Assigned to RFS process (PID:7640)
RFS[3]: Selected log 5 for thread 1 sequence 29 dbid 581429757 branch 825450046
Thu Sep 26 18:53:36 2013
Archived Log entry 8 added for thread 1 sequence 28 ID 0x22a7c6fd dest 1:
Thu Sep 26 18:53:36 2013
Media Recovery Log /u01/app/oracle/arch1_28_825450046.dbf
Media Recovery Waiting for thread 1 sequence 29 (in transit)
Thu Sep 26 18:53:36 2013
Recovery 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