MACHINE1 (PRIMARY)
SQL> alter database force logging;
Database altered.
size should be same
3 Groups for Primary
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/SONY/redo03.log
/u01/app/oracle/oradata/SONY/redo02.log
/u01/app/oracle/oradata/SONY/redo01.log
3 Groups for Standby
SQL> alter database add standby logfile group 4 '/u01/app/oracle/oradata/SONY/redo4.log' size 50m;
Database altered.
SQL> alter database add standby logfile group 5 '/u01/app/oracle/oradata/SONY/redo5.log' size 50m;
Database altered.
SQL> alter database add standby logfile group 6 '/u01/app/oracle/oradata/SONY/redo6.log' size 50m;
Database altered.
SQL>alter system set log_archive_config='DG_CONFIG=(SONY,standdb)' scope=both;
FAILOVER AND SWITCH OVER
SQL>alter system set log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=SONY' scope=both;
SQL>alter system set log_archive_dest_2='SERVICE=standdb LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=standdb' scope=both;
LGWR ASYNC (MAX PERFORMANCE)
LGWR SYNC AFFIRM(MAX PROTECTION)
LGWR SYNC NOAFFIRM (MAX AVAILABILITY)
verify if enable or not, if not you can verify
ALTER SYSTEM SET log_archive_dest_state_1=enable scope=both;
ALTER system set log_archive_dest_state_2=enable scope=both;
alter system set fal_server=standdb scope=both;
alter system set fal_client=SONY scope=both;
--Data file can be added automatically , if manual you datafile needs to add or resize
alter system set standby_file_management=auto scope=both;
all most completed the setup
SQL>create pfile from spfile;
SQL> !
[oracle@machine1 ~]$ cd $ORACLE_HOME/dbs
[oracle@machine1 dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@machine1 dbs]$ ls -lrt
total 44
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
drwx------ 2 oracle oinstall 4096 Nov 23 01:04 peshm_DBUA0_0
drwx------ 2 oracle oinstall 4096 Nov 23 01:05 peshm_orcl11g_0
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:16 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:17 hc_orcl11g.dat
drwx------ 2 oracle oinstall 4096 Dec 17 17:18 peshm_SONY_0
-rw-r----- 1 oracle oinstall 24 Dec 17 17:19 lkSONY
-rw-r----- 1 oracle oinstall 1536 Dec 19 20:24 orapwSONY
-rw-rw---- 1 oracle oinstall 1544 Dec 20 19:00 hc_SONY.dat
-rw-r----- 1 oracle oinstall 3584 Dec 20 19:40 spfileSONY.ora
-rw-r--r-- 1 oracle oinstall 1291 Dec 20 19:57 initSONY.ora
$scpinitSONY.ora oracle@192.168.76.130:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initstanddb.ora
$scp orapwSONY oracle@192.168.75.130:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwstanddb
Go to Machine2
oracle@machine2 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@machine2 dbs]$ ls -lrt
total 40
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
drwx------ 2 oracle oinstall 4096 Nov 23 01:04 peshm_DBUA0_0
drwx------ 2 oracle oinstall 4096 Nov 23 01:05 peshm_orcl11g_0
-rw-r----- 1 oracle oinstall 24 Nov 23 01:06 lkORCL11G
-rw-r----- 1 oracle oinstall 1536 Dec 12 19:15 orapworcl11g
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:27 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:27 hc_orcl11g.dat
-rw-r----- 1 oracle oinstall 2560 Dec 17 22:00 spfileorcl11g.ora
-rw-r----- 1 oracle oinstall 3584 Dec 20 20:07 initstanddb.ora
-rw-r----- 1 oracle oinstall 1536 Dec 20 20:07 orapwstanddb
Open vi.init
vi initstanddb.ora
/**Remove
SONY.__db_cache_size=50331648
SONY.__java_pool_size=4194304
SONY.__large_pool_size=4194304
SONY.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
SONY.__pga_aggregate_target=125829120
SONY.__sga_target=188743680
SONY.__shared_io_pool_size=0
SONY.__shared_pool_size=113246208
SONY.__streams_pool_size=8388608
Remove**/
*.audit_file_dest='/u01/app/oracle/admin/standdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/standdb/control01.ctl','/u01/app/oracle/flash_recovery_area/standdb/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='SONY'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=standdbXDB)'
*.fal_client='SONY'
*.fal_server='STANDDB'
*.log_archive_config='DG_CONFIG=(SONY,standdb)'
*.log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=standdb'
*.log_archive_dest_2='SERVICE=SONY LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=SONY'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=314572800
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.db_unique_name='standdb'
*.db_file_name_convert=('/u01/app/oracle/oradata/SONY','/u01/app/oracle/oradata/standdb')
*.log_file_name_convert=('/u01/app/oracle/oradata/SONY','/u01/app/oracle/oradata/standdb')
create folders in machine2
mkdir -p /u01/app/oracle/admin/standdb/adump
mkdir -p /u01/app/oracle/oradata/standdb
mkdir -p /u01/app/oracle/flash_recovery_area/standdb
mkdir -p /u01/app/oracle/arch
make sure network settings, its has to ping both Services SONY,STANDDB
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.129)(PORT = 1521))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=SONY)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
-----------
SONY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SONY)
)
)
standdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = standdb)
)
)
----------
Ping services of SONY and standdb
tnsping SONY
tnsping standdb
Machine2
[oracle@machine2 dbs]$ export ORACLE_SID=standdb
[oracle@machine2 dbs]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 21 14:32:45 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 313860096 bytes
Fixed Size 1336232 bytes
Variable Size 205524056 bytes
Database Buffers 100663296 bytes
Redo Buffers 6336512 bytes
SQL>exit
$rman target sys/sys123@SONY auxiliary sys/sys123@standdb
[oracle@machine2 admin]$ rman target sys/sys123@SONY auxiliary sys/sys123@standdb
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Dec 21 14:47:43 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: SONY (DBID=3487455235)
connected to auxiliary database: SONY (not mounted)
RMAN>duplicate target database for standby from active database nofilenamecheck;
output file name=/u01/app/oracle/oradata/standdb/sysaux01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/app/oracle/oradata/SONY/test_data01.dbf
output file name=/u01/app/oracle/oradata/standdb/test_data01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/SONY/undotbs01.dbf
output file name=/u01/app/oracle/oradata/standdb/undotbs01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/SONY/users01.dbf
output file name=/u01/app/oracle/oradata/standdb/users01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 21-DEC-14
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/test_data01.dbf
Finished Duplicate Db at 21-DEC-14
RMAN> exit
[oracle@machine2 admin]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 21 15:34:29 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select instance_name,status from v$INSTANCE;
INSTANCE_NAME STATUS
---------------- ------------
standdb MOUNTED
SQL> !ps -ef|grep mrp*
oracle 6137 6123 0 15:35 pts/1 00:00:00 /bin/bash -c ps -ef|grep mrp*
oracle 6139 6137 0 15:35 pts/1 00:00:00 grep mrp*
Needs to start mrp process
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> !ps -ef|grep mrp*
oracle 6154 1 0 15:38 ? 00:00:00 ora_mrp0_standdb
oracle 6169 6123 0 15:38 pts/1 00:00:00 /bin/bash -c ps -ef|grep mrp*
oracle 6171 6169 0 15:38 pts/1 00:00:00 grep mrp*
verify the count on both primary and standby databases
SQL>select SEQUENCE# from v$log_history;
machine1 - primary switch some log files and in both sides
SQL>alter system switch logfile;
machine2
SQL> alter database open read only;
error
stop the mrp
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open read only;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
in standby db verify
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
standdb OPEN
SQL> select name,open_mode,DATABASE_ROLE,protection_mode from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
SONY READ ONLY WITH APPLY PHYSICAL STANDBY
SWITCH OVER TO STANDBY
MACHINE1
SQL> alter database commit to switchover to physical standby;
Database altered.
SQL> shut immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL>startup nomount;
SQL> alter database mount standby database;
Database altered.
MACHINE2
SQL> alter database commit to switchover to primary;
Database altered.
SQL> shut immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL>startup;
MACHINE1
SQL> alter database open read only;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
verify on both databases
select name,open_mode,DATABASE_ROLE,protection_mode from v$database;
SQL> alter database force logging;
Database altered.
size should be same
3 Groups for Primary
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/SONY/redo03.log
/u01/app/oracle/oradata/SONY/redo02.log
/u01/app/oracle/oradata/SONY/redo01.log
3 Groups for Standby
SQL> alter database add standby logfile group 4 '/u01/app/oracle/oradata/SONY/redo4.log' size 50m;
Database altered.
SQL> alter database add standby logfile group 5 '/u01/app/oracle/oradata/SONY/redo5.log' size 50m;
Database altered.
SQL> alter database add standby logfile group 6 '/u01/app/oracle/oradata/SONY/redo6.log' size 50m;
Database altered.
SQL>alter system set log_archive_config='DG_CONFIG=(SONY,standdb)' scope=both;
FAILOVER AND SWITCH OVER
SQL>alter system set log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=SONY' scope=both;
SQL>alter system set log_archive_dest_2='SERVICE=standdb LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=standdb' scope=both;
LGWR ASYNC (MAX PERFORMANCE)
LGWR SYNC AFFIRM(MAX PROTECTION)
LGWR SYNC NOAFFIRM (MAX AVAILABILITY)
verify if enable or not, if not you can verify
ALTER SYSTEM SET log_archive_dest_state_1=enable scope=both;
ALTER system set log_archive_dest_state_2=enable scope=both;
alter system set fal_server=standdb scope=both;
alter system set fal_client=SONY scope=both;
--Data file can be added automatically , if manual you datafile needs to add or resize
alter system set standby_file_management=auto scope=both;
all most completed the setup
SQL>create pfile from spfile;
SQL> !
[oracle@machine1 ~]$ cd $ORACLE_HOME/dbs
[oracle@machine1 dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@machine1 dbs]$ ls -lrt
total 44
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
drwx------ 2 oracle oinstall 4096 Nov 23 01:04 peshm_DBUA0_0
drwx------ 2 oracle oinstall 4096 Nov 23 01:05 peshm_orcl11g_0
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:16 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:17 hc_orcl11g.dat
drwx------ 2 oracle oinstall 4096 Dec 17 17:18 peshm_SONY_0
-rw-r----- 1 oracle oinstall 24 Dec 17 17:19 lkSONY
-rw-r----- 1 oracle oinstall 1536 Dec 19 20:24 orapwSONY
-rw-rw---- 1 oracle oinstall 1544 Dec 20 19:00 hc_SONY.dat
-rw-r----- 1 oracle oinstall 3584 Dec 20 19:40 spfileSONY.ora
-rw-r--r-- 1 oracle oinstall 1291 Dec 20 19:57 initSONY.ora
$scpinitSONY.ora oracle@192.168.76.130:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initstanddb.ora
$scp orapwSONY oracle@192.168.75.130:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwstanddb
Go to Machine2
oracle@machine2 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@machine2 dbs]$ ls -lrt
total 40
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
drwx------ 2 oracle oinstall 4096 Nov 23 01:04 peshm_DBUA0_0
drwx------ 2 oracle oinstall 4096 Nov 23 01:05 peshm_orcl11g_0
-rw-r----- 1 oracle oinstall 24 Nov 23 01:06 lkORCL11G
-rw-r----- 1 oracle oinstall 1536 Dec 12 19:15 orapworcl11g
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:27 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:27 hc_orcl11g.dat
-rw-r----- 1 oracle oinstall 2560 Dec 17 22:00 spfileorcl11g.ora
-rw-r----- 1 oracle oinstall 3584 Dec 20 20:07 initstanddb.ora
-rw-r----- 1 oracle oinstall 1536 Dec 20 20:07 orapwstanddb
Open vi.init
vi initstanddb.ora
/**Remove
SONY.__db_cache_size=50331648
SONY.__java_pool_size=4194304
SONY.__large_pool_size=4194304
SONY.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
SONY.__pga_aggregate_target=125829120
SONY.__sga_target=188743680
SONY.__shared_io_pool_size=0
SONY.__shared_pool_size=113246208
SONY.__streams_pool_size=8388608
Remove**/
*.audit_file_dest='/u01/app/oracle/admin/standdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/standdb/control01.ctl','/u01/app/oracle/flash_recovery_area/standdb/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='SONY'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=standdbXDB)'
*.fal_client='SONY'
*.fal_server='STANDDB'
*.log_archive_config='DG_CONFIG=(SONY,standdb)'
*.log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=standdb'
*.log_archive_dest_2='SERVICE=SONY LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=SONY'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=314572800
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.db_unique_name='standdb'
*.db_file_name_convert=('/u01/app/oracle/oradata/SONY','/u01/app/oracle/oradata/standdb')
*.log_file_name_convert=('/u01/app/oracle/oradata/SONY','/u01/app/oracle/oradata/standdb')
create folders in machine2
mkdir -p /u01/app/oracle/admin/standdb/adump
mkdir -p /u01/app/oracle/oradata/standdb
mkdir -p /u01/app/oracle/flash_recovery_area/standdb
mkdir -p /u01/app/oracle/arch
make sure network settings, its has to ping both Services SONY,STANDDB
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.129)(PORT = 1521))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=SONY)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
-----------
SONY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SONY)
)
)
standdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = standdb)
)
)
----------
Ping services of SONY and standdb
tnsping SONY
tnsping standdb
Machine2
[oracle@machine2 dbs]$ export ORACLE_SID=standdb
[oracle@machine2 dbs]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 21 14:32:45 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 313860096 bytes
Fixed Size 1336232 bytes
Variable Size 205524056 bytes
Database Buffers 100663296 bytes
Redo Buffers 6336512 bytes
SQL>exit
$rman target sys/sys123@SONY auxiliary sys/sys123@standdb
[oracle@machine2 admin]$ rman target sys/sys123@SONY auxiliary sys/sys123@standdb
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Dec 21 14:47:43 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: SONY (DBID=3487455235)
connected to auxiliary database: SONY (not mounted)
RMAN>duplicate target database for standby from active database nofilenamecheck;
output file name=/u01/app/oracle/oradata/standdb/sysaux01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/app/oracle/oradata/SONY/test_data01.dbf
output file name=/u01/app/oracle/oradata/standdb/test_data01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/SONY/undotbs01.dbf
output file name=/u01/app/oracle/oradata/standdb/undotbs01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/SONY/users01.dbf
output file name=/u01/app/oracle/oradata/standdb/users01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 21-DEC-14
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/test_data01.dbf
Finished Duplicate Db at 21-DEC-14
RMAN> exit
[oracle@machine2 admin]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 21 15:34:29 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select instance_name,status from v$INSTANCE;
INSTANCE_NAME STATUS
---------------- ------------
standdb MOUNTED
SQL> !ps -ef|grep mrp*
oracle 6137 6123 0 15:35 pts/1 00:00:00 /bin/bash -c ps -ef|grep mrp*
oracle 6139 6137 0 15:35 pts/1 00:00:00 grep mrp*
Needs to start mrp process
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> !ps -ef|grep mrp*
oracle 6154 1 0 15:38 ? 00:00:00 ora_mrp0_standdb
oracle 6169 6123 0 15:38 pts/1 00:00:00 /bin/bash -c ps -ef|grep mrp*
oracle 6171 6169 0 15:38 pts/1 00:00:00 grep mrp*
verify the count on both primary and standby databases
SQL>select SEQUENCE# from v$log_history;
machine1 - primary switch some log files and in both sides
SQL>alter system switch logfile;
machine2
SQL> alter database open read only;
error
stop the mrp
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open read only;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
in standby db verify
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
standdb OPEN
SQL> select name,open_mode,DATABASE_ROLE,protection_mode from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
SONY READ ONLY WITH APPLY PHYSICAL STANDBY
SWITCH OVER TO STANDBY
MACHINE1
SQL> alter database commit to switchover to physical standby;
Database altered.
SQL> shut immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL>startup nomount;
SQL> alter database mount standby database;
Database altered.
MACHINE2
SQL> alter database commit to switchover to primary;
Database altered.
SQL> shut immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL>startup;
MACHINE1
SQL> alter database open read only;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
verify on both databases
select name,open_mode,DATABASE_ROLE,protection_mode from v$database;
No comments:
Post a Comment