0% found this document useful (0 votes)
142 views7 pages

Dataguard Configuration Document

1) The document describes the steps to configure a physical standby database. It includes installing the database software, enabling archivelog mode, adding standby redo logs, setting initialization parameters, and restoring a backup to establish the standby database. 2) Key steps are enabling archivelog mode and force logging on the primary, creating standby redo logs, copying a password file, and restoring backups to the standby while mounting it read only. 3) The primary will then ship archived redo logs to the standby to maintain synchronization.

Uploaded by

MaheshSai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views7 pages

Dataguard Configuration Document

1) The document describes the steps to configure a physical standby database. It includes installing the database software, enabling archivelog mode, adding standby redo logs, setting initialization parameters, and restoring a backup to establish the standby database. 2) Key steps are enabling archivelog mode and force logging on the primary, creating standby redo logs, copying a password file, and restoring backups to the standby while mounting it read only. 3) The primary will then ship archived redo logs to the standby to maintain synchronization.

Uploaded by

MaheshSai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

STANDBY SETUP

Server Details

SERVER NAME IP ADDR DB_NAME DB_UNIQUE_NAME ROLE


PRIMARYDB 192.168.1.60 Prime Prime PRIMARY
STANDBYDB 192.168.1.61 Prime Stand STANDBY

1) Install and configure 12c database on PRIMARYDB Server.


SID=prime
DB port = 1521
Host= 192.168.1.60
ORACLE_BASE= /d01/app/oracle
ORACLE_HOME= /d01/app/oracle/product/12.2.0/dbhome_1

2) Install 12c Software only on STANDBYDB server


ORACLE_BASE= /d01/app/oracle
ORACLE_HOME= /d01/app/oracle/product/12.2.0/dbhome_1

Enable Archive Log mode on PRIMARY


SQL> archive log list;

$ mkdir -p /d01/app/oracle/product/12.2.0/dbhome_1/dbs/arch

SQL> shut immediate;


SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;

3) Enable Force Logging on PRIMARY

Sqlplus / as sysdba
SQL> select force_logging from v$database;
SQL> alter database force logging;

4) Create STANDBY redo logs in PRIMARY


SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_ CON_ID
---------- ------- ------- ------------------------------------------------------------ --- ----------
3 ONLINE /d01/app/oracle/oradata/prime/redo03.log NO 0
2 ONLINE /d01/app/oracle/oradata/prime/redo02.log NO 0
1 ONLINE /d01/app/oracle/oradata/prime/redo01.log NO 0
3 rows selected.

SQL> select group#, bytes from v$log;

GROUP# BYTES
---------- ----------
1 209715200
2 209715200
3 209715200

SQL> alter database add standby logfile


‘/d01/app/oracle/oradata/prime/stb_redo01.log’ size 209715200;

SQL> alter database add standby logfile


‘/d01/app/oracle/oradata/prime/stb_redo02.log’ size 209715200;

SQL> alter database add standby logfile


‘/d01/app/oracle/oradata/prime/stb_redo03.log’ size 209715200;

SQL> alter database add standby logfile


‘/d01/app/oracle/oradata/prime/stb_redo04.log’ size 209715200;

SQL> select group#, thread#, bytes from v$standby_log;

GROUP# THREAD# BYTES


---------- ---------- ----------
4 0 209715200
5 0 209715200
6 0 209715200
7 0 209715200

SQL> select * from v$logfile;

GROUP# STATUS TYPE MEMBER IS_ CON_ID


---------- ------- ------- -------------------------------------------------- --- ----------
3 ONLINE /d01/app/oracle/oradata/prime/redo03.log NO 0
2 ONLINE /d01/app/oracle/oradata/prime/redo02.log NO 0
1 ONLINE /d01/app/oracle/oradata/prime/redo01.log NO 0
4 STANDBY /d01/app/oracle/oradata/prime/stb_redo01.log NO 0
5 STANDBY /d01/app/oracle/oradata/prime/stb_redo02.log NO 0
6 STANDBY /d01/app/oracle/oradata/prime/stb_redo03.log NO 0
7 STANDBY /d01/app/oracle/oradata/prime/stb_redo04.log NO 0

7 rows selected.

Create Password file


On Primary:
$ cd $ORACLE_HOME/dbs
$ orapwd file=orapwprime password=G01d@1400 force=y entries=32
Now copy this password file to STANDBY Server
Run the command on primary node
$ cd $ORACLE_HOME/dbs
$ scp orapwprime [email protected]:
/d01/app/oracle/product/12.2.0/dbhome_1/dbs/orapwstand

Add TNS Entries


On Primary Node:
$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora

PRIME =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primarydb.local.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prime.local.com)
)
)

STAND =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standbydb.local.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = stand)
)
)

On Standby Node:
$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora

PRIME =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primarydb.vstdec.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prime.vstdec.com)
)
)

STAND =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standbydb.vstdec.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = stand)
)
)
Create Listener.ora on STANDBY
On Standby node:
$ cd $ORACLE_HOME/network/admin
$ vi listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standbydb.vstdec.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

Set init parameters in PRIMARYDB


On PRIMARY NODE:

SQL> create pfile from spfile;

--- log_archive_config parameter enables sending and receiving of archive logs to remote dest
----DG_CONFIG - need to specify the list of db_unique_name of both primary and standby.
SQL> alter system set log_archive_config='DG_CONFIG=(prime,stand)' scope=BOTH;

--- archive destination in local(primary server)


SQL> alter system set
log_archive_dest_1='LOCATION=/d01/app/oracle/product/12.2.0/dbhome_1/dbs/arch
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=prime' scope=BOTH;

---log_archive_dest_2 parameter defines the archive destination of standby


--- ASYNC - This is used for maximum performance mode(DEFAULT) .Means redo logs generated in
primary need not be shipped/applied in standby
SQL> alter system set log_archive_dest_2='SERVICE=stand LGWR ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stand' scope=BOTH;

SQL> alter system set log_archive_dest_state_2='DEFER' scope=BOTH;


SQL> alter system set log_archive_dest_state_1='ENABLE' scope=BOTH;

--- Tns entry name for primary


SQL> alter system set fal_client='prime' scope=BOTH;

--- tns entry name for primary -- i.e It will fetch the archives from standby .
SQL> alter system set fal_server='stand' scope=BOTH;

SQL> alter system set db_name=PRIME scope=both;


SQL> alter system set db_unique_name=PRIME scope=both;
SQL> alter system set remote_login_passwordfile=EXCLUSIVE scope=both;

SQL show parameter db_name


SQL show parameter db_unique_name
SQL> show parameter remote_login_passwordfile
Set Init Parameters on STANDBY
On Standby DB:
Create datafile directory
$ mkdir -p /d01/app/oracle/oradata

Create PFILE:
$ cd /d01/app/oracle/product/12.1.0/dbhome/dbs
$ vi initstand.ora

DB_NAME=prime
DB_UNIQUE_NAME=stand
control_files='/d01/app/oracle/oradata/orcl/control1.ora','/d01/app/oracle/oradata/orcl/control
2.ora','/d01/app/oracle/oradata/orcl/control3.ora'
fal_client='stand'
fal_server='prime'
db_file_name_convert='/d01/app/oracle/oradata/orcl/PRIME/datafile','/d01/app/oracle/oradata'
log_file_name_convert =
'/d01/app/oracle/oradata/orcl/PRIME/onlinelog','/d01/app/oracle/oradata'
log_file_name_convert =
'/d01/app/oracle/fast_recovery_area/prime/PRIME/onlinelog','/d01/app/oracle/oradata'
standby_file_management='AUTO'
log_archive_config='DG_CONFIG=(prime,stand)'
log_archive_dest_1='LOCATION=/d01/app/oracle/archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=stand'
log_archive_dest_2='service=Prime ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=prime'
remote_login_passwordfile=EXCLUSIVE

Take Full backup On PRIMARY


$ mkdir /d01/rman_bkp
$ sqlplus / as sysdba
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> exit;

rman target /
RMAN> spool log to ‘/d01/rman_bkp/db_backup.log’;
RMAN>
RUN
{
ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '/d01/rman_bkp/%U';
ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT '/d01/rman_bkp/%U';
ALLOCATE CHANNEL disk3 DEVICE TYPE DISK FORMAT '/d01/rman_bkp/%U';
ALLOCATE CHANNEL disk4 DEVICE TYPE DISK FORMAT '/d01/rman_bkp/%U';

BACKUP AS COMPRESSED BACKUPSET DATABASE;


BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL;
backup current controlfile format '/d01/rman_bkp/ctl_%U';
RELEASE CHANNEL disk1;
RELEASE CHANNEL disk2;
RELEASE CHANNEL disk3;
RELEASE CHANNEL disk4;
}

Copy this backup to Standby Server

$ scp -r /d01/rman_bkp [email protected]:/d01/

RESTORE DATABASE on STANDBY


On Standby Node:

Start database in nomount mode

Sqlplus / as sysdba
SQL> startup nomount;

Connect to RMAN AUXILIARY


$ rman auxiliary /
RMAN> spool log to /d01/rman_bkp/DR_restore.log;

RMAN> run {
allocate auxiliary channel c1 type disk;
allocate auxiliary channel c2 type disk;
allocate auxiliary channel c3 type disk;
allocate auxiliary channel c4 type disk;

duplicate target database for standby


backup location='/d01/rman_bkp'
pfile= /d01/app/oracle/product/12.2.0/dbhome_1/dbs/initstand.ora
nofilenamecheck;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}

Sqlplus / as sysdba
SQL> select name, db_unique_name, open_mode, database_role from v$database;

NAME DB_UNIQUE_NAME OPEN_MODE DATABASE_ROLE


--------- ------------------------------ -------------------- ----------------
PRIME stand MOUNTED PHYSICAL STANDBY

SQL> create spfile from memory;

Bounce the StandBy database to start with SPFILE;


SQL> shut immediate;
SQL> startup mount;

$ lsnrctl stop
$ lsnrctl start
$ lsnrctl status

Now Enable Log Shipping on PRIMARY and STANDBY


On PRIMARY:
SQL> alter system set log_archive_dest_state_2=ENABLE scope=both;

On STANDBY
SQL> alter system set log_archive_dest_state_2=ENABLE scope=both;

Start MRP on STANDBY


SQL> alter database recover managed standby database disconnect;

Now check Log gap


On Standby
SQL> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received",
APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#)
"Difference" FROM
(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME )
IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#))
ARCH,
(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME )
IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#))
APPL WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;

Now Change log sequence on PRIMARY and check if the log are getting applied on DR or not.

Check MRP & RFS process Status on Standby


SQL> select process, status, sequence# from v$managed_standby;

You might also like