Tag Archives: create physical standby database using backup

Create Physical Standby using RMAN Backup with Duplicate Command

How to Create Physical Standby Database using RMAN Backup With Duplicate Command

Table of Contents

___________________________________________________________________________________________________

0. Introduction
1. Environment

On Primary (Step 2 to Step 12)

2. Enable Forced Logging on Primary
3. Check Password File on Primary
4. Configure a Standby Redo Log on Primary
5. Verify Archive Mode Enabled on Primary
6. Set Primary Database Initialization Parameters
7. Backup Primary Database for configure Standby
8. Transfer PASSWORD FILE TO STANDBY SIDE
9. Transfer Backup from Primary to Standby
10. Transfer pfile from primary to standby
11. Configure TNS for Primary
12. Verify connection ‘AS SYSDBA’ from Primary

On STANDBY (Step 13 to Step 21)

13. Configure TNS for STANDBY
14. Configure init parameter for STANDBY
15. Add oratab entry
16. Create required directories
17. Startup Nomount
18. Verify connection ‘AS SYSDBA’ from Standby
19. Run RMAN Duplicate for standby
20. Verify Standby redo logs
21. Enable MRP on STANDBY

22. Verify Sync
23. Verify ..Lets Test
________________________________________________________________________________________________


0. Introduction

PLEASE NOTE in 12c Data Guard is set up at the Container level and not the individual Pluggable database level as the redo log files only belong to the Container database and the individual pluggable databases do not have their own online redo log files.

Definition of Active Dataguard:

Oracle Active Data Guard enables read-only access to a physical standby database for queries, sorting, reporting, web-based access, etc., while continuously applying changes received from the production/primary database.

Goal : How to Create Physical Standby Database using RMAN Backup With Duplicate Command


1. Environment

Primary:

	Platform	: Linuxx86_64
	Server Name	: RAC1.RAJASEKHAR.COM, IP: 192.168.2.101
	DB Version	: Oracle 12.2.0.1
	File system     : Normal
	Database Name	: UOIN1CON
        DB_UNIQUE_NAME  : UOIN1CON
	Flashback	: Disabled
	Oracle Home Path: /u01/app/oracle/product/12.2.0.1
		
Standby:
		
	Platform	: Linuxx86_64
	Server Name	: RAC2.RAJASEKHAR.COM, IP: 192.168.2.102
	DB Version	: Oracle 12.2.0.1
	File system     : Normal
	Database Name	: UOIN1CON
        DB_UNIQUE_NAME  : UOIN1CON_DG
        Flashback	: Disabled
	Oracle Home Path: /u01/app/oracle/product/12.2.0.1

On Primary (Step 2 to Step 12)


2. Enable Forced Logging on Primary

SQL> select name, open_mode,cdb from v$database;

NAME      OPEN_MODE            CDB
--------- -------------------- ---
UOIN1CON  READ WRITE           NO

SQL> select force_logging from v$database;

FORCE_LOGGING
---------------------------------------
NO

SQL> ALTER DATABASE FORCE LOGGING;

Database altered.

SQL> select force_logging from v$database;

FORCE_LOGGING
---------------------------------------
YES <-----

SQL>


3. Check Password File on Primary

[oracle@rac1 dbs]$ pwd
/u01/app/oracle/product/12.2.0.1/dbs
[oracle@rac1 dbs]$ ls -ltr orapwUOIN1CON
-rw-r-----. 1 oracle dba 3584 Dec 14 12:26 orapwUOIN1CON
[oracle@rac1 dbs]$


4. Configure a Standby Redo Log on Primary

-- Since we have 3 online redo log file groups, we need to create 4(3+1) Standby redo log file groups
-- Standy Redo logs files come into picture only when protection mode is Maximum Availability and Maximum Protection.

SQL> set lines 180
SQL> col MEMBER for a60
SQL> select b.thread#, a.group#, a.member, b.bytes FROM v$logfile a, v$log b WHERE a.group# = b.group#;

   THREAD#     GROUP# MEMBER                                                            BYTES
---------- ---------- ------------------------------------------------------------ ----------
         1          3 /u02/oracle/oradata/UOIN1CON/redo03.log                       209715200
         1          2 /u02/oracle/oradata/UOIN1CON/redo02.log                       209715200
         1          1 /u02/oracle/oradata/UOIN1CON/redo01.log                       209715200

SQL>

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/u02/oracle/oradata/UOIN1CON/redo04.log') SIZE 200M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/u02/oracle/oradata/UOIN1CON/redo05.log') SIZE 200M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/u02/oracle/oradata/UOIN1CON/redo06.log') SIZE 200M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/u02/oracle/oradata/UOIN1CON/redo07.log') SIZE 200M;

Database altered.

SQL>

SQL> select * from v$logfile;

    GROUP# STATUS  TYPE    MEMBER                                                       IS_     CON_ID
---------- ------- ------- ------------------------------------------------------------ --- ----------
         3         ONLINE  /u02/oracle/oradata/UOIN1CON/redo03.log                      NO           0
         2         ONLINE  /u02/oracle/oradata/UOIN1CON/redo02.log                      NO           0
         1         ONLINE  /u02/oracle/oradata/UOIN1CON/redo01.log                      NO           0
         4         STANDBY /u02/oracle/oradata/UOIN1CON/redo04.log                      NO           0
         5         STANDBY /u02/oracle/oradata/UOIN1CON/redo05.log                      NO           0
         6         STANDBY /u02/oracle/oradata/UOIN1CON/redo06.log                      NO           0
         7         STANDBY /u02/oracle/oradata/UOIN1CON/redo07.log                      NO           0

7 rows selected.

SQL>

SQL> select a.group#, a.member, b.bytes FROM v$logfile a, v$standby_log b WHERE a.group# = b.group#;

    GROUP# MEMBER                                                            BYTES
---------- ------------------------------------------------------------ ----------
         4 /u02/oracle/oradata/UOIN1CON/redo04.log                       209715200
         5 /u02/oracle/oradata/UOIN1CON/redo05.log                       209715200
         6 /u02/oracle/oradata/UOIN1CON/redo06.log                       209715200
         7 /u02/oracle/oradata/UOIN1CON/redo07.log                       209715200

SQL>


5. Verify Archive Mode Enabled on Primary

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u02/oracle/archive/UOIN1CON
Oldest online log sequence     3
Next log sequence to archive   5
Current log sequence           5
SQL>


6. Set Primary Database Initialization Parameters

SQL> alter system set db_unique_name='UOIN1CON' scope=spfile;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(UOIN1CON,UOIN1CON_DG)' scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/u02/oracle/archive/UOIN1CON VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=UOIN1CON' scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=UOIN1CON_DG LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=UOIN1CON_DG' scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.dbf' SCOPE=SPFILE;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=30 scope=both;

System altered.

SQL> ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;

System altered.

SQL> ALTER SYSTEM SET fal_client=UOIN1CON scope=both;

System altered.

SQL>

Please note: The FAL_CLIENT database initialization parameter is no longer required from 11gR2

SQL> ALTER SYSTEM SET fal_server=UOIN1CON_DG scope=both;

System altered.

SQL> ALTER SYSTEM SET DB_FILE_NAME_CONVERT='/u02/oracle/oradata/UOIN1CON_DG','/u02/oracle/oradata/UOIN1CON' SCOPE=SPFILE;

System altered.

SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='/u02/oracle/oradata/UOIN1CON_DG','/u02/oracle/oradata/UOIN1CON' SCOPE=SPFILE;

System altered.

SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

System altered.

SQL>
SQL> create pfile='/home/oracle/initUOIN1CON_after.ora' from spfile;

File created.

SQL> 

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

[oracle@rac1 ~]$ cat /home/oracle/initUOIN1CON_after.ora

UOIN1CON.__data_transfer_cache_size=0
UOIN1CON.__db_cache_size=369098752
UOIN1CON.__inmemory_ext_roarea=0
UOIN1CON.__inmemory_ext_rwarea=0
UOIN1CON.__java_pool_size=16777216
UOIN1CON.__large_pool_size=33554432
UOIN1CON.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
UOIN1CON.__pga_aggregate_target=587202560
UOIN1CON.__sga_target=687865856
UOIN1CON.__shared_io_pool_size=33554432
UOIN1CON.__shared_pool_size=218103808
UOIN1CON.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/UOIN1CON/adump'
*.audit_trail='db'
*.compatible='12.2.0'
*.control_files='/u02/oracle/oradata/UOIN1CON/control01.ctl','/u02/oracle/oradata/UOIN1CON/control02.ctl'
*.db_block_size=8192
*.db_file_name_convert='/u02/oracle/oradata/UOIN1CON_DG','/u02/oracle/oradata/UOIN1CON'
*.db_name='UOIN1CON'
*.db_unique_name='UOIN1CON'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=UOIN1CONXDB)'
*.fal_client='UOIN1CON'
*.fal_server='UOIN1CON_DG'
*.log_archive_config='DG_CONFIG=(UOIN1CON,UOIN1CON_DG)'
*.log_archive_dest_1='LOCATION=/u02/oracle/archive/UOIN1CON VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=UOIN1CON'
*.log_archive_dest_2='SERVICE=UOIN1CON_DG LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=UOIN1CON_DG'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_archive_max_processes=30
*.log_file_name_convert='/u02/oracle/oradata/UOIN1CON_DG','/u02/oracle/oradata/UOIN1CON'
*.memory_target=1201m
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'

[oracle@rac1 ~]$


7. Backup Primary Database for configure Standby

[oracle@rac1 ~]$ mkdir -p /u02/oracle/backup/UOIN1CON

[oracle@rac1 ~]$ mkdir -p /u02/oracle/backup/UOIN1CON
[oracle@rac1 ~]$
[oracle@rac1 ~]$ cd /u02/oracle/backup/UOIN1CON
[oracle@rac1 UOIN1CON]$ vi BACKUP_UOIN1CON.sh
[oracle@rac1 UOIN1CON]$ chmod 775 BACKUP_UOIN1CON.sh
[oracle@rac1 UOIN1CON]$

[oracle@rac1 UOIN1CON]$ cat BACKUP_UOIN1CON.sh
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.2.0.1
BACKUP_LOG_PATH=/u02/oracle/backup/UOIN1CON
export ORACLE_BASE
export ORACLE_HOME
export ORACLE_SID=UOIN1CON
export BACKUP_LOG_PATH
LOG_FILE=${BACKUP_LOG_PATH}/BACKUP_UOIN1CON.log
$ORACLE_HOME/bin/rman msglog=${LOG_FILE} << EOF 
connect target / 
run { 
allocate channel t1 type disk; 
allocate channel t2 type disk; 
allocate channel t3 type disk; 
backup database format '/u02/oracle/backup/UOIN1CON/database_%d_%u_%s'; release channel t1; 
release channel t2; 
release channel t3; 
} 
sql 'alter system archive log current'; 
run { 
allocate channel a1 type disk; 
allocate channel a2 type disk; 
allocate channel a3 type disk; 
backup archivelog all format '/u02/oracle/backup/UOIN1CON/arch_%d_%u_%s'; release channel a1; 
release channel a2; 
release channel a3; 
} 
run { 
allocate channel c1 type disk; 
backup current controlfile format '/u02/oracle/backup/UOIN1CON/Control_%d_%u_%s'; 
release channel c1; 
} 
exit; 
EOF 
[oracle@rac1 UOIN1CON]$
[oracle@rac1 UOIN1CON]$ 
[oracle@rac1 UOIN1CON]$ nohup ./BACKUP_UOIN1CON.sh & 
[1] 6484 
[oracle@rac1 UOIN1CON]$ nohup: ignoring input and appending output to `nohup.out' 
[oracle@rac1 UOIN1CON]$ jobs -l 
[1]+ 6484 Running        nohup ./BACKUP_UOIN1CON.sh & 
[oracle@rac1 UOIN1CON]$ 
[oracle@rac1 UOIN1CON]$ jobs -l 
[1]+ 6484 Done          nohup ./BACKUP_UOIN1CON.sh 
[oracle@rac1 UOIN1CON]$ 
[oracle@rac1 UOIN1CON]$ ls -ltr
total 1614284
-rwxrwxr-x. 1 oracle dba       982 Jan  3 16:44 rmanbackup.sh
-rwxrwxr-x. 1 oracle dba       976 Jan  4 05:45 BACKUP_UOIN1CON.sh
-rw-r-----. 1 oracle dba   6463488 Jan  5 17:13 database_UOIN1CON_19tmj2i0_41
-rw-r-----. 1 oracle dba 435650560 Jan  5 17:13 database_UOIN1CON_18tmj2i0_40
-rw-r-----. 1 oracle dba 726351872 Jan  5 17:14 database_UOIN1CON_17tmj2i0_39
-rw-r-----. 1 oracle dba 112978944 Jan  5 17:14 arch_UOIN1CON_1dtmj2ja_45
-rw-r-----. 1 oracle dba 125304832 Jan  5 17:14 arch_UOIN1CON_1ctmj2ja_44
-rw-r-----. 1 oracle dba 229672448 Jan  5 17:14 arch_UOIN1CON_1btmj2j9_43
-rw-r-----. 1 oracle dba   5603328 Jan  5 17:14 arch_UOIN1CON_1etmj2jh_46
-rw-r-----. 1 oracle dba  10960896 Jan  5 17:14 Control_UOIN1CON_1gtmj2jk_48
-rw-------. 1 oracle dba        96 Jan  5 17:14 nohup.out
-rw-r--r--. 1 oracle dba      7792 Jan  5 17:14 BACKUP_UOIN1CON.log
[oracle@rac1 UOIN1CON]$
[oracle@rac1 UOIN1CON]$
 [oracle@rac1 UOIN1CON]$ cat BACKUP_UOIN1CON.log 
Recovery Manager: Release 12.2.0.1.0 - Production on Sat Jan 5 17:13:34 2019 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. 
RMAN>
connected to target database: UOIN1CON (DBID=1821803680)

RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
using target database control file instead of recovery catalog
allocated channel: t1
channel t1: SID=24 device type=DISK

allocated channel: t2
channel t2: SID=91 device type=DISK

allocated channel: t3
channel t3: SID=95 device type=DISK

Starting backup at 05-JAN-19
channel t1: starting full datafile backup set
channel t1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u02/oracle/oradata/UOIN1CON/system01.dbf
channel t1: starting piece 1 at 05-JAN-19
channel t2: starting full datafile backup set
channel t2: specifying datafile(s) in backup set
input datafile file number=00003 name=/u02/oracle/oradata/UOIN1CON/sysaux01.dbf
input datafile file number=00007 name=/u02/oracle/oradata/UOIN1CON/users01.dbf
channel t2: starting piece 1 at 05-JAN-19
channel t3: starting full datafile backup set
channel t3: specifying datafile(s) in backup set
input datafile file number=00005 name=/u02/oracle/oradata/UOIN1CON/oggdata01.dbf
input datafile file number=00004 name=/u02/oracle/oradata/UOIN1CON/undotbs01.dbf
channel t3: starting piece 1 at 05-JAN-19
channel t3: finished piece 1 at 05-JAN-19
piece handle=/u02/oracle/backup/UOIN1CON/database_UOIN1CON_19tmj2i0_41 tag=TAG20190105T171336 comment=NONE
channel t3: backup set complete, elapsed time: 00:00:03
channel t2: finished piece 1 at 05-JAN-19
piece handle=/u02/oracle/backup/UOIN1CON/database_UOIN1CON_18tmj2i0_40 tag=TAG20190105T171336 comment=NONE
channel t2: backup set complete, elapsed time: 00:00:26
channel t1: finished piece 1 at 05-JAN-19
piece handle=/u02/oracle/backup/UOIN1CON/database_UOIN1CON_17tmj2i0_39 tag=TAG20190105T171336 comment=NONE
channel t1: backup set complete, elapsed time: 00:00:36
Finished backup at 05-JAN-19

Starting Control File and SPFILE Autobackup at 05-JAN-19
piece handle=/u01/app/oracle/product/12.2.0.1/dbs/c-1821803680-20190105-02 comment=NONE
Finished Control File and SPFILE Autobackup at 05-JAN-19

released channel: t1

released channel: t2

released channel: t3

RMAN>
sql statement: alter system archive log current

RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
allocated channel: a1
channel a1: SID=24 device type=DISK

allocated channel: a2
channel a2: SID=91 device type=DISK

allocated channel: a3
channel a3: SID=95 device type=DISK

Starting backup at 05-JAN-19
current log archived
channel a1: starting archived log backup set
channel a1: specifying archived log(s) in backup set
input archived log thread=1 sequence=34 RECID=82 STAMP=996611417
input archived log thread=1 sequence=35 RECID=84 STAMP=996643337
input archived log thread=1 sequence=36 RECID=86 STAMP=996643513
input archived log thread=1 sequence=37 RECID=88 STAMP=996643795
input archived log thread=1 sequence=38 RECID=89 STAMP=996644743
input archived log thread=1 sequence=39 RECID=90 STAMP=996644744
input archived log thread=1 sequence=40 RECID=91 STAMP=996732232
input archived log thread=1 sequence=41 RECID=92 STAMP=996741858
channel a1: starting piece 1 at 05-JAN-19
channel a2: starting archived log backup set
channel a2: specifying archived log(s) in backup set
input archived log thread=1 sequence=4 RECID=4 STAMP=996595104
input archived log thread=1 sequence=5 RECID=5 STAMP=996596970
input archived log thread=1 sequence=6 RECID=6 STAMP=996596978
input archived log thread=1 sequence=7 RECID=7 STAMP=996597993
input archived log thread=1 sequence=8 RECID=8 STAMP=996597994
input archived log thread=1 sequence=9 RECID=9 STAMP=996604700
input archived log thread=1 sequence=10 RECID=11 STAMP=996607158
input archived log thread=1 sequence=11 RECID=14 STAMP=996607712
input archived log thread=1 sequence=12 RECID=15 STAMP=996608268
input archived log thread=1 sequence=13 RECID=16 STAMP=996608271
input archived log thread=1 sequence=14 RECID=17 STAMP=996608830
input archived log thread=1 sequence=15 RECID=18 STAMP=996608951
input archived log thread=1 sequence=16 RECID=19 STAMP=996609021
input archived log thread=1 sequence=17 RECID=21 STAMP=996609054
input archived log thread=1 sequence=18 RECID=23 STAMP=996609176
channel a2: starting piece 1 at 05-JAN-19
channel a3: starting archived log backup set
channel a3: specifying archived log(s) in backup set
input archived log thread=1 sequence=42 RECID=93 STAMP=996769488
input archived log thread=1 sequence=43 RECID=94 STAMP=996772311
input archived log thread=1 sequence=44 RECID=95 STAMP=996772312
input archived log thread=1 sequence=45 RECID=96 STAMP=996772455
input archived log thread=1 sequence=46 RECID=97 STAMP=996772457
channel a3: starting piece 1 at 05-JAN-19
channel a1: finished piece 1 at 05-JAN-19
piece handle=/u02/oracle/backup/UOIN1CON/arch_UOIN1CON_1btmj2j9_43 tag=TAG20190105T171417 comment=NONE
channel a1: backup set complete, elapsed time: 00:00:08
channel a1: starting archived log backup set
channel a1: specifying archived log(s) in backup set
input archived log thread=1 sequence=19 RECID=26 STAMP=996609431
input archived log thread=1 sequence=20 RECID=36 STAMP=996609626
input archived log thread=1 sequence=21 RECID=38 STAMP=996609630
input archived log thread=1 sequence=22 RECID=41 STAMP=996609971
input archived log thread=1 sequence=23 RECID=42 STAMP=996610043
input archived log thread=1 sequence=24 RECID=43 STAMP=996610157
input archived log thread=1 sequence=25 RECID=44 STAMP=996610213
input archived log thread=1 sequence=26 RECID=46 STAMP=996610243
input archived log thread=1 sequence=27 RECID=48 STAMP=996611311
input archived log thread=1 sequence=28 RECID=70 STAMP=996611319
input archived log thread=1 sequence=29 RECID=72 STAMP=996611321
input archived log thread=1 sequence=30 RECID=74 STAMP=996611322
input archived log thread=1 sequence=31 RECID=76 STAMP=996611323
input archived log thread=1 sequence=32 RECID=78 STAMP=996611345
input archived log thread=1 sequence=33 RECID=80 STAMP=996611346
channel a1: starting piece 1 at 05-JAN-19
channel a2: finished piece 1 at 05-JAN-19
piece handle=/u02/oracle/backup/UOIN1CON/arch_UOIN1CON_1ctmj2ja_44 tag=TAG20190105T171417 comment=NONE
channel a2: backup set complete, elapsed time: 00:00:07
channel a3: finished piece 1 at 05-JAN-19
piece handle=/u02/oracle/backup/UOIN1CON/arch_UOIN1CON_1dtmj2ja_45 tag=TAG20190105T171417 comment=NONE
channel a3: backup set complete, elapsed time: 00:00:07
channel a1: finished piece 1 at 05-JAN-19
piece handle=/u02/oracle/backup/UOIN1CON/arch_UOIN1CON_1etmj2jh_46 tag=TAG20190105T171417 comment=NONE
channel a1: backup set complete, elapsed time: 00:00:01
Finished backup at 05-JAN-19

Starting Control File and SPFILE Autobackup at 05-JAN-19
piece handle=/u01/app/oracle/product/12.2.0.1/dbs/c-1821803680-20190105-03 comment=NONE
Finished Control File and SPFILE Autobackup at 05-JAN-19

released channel: a1

released channel: a2

released channel: a3

RMAN> 2> 3> 4> 5>
allocated channel: c1
channel c1: SID=24 device type=DISK

Starting backup at 05-JAN-19
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 05-JAN-19
channel c1: finished piece 1 at 05-JAN-19
piece handle=/u02/oracle/backup/UOIN1CON/Control_UOIN1CON_1gtmj2jk_48 tag=TAG20190105T171428 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 05-JAN-19

Starting Control File and SPFILE Autobackup at 05-JAN-19
piece handle=/u01/app/oracle/product/12.2.0.1/dbs/c-1821803680-20190105-04 comment=NONE
Finished Control File and SPFILE Autobackup at 05-JAN-19

released channel: c1

RMAN>

Recovery Manager complete.
[oracle@rac1 UOIN1CON]$



8. Transfer PASSWORD FILE TO STANDBY SIDE

-- Copy the password file from the primary to standby $ORACLE_HOME/dbs and rename it to the standby database name.
-- The username is required to be SYS and the password needs to be the same on the Primary and Standby.
-- The best practice for this is to copy the passwordfile as suggested.
-- The password file name must match the instance name/SID used at the standby site, not the DB_NAME.

[oracle@rac1 UOIN1CON]$ cd /u01/app/oracle/product/12.2.0.1/dbs/
[oracle@rac1 dbs]$ ls -ltr orapwUOIN1CON
-rw-r-----. 1 oracle dba 3584 Dec 14 12:26 orapwUOIN1CON
[oracle@rac1 dbs]$
[oracle@rac1 dbs]$ scp orapwUOIN1CON oracle@rac2:/u01/app/oracle/product/12.2.0.1/dbs/orapwUOIN1CON_DG
oracle@rac2's password:
orapwUOIN1CON                       100% 3584     3.5KB/s   00:00
[oracle@rac1 dbs]$


9. Transfer Backup from Primary to Standby

[oracle@rac1 UOIN1CON]$ scp database_UOIN1CON* oracle@rac2:/u02/oracle/backup/UOIN1CON_DG/
oracle@rac2's password:
database_UOIN1CON_17tmj2i0_39            100%  693MB  53.3MB/s   00:13
database_UOIN1CON_18tmj2i0_40            100%  415MB  59.4MB/s   00:07
database_UOIN1CON_19tmj2i0_41            100% 6312KB   6.2MB/s   00:00
[oracle@rac1 UOIN1CON]$
[oracle@rac1 UOIN1CON]$ scp Control_UOIN1CON* oracle@rac2:/u02/oracle/backup/UOIN1CON_DG/
oracle@rac2's password:
Control_UOIN1CON_1gtmj2jk_48             100%   10MB  10.5MB/s   00:00
[oracle@rac1 UOIN1CON]$
[oracle@rac1 UOIN1CON]$ scp arch_UOIN1CON* oracle@rac2:/u02/oracle/backup/UOIN1CON_DG/
oracle@rac2's password:
arch_UOIN1CON_1btmj2j9_43                100%  219MB  73.0MB/s   00:03
arch_UOIN1CON_1ctmj2ja_44                100%  120MB  59.8MB/s   00:02
arch_UOIN1CON_1dtmj2ja_45                100%  108MB  53.9MB/s   00:02
arch_UOIN1CON_1etmj2jh_46                100% 5472KB   5.3MB/s   00:00
[oracle@rac1 UOIN1CON]$


10. Transfer pfile from primary to standby

[oracle@rac1 ~]$ scp initUOIN1CON_after.ora oracle@rac2:/u02/oracle/backup/UOIN1CON_DG/
oracle@rac2's password:
initUOIN1CON_after.ora                                100% 1780     1.7KB/s   00:00
[oracle@rac1 ~]$


11. Configure TNS for Primary

[oracle@rac1 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0.1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER_12C =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = UOIN1CON)
      (ORACLE_HOME = /u01/app/oracle/product/12.2.0.1)
      (SID_NAME = UOIN1CON)
    )
  )

LISTENER_12C =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.rajasekhar.com)(PORT = 1621))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1621))
    )
  )

ADR_BASE_LISTENER_12C = /u01/app/oracle

[oracle@rac1 admin]$

[oracle@rac1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0.1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

UOIN1CON_DG =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.102)(PORT = 1621))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = UOIN1CON_DG)
    )
  )

UOIN1CON =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.rajasekhar.com)(PORT = 1621))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = UOIN1CON)
    )
  )

LISTENER_12C =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.101)(PORT = 1621))

[oracle@rac1 admin]$

[oracle@rac1 admin]$ lsnrctl status LISTENER_12C

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 03-JAN-2019 18:19:39

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1.rajasekhar.com)(PORT=1621)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_12C
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                03-JAN-2019 17:18:26
Uptime                    0 days 1 hr. 1 min. 13 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0.1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac1/listener_12c/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.rajasekhar.com)(PORT=1621)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1621)))
Services Summary...
Service "UOIN1CON" has 1 instance(s).
  Instance "UOIN1CON", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac1 admin]$


12. Verify connection ‘AS SYSDBA’ from Primary

[oracle@rac1 ~]$ sqlplus SYS/SYS@UOIN1CON AS SYSDBA

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jan 5 17:58:18 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>

On STANDBY (Step 12 to Step 21)


13. Configure TNS for STANDBY

[oracle@rac2 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0.1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER_12C =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = UOIN1CON_DG)
      (ORACLE_HOME = /u01/app/oracle/product/12.2.0.1)
      (SID_NAME = UOIN1CON_DG)
    )
  )

LISTENER_12C =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.rajasekhar.com)(PORT = 1621))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1621))
    )
  )

ADR_BASE_LISTENER_12C = /u01/app/oracle

[oracle@rac2 admin]$

[oracle@rac2 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0.1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

UOIN1CON_DG =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.102)(PORT = 1621))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = UOIN1CON_DG)
    )
  )

UOIN1CON =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.101)(PORT = 1621))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = UOIN1CON)
    )
  )

LISTENER_12C =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.102)(PORT = 1621))

[oracle@rac2 admin]$

[oracle@rac2 admin]$ lsnrctl status LISTENER_12C

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 03-JAN-2019 18:14:00

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac2.rajasekhar.com)(PORT=1621)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_12C
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                03-JAN-2019 18:01:29
Uptime                    0 days 0 hr. 12 min. 30 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0.1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac2/listener_12c/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac2.rajasekhar.com)(PORT=1621)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1621)))
Services Summary...
Service "UOIN1CON_DG" has 1 instance(s).
  Instance "UOIN1CON_DG", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac2 admin]$


14. Configure init parameter for STANDBY

Modify initUOIN1CON_after.ora and renamed to initUOIN1CON_DG.ora

[oracle@rac2 UOIN1CON_DG]$ cat initUOIN1CON_DG.ora

UOIN1CON_DG.__data_transfer_cache_size=0
UOIN1CON_DG.__db_cache_size=369098752
UOIN1CON_DG.__inmemory_ext_roarea=0
UOIN1CON_DG.__inmemory_ext_rwarea=0
UOIN1CON_DG.__java_pool_size=16777216
UOIN1CON_DG.__large_pool_size=33554432
UOIN1CON_DG.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
UOIN1CON_DG.__pga_aggregate_target=587202560
UOIN1CON_DG.__sga_target=687865856
UOIN1CON_DG.__shared_io_pool_size=33554432
UOIN1CON_DG.__shared_pool_size=218103808
UOIN1CON_DG.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/UOIN1CON_DG/adump'
*.audit_trail='db'
*.compatible='12.2.0'
*.control_files='/u02/oracle/oradata/UOIN1CON_DG/control01.ctl','/u02/oracle/oradata/UOIN1CON_DG/control02.ctl'
*.db_block_size=8192
*.db_file_name_convert='/u02/oracle/oradata/UOIN1CON','/u02/oracle/oradata/UOIN1CON_DG'
*.db_name='UOIN1CON'
*.db_unique_name='UOIN1CON_DG'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=UOIN1CON_DGXDB)'
*.fal_client='UOIN1CON_DG'
*.fal_server='UOIN1CON'
*.log_archive_config='DG_CONFIG=(UOIN1CON,UOIN1CON_DG)'
*.log_archive_dest_1='LOCATION=/u02/oracle/archive/UOIN1CON_DG VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=UOIN1CON_DG'
*.log_archive_dest_2='SERVICE=UOIN1CON LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=UOIN1CON'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_archive_max_processes=30
*.log_file_name_convert='/u02/oracle/oradata/UOIN1CON','/u02/oracle/oradata/UOIN1CON_DG'
*.memory_target=1201m
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'

[oracle@rac2 UOIN1CON_DG]$


15. Add oratab entry

[oracle@rac2 ~]$ cat /etc/oratab | grep -i UOIN1CON_DG
UOIN1CON_DG:/u01/app/oracle/product/12.2.0.1:N
[oracle@rac2 ~]$


16. Create required directories

[oracle@rac2 ~]$ mkdir -p /u01/app/oracle/admin/UOIN1CON_DG/adump
[oracle@rac2 ~]$ mkdir -p /u02/oracle/oradata/UOIN1CON_DG
[oracle@rac2 ~]$ mkdir -p /u02/oracle/archive/UOIN1CON_DG
[oracle@rac2 ~]$


17. Startup Nomount

[oracle@rac2 ~]$ . oraenv
ORACLE_SID = [UOIN1CON_DG] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jan 5 18:01:38 2019

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

Connected to an idle instance.

SQL> startup nomount pfile='/u02/oracle/backup/UOIN1CON_DG/initUOIN1CON_DG.ora';
ORACLE instance started.

Total System Global Area 1275068416 bytes
Fixed Size                  8620272 bytes
Variable Size             939525904 bytes
Database Buffers          318767104 bytes
Redo Buffers                8155136 bytes
SQL>
SQL> create spfile from pfile='/u02/oracle/backup/UOIN1CON_DG/initUOIN1CON_DG.ora';

File created.

SQL> shut immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL>
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1275068416 bytes
Fixed Size                  8620272 bytes
Variable Size             939525904 bytes
Database Buffers          318767104 bytes
Redo Buffers                8155136 bytes
SQL>


18. Verify connection ‘AS SYSDBA’ from Standby

[oracle@rac2 ~]$ sqlplus SYS/SYS@UOIN1CON_DG AS SYSDBA

SQL*Plus: Release 12.2.0.1.0 Production on Sat Jan 5 18:18:57 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL>


19. Run RMAN Duplicate for standby

[oracle@rac2 ~]$ cd /u02/oracle/backup/UOIN1CON_DG/
[oracle@rac2 UOIN1CON_DG]$ ls -ltr
total 1614280
-rw-r--r--. 1 oracle dba      1780 Jan  3 17:06 initUOIN1CON_after.ora
-rwxrwxr-x. 1 oracle dba       503 Jan  3 19:05 restore_db.sh
-rw-r--r--. 1 oracle dba      1757 Jan  4 06:38 initUOIN1CON_DG.ora.bkp
-rw-r--r--. 1 oracle dba      1757 Jan  4 06:57 initUOIN1CON_DG.ora
-rwxrwxr-x. 1 oracle dba       670 Jan  5 17:39 duplicate_UOIN1CON_DG.sh
-rw-r-----. 1 oracle dba 726351872 Jan  5 17:43 database_UOIN1CON_17tmj2i0_39
-rw-r-----. 1 oracle dba 435650560 Jan  5 17:43 database_UOIN1CON_18tmj2i0_40
-rw-r-----. 1 oracle dba   6463488 Jan  5 17:43 database_UOIN1CON_19tmj2i0_41
-rw-r-----. 1 oracle dba  10960896 Jan  5 17:43 Control_UOIN1CON_1gtmj2jk_48
-rw-r-----. 1 oracle dba 229672448 Jan  5 17:44 arch_UOIN1CON_1btmj2j9_43
-rw-r-----. 1 oracle dba 125304832 Jan  5 17:44 arch_UOIN1CON_1ctmj2ja_44
-rw-r-----. 1 oracle dba 112978944 Jan  5 17:44 arch_UOIN1CON_1dtmj2ja_45
-rw-r-----. 1 oracle dba   5603328 Jan  5 17:44 arch_UOIN1CON_1etmj2jh_46
[oracle@rac2 UOIN1CON_DG]$

[oracle@rac2 UOIN1CON_DG]$ cat duplicate_UOIN1CON_DG.sh
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.2.0.1
BACKUP_LOG_PATH=/u02/oracle/backup/UOIN1CON_DG
export ORACLE_BASE
export ORACLE_HOME
export ORACLE_SID=UOIN1CON_DG
export BACKUP_LOG_PATH
LOG_FILE=${BACKUP_LOG_PATH}/duplicate_UOIN1CON_DG_NEW.log
/u01/app/oracle/product/12.2.0.1/bin/rman msglog=${LOG_FILE} << EOF
connect auxiliary /
run {
allocate auxiliary channel t1 type disk;
allocate auxiliary channel t2 type disk;
allocate auxiliary channel t3 type disk;
SET NEWNAME FOR DATABASE   TO  '/u02/oracle/oradata/UOIN1CON_DG/%b';
duplicate target database for standby backup location '/u02/oracle/backup/UOIN1CON_DG' nofilenamecheck;
}
exit
EOF
[oracle@rac2 UOIN1CON_DG]$
[oracle@rac2 UOIN1CON_DG]$ chmod 775 duplicate_UOIN1CON_DG.sh
[oracle@rac2 UOIN1CON_DG]$ nohup ./duplicate_UOIN1CON_DG.sh &
[1] 8951
[oracle@rac2 UOIN1CON_DG]$ nohup: ignoring input and appending output to `nohup.out'

[oracle@rac2 UOIN1CON_DG]$ jobs -l
[1]+  8951 Running                 nohup ./duplicate_UOIN1CON_DG.sh &
[oracle@rac2 UOIN1CON_DG]$
[oracle@rac2 UOIN1CON_DG]$ jobs -l
[1]+  Done                    nohup ./duplicate_UOIN1CON_DG.sh
[oracle@rac2 UOIN1CON_DG]$ 

[oracle@rac2 UOIN1CON_DG]$ cat duplicate_UOIN1CON_DG_NEW.log
Recovery Manager: Release 12.2.0.1.0 - Production on Sat Jan 5 18:25:40 2019

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

RMAN>
connected to auxiliary database: UOIN1CON (not mounted)

RMAN> 2> 3> 4> 5> 6> 7>
allocated channel: t1
channel t1: SID=35 device type=DISK

allocated channel: t2
channel t2: SID=36 device type=DISK

allocated channel: t3
channel t3: SID=37 device type=DISK

executing command: SET NEWNAME

Starting Duplicate Db at 05-JAN-19

contents of Memory Script:
{
   restore clone standby controlfile from  '/u02/oracle/backup/UOIN1CON_DG/Control_UOIN1CON_1gtmj2jk_48';
}
executing Memory Script

Starting restore at 05-JAN-19

channel t2: skipped, AUTOBACKUP already found
channel t3: skipped, AUTOBACKUP already found
channel t1: restoring control file
channel t1: restore complete, elapsed time: 00:00:08
output file name=/u02/oracle/oradata/UOIN1CON_DG/control01.ctl
output file name=/u02/oracle/oradata/UOIN1CON_DG/control02.ctl
Finished restore at 05-JAN-19

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
 "/u02/oracle/oradata/UOIN1CON_DG/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/u02/oracle/oradata/UOIN1CON_DG/system01.dbf";
   set newname for datafile  3 to
 "/u02/oracle/oradata/UOIN1CON_DG/sysaux01.dbf";
   set newname for datafile  4 to
 "/u02/oracle/oradata/UOIN1CON_DG/undotbs01.dbf";
   set newname for datafile  5 to
 "/u02/oracle/oradata/UOIN1CON_DG/oggdata01.dbf";
   set newname for datafile  7 to
 "/u02/oracle/oradata/UOIN1CON_DG/users01.dbf";
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u02/oracle/oradata/UOIN1CON_DG/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

Starting restore at 05-JAN-19

channel t1: starting datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
channel t1: restoring datafile 00001 to /u02/oracle/oradata/UOIN1CON_DG/system01.dbf
channel t1: reading from backup piece /u02/oracle/backup/UOIN1CON_DG/database_UOIN1CON_17tmj2i0_39
channel t2: starting datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
channel t2: restoring datafile 00003 to /u02/oracle/oradata/UOIN1CON_DG/sysaux01.dbf
channel t2: restoring datafile 00007 to /u02/oracle/oradata/UOIN1CON_DG/users01.dbf
channel t2: reading from backup piece /u02/oracle/backup/UOIN1CON_DG/database_UOIN1CON_18tmj2i0_40
channel t3: starting datafile backup set restore
channel t3: specifying datafile(s) to restore from backup set
channel t3: restoring datafile 00004 to /u02/oracle/oradata/UOIN1CON_DG/undotbs01.dbf
channel t3: restoring datafile 00005 to /u02/oracle/oradata/UOIN1CON_DG/oggdata01.dbf
channel t3: reading from backup piece /u02/oracle/backup/UOIN1CON_DG/database_UOIN1CON_19tmj2i0_41
channel t3: piece handle=/u02/oracle/backup/UOIN1CON_DG/database_UOIN1CON_19tmj2i0_41 tag=TAG20190105T171336
channel t3: restored backup piece 1
channel t3: restore complete, elapsed time: 00:00:07
channel t2: piece handle=/u02/oracle/backup/UOIN1CON_DG/database_UOIN1CON_18tmj2i0_40 tag=TAG20190105T171336
channel t2: restored backup piece 1
channel t2: restore complete, elapsed time: 00:00:15
channel t1: piece handle=/u02/oracle/backup/UOIN1CON_DG/database_UOIN1CON_17tmj2i0_39 tag=TAG20190105T171336
channel t1: restored backup piece 1
channel t1: restore complete, elapsed time: 00:00:25
Finished restore at 05-JAN-19

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=996776783 file name=/u02/oracle/oradata/UOIN1CON_DG/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=996776783 file name=/u02/oracle/oradata/UOIN1CON_DG/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=996776783 file name=/u02/oracle/oradata/UOIN1CON_DG/undotbs01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=996776783 file name=/u02/oracle/oradata/UOIN1CON_DG/oggdata01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=5 STAMP=996776783 file name=/u02/oracle/oradata/UOIN1CON_DG/users01.dbf
Finished Duplicate Db at 05-JAN-19
released channel: t1
released channel: t2
released channel: t3

RMAN>

Recovery Manager complete.
[oracle@rac2 UOIN1CON_DG]$


20. Verify Standby redo logs

SQL> set lines 190
SQL> SELECT NAME,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;

NAME      OPEN_MODE            DB_UNIQUE_NAME                 DATABASE_ROLE    PROTECTION_MODE
--------- -------------------- ------------------------------ ---------------- --------------------
UOIN1CON  MOUNTED              UOIN1CON_DG                    PHYSICAL STANDBY MAXIMUM PERFORMANCE

SQL>
SQL> col member for a50
SQL> select * from v$logfile;

    GROUP# STATUS  TYPE    MEMBER                                             IS_     CON_ID
---------- ------- ------- -------------------------------------------------- --- ----------
         3         ONLINE  /u02/oracle/oradata/UOIN1CON_DG/redo03.log         NO           0
         2         ONLINE  /u02/oracle/oradata/UOIN1CON_DG/redo02.log         NO           0
         1         ONLINE  /u02/oracle/oradata/UOIN1CON_DG/redo01.log         NO           0
         4         STANDBY /u02/oracle/oradata/UOIN1CON_DG/redo04.log         NO           0
         5         STANDBY /u02/oracle/oradata/UOIN1CON_DG/redo05.log         NO           0
         6         STANDBY /u02/oracle/oradata/UOIN1CON_DG/redo06.log         NO           0
         7         STANDBY /u02/oracle/oradata/UOIN1CON_DG/redo07.log         NO           0

7 rows selected.

SQL> select a.group#, a.member, b.bytes FROM v$logfile a, v$standby_log b WHERE a.group# = b.group#;

    GROUP# MEMBER                                                  BYTES
---------- -------------------------------------------------- ----------
         4 /u02/oracle/oradata/UOIN1CON_DG/redo04.log          209715200
         5 /u02/oracle/oradata/UOIN1CON_DG/redo05.log          209715200
         6 /u02/oracle/oradata/UOIN1CON_DG/redo06.log          209715200
         7 /u02/oracle/oradata/UOIN1CON_DG/redo07.log          209715200

SQL>


21. Enable MRP on STANDBY

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

SQL> /
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active <---- This means Standby database configured properly.


SQL>


22. Verify Sync

On Primary

SQL> select name, open_mode, database_role, INSTANCE_NAME from v$database,v$instance;

NAME      OPEN_MODE            DATABASE_ROLE    INSTANCE_NAME
--------- -------------------- ---------------- ----------------
UOIN1CON  READ WRITE           PRIMARY          UOIN1CON

SQL> select max(sequence#) from v$archived_log where archived='YES';

MAX(SEQUENCE#)
--------------
            47 <-----

SQL>

On STANDBY

SQL> select name, open_mode, database_role, INSTANCE_NAME from v$database,v$instance;

NAME      OPEN_MODE            DATABASE_ROLE    INSTANCE_NAME
--------- -------------------- ---------------- ----------------
UOIN1CON  MOUNTED              PHYSICAL STANDBY UOIN1CON_DG

SQL> select max(sequence#) from v$archived_log where applied='YES';

MAX(SEQUENCE#)
--------------
            47 <-----

SQL>


23. Verify ..Lets Test

On Primary

SQL> set lines 180
SQL> SELECT NAME,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;

NAME      OPEN_MODE            DB_UNIQUE_NAME                 DATABASE_ROLE    PROTECTION_MODE
--------- -------------------- ------------------------------ ---------------- --------------------
UOIN1CON  READ WRITE           UOIN1CON                       PRIMARY          MAXIMUM PERFORMANCE

SQL> CREATE TABLE TEST_DG (A NUMBER);

Table created.

SQL> INSERT INTO TEST_DG VALUES (1);

1 row created.

SQL> COMMIT;

Commit complete.

SQL> SELECT COUNT(*) FROM TEST_DG;

  COUNT(*)
----------
         1 <-------

SQL> ALTER SYSTEM SWITCH LOGFILE;

System altered.

SQL>

On Standby

SQL> SELECT NAME,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;

NAME      OPEN_MODE            DB_UNIQUE_NAME                 DATABASE_ROLE    PROTECTION_MODE
--------- -------------------- ------------------------------ ---------------- --------------------
UOIN1CON  MOUNTED              UOIN1CON_DG                    PHYSICAL STANDBY MAXIMUM PERFORMANCE

SQL>

SQL> alter database recover managed standby database cancel;

Database altered.

SQL>
SQL> alter database open;

Database altered.

SQL> SELECT NAME,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;

NAME      OPEN_MODE            DB_UNIQUE_NAME                 DATABASE_ROLE    PROTECTION_MODE
--------- -------------------- ------------------------------ ---------------- --------------------
UOIN1CON  READ ONLY            UOIN1CON_DG                    PHYSICAL STANDBY MAXIMUM PERFORMANCE

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

SQL> /
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active


SQL> SELECT NAME,OPEN_MODE,DB_UNIQUE_NAME,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;

NAME      OPEN_MODE            DB_UNIQUE_NAME                 DATABASE_ROLE    PROTECTION_MODE
--------- -------------------- ------------------------------ ---------------- --------------------
UOIN1CON  READ ONLY WITH APPLY UOIN1CON_DG                    PHYSICAL STANDBY MAXIMUM PERFORMANCE

SQL> SELECT COUNT(*) FROM TEST_DG;

  COUNT(*)
----------
         1 <----

SQL>

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
WhatsApp : +
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/