Oracle DataGuard Step by Step Installation with RMAN Duplicate Method -2

Hi,

I will continue to tell you Oracle dataguard configuration and installation in this article.

 

dataguard4

 

 

Read first article before this.

 

6- There are tns addresses of the primary and standby databases in the each database’s tnsnames.ora file, and tnsping should work.

Tnsnames.ora file is located on the linux servers under the $ORACLE_HOME/network/admin directory. Content of tnsnames.ora file is like following in my example.

 

DEVECI =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.10)(PORT = 1521))
)
(CONNECT_DATA = (SERVICE_NAME = DEVECI))
)



DEVECIDG =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.11)(PORT = 1521))
)
(CONNECT_DATA = (SERVICE_NAME = DEVECIDG))
)

 

 

[oracle@MehmetSalih ~]$ tnsping DEVECIDG
[oracle@MehmetSalih ~]$ tnsping DEVECI

 

7- The password file of the primary database is copied to the standby side with the name of standby like following.

 

[oracle@MehmetSalih ~]$ scp orapwDEVECI oracle@192.168.2.11:/oracle/product/12.1.0/db/dbs/orapwDEVECIDG

 

8- Create a folder named adump manually in the standby database. If the database cannot see this file at startup, it gives an error.

[oracle@MehmetSalih ~]$ mkdir $ORACLE_BASE/admin/$ORACLE_SID/adump

 

9- Create a pfile for the Standby database on the Standby server and try to start non-existent database in nomount mode. In the next steps we will duplicate database from Primary.

 

[oracle@MehmetSalih ~]$ vi initDEVECIDG.ora

 

In this step, You can startup oracle database with following 3 parameters in the pfile and add the remaining parameters while executing rman duplicate. I added the following 3 parameters to the pfile and open the Oracle Instance with the nomount mode as follows.

 

*.DB_NAME=DEVECI
*.DB_UNIQUE_NAME=DEVECIDG
*.DB_BLOCK_SIZE=8192

 

After setting bash profile through the server, we are starting Oracle Instance in nomount mode.

[oracle@MehmetSalih ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Sat Jun 12 13:09:39 2013
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to an idle instance.


SQL> startup nomount
ORACLE instance started.
Total System Global Area 659730432 bytes
Fixed Size 2231272 bytes
Variable Size 394265624 bytes
Database Buffers 255852544 bytes
Redo Buffers 7380992 bytes
SQL>

 

10- Finally we start the duplicate with the RMAN tool from Primary database as follows.

[oracle@MehmetSalih ~]$ rman target sys/sys@DEVECI auxiliary sys/sys@DEVECIDG

 

After connecting both sides’ RMAN tool, start duplicate with the following script.

 

RMAN> run{
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'DEVECI','DEVECIDG'
set db_unique_name='DEVECIDG'
set db_file_name_convert='/oracle/DATA/DEVECI/DEVECI','/oracle/DATA/DEVECIDG/DEVECIDG'
set log_file_name_convert='/oracle/DATA/DEVECI/DEVECI','/oracle/DATA/DEVECIDG/DEVECIDG'
set control_files='/oracle/DATA/DEVECIDG/DEVECIDG/control01.ctl'
set log_archive_max_processes='5'
set fal_client='DEVECIDG'
set fal_server='DEVECI'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(DEVECI,DEVECIDG)'
set log_archive_dest_2='service=DEVECI ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=DEVECI';
}

 

The above RMAN Duplicate script will generate too much output, so if you want, you can print it into a log file and review each step. In terms of your comparison, I give the output of the last part below, and if the output is not in this way, you probably have made an error or deficiency.

 

                                       .
                                       .
                                       .

datafile 1 switched to datafile copy
input datafile copy RECID=2 STAMP=837509470 file name=/oracle/data/POCDBFKM/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=3 STAMP=837509470 file name=/oracle/data/POCDBFKM/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=4 STAMP=837509470 file name=/oracle/data/POCDBFKM/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=5 STAMP=837509470 file name=/oracle/data/POCDBFKM/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=6 STAMP=837509470 file name=/oracle/data/POCDBFKM/example01.dbf
Finished Duplicate Db at 12-JUN-14
RMAN>

 

After duplicate,  connect to the Standby database and start the process of the MRP (Managed Recovery Process) and start applying of Redologs to the standby like following.

 

 

[oracle@MehmetSalihDG ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Sat Jun 12 16:57:40 2013
Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
DEVECIDG


SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL>

 

After starting MRP process, we can start monitoring of dataguard like following.

 

Standby 
——————-

[oracle@MehmetSalihDG ~]$  sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Sat Jul 12 17:02:26 2013
Copyright (c) 1982, 2016, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
DEVECIDG


SQL> select switchover_status,database_role from v$database;
SWITCHOVER_STATUS DATABASE_ROLE
-------------------- ----------------
NOT ALLOWED PHYSICAL STANDBY
SQL> 


SQL> select process, client_process,thread#,sequence#,status from v$managed_standby;
PROCESS CLIENT_P THREAD# SEQUENCE# STATUS
--------- -------- ---------- ---------- ------------
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
MRP0 N/A 1 17 WAIT_FOR_LOG
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
PROCESS CLIENT_P THREAD# SEQUENCE# STATUS
--------- -------- ---------- ---------- ------------
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 0 0 CONNECTED
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS LGWR 1 17 IDLE
PROCESS CLIENT_P THREAD# SEQUENCE# STATUS
--------- -------- ---------- ---------- ------------
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS ARCH 0 0 IDLE
28 rows selected.
SQL>

 

Read the following articles for monitoring dataguard in detail.

 

 

 

 

 

You can read other Dataguard installation via RMAN method like following.

 

Mehmet Salih Deveci

I am Founder of IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience. I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource. I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks. I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients. If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress mehmetsalih.deveci@outlook.com. -                                                                                                                                                                                                                                                 - Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  mehmetsalih.deveci@outlook.com a mail atabilirsiniz.