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

Oracle 11g Data Guard Configurations by Sajid Hussain

The document describes the steps to configure Oracle 11g Data Guard between two Linux servers. 1. Install the Oracle database software and create a primary database on the first server. 2. Configure standby redo logs and archive logging on the primary database. 3. Copy the primary database files to the second server and register the standby database with the listener. 4. Modify the initialization files to configure log archive destinations and enable the standby database to receive archived redo logs.

Uploaded by

Khan Bahi
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)
199 views7 pages

Oracle 11g Data Guard Configurations by Sajid Hussain

The document describes the steps to configure Oracle 11g Data Guard between two Linux servers. 1. Install the Oracle database software and create a primary database on the first server. 2. Configure standby redo logs and archive logging on the primary database. 3. Copy the primary database files to the second server and register the standby database with the listener. 4. Modify the initialization files to configure log archive destinations and enable the standby database to receive archived redo logs.

Uploaded by

Khan Bahi
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

Oracle 11g Data Guard Configurations - Step by Step on Linux 6.

3
-------------------------------------------------------

Two Machines:

1st Machine IP: 192.168.1.10 hostname: server1.oracle.com

2nd Machine IP: 192.168.1.20 hostname: server2.oracle.com

Steps below mention:


1- Install Oracle Database Software on Both Machines.

2- Create Database {DG1} on Primary Machine.

3- Create Pfile from Spfile

SQL> create pfile from spfile.

SQL> shutdown immediate;

4- Change parameters in pfile (Primary)

[oracle@server1 ~]$ cd $ORACLE_HOME/dbs

[oracle@server1 ~]$ mv initdg1.ora initprimary.ora

[oracle@server1 ~]$ vi initprimary.ora

Add below mention parameters in pfile…..

###########################################

#Data Guard Parameter

###########################################

*.dispathers='(protocol=TCP) (service=primary_DGMGRL)'

DB_UNIQUE_NAME='PRIMARY'

FAL_CLIENT='primary'

FAL_SERVER='standby'

LOG_ARCHIVE_CONFIG='DG_CONFIG=(primary,standby)'

LOG_ARCHIVE_DEST_1='LOCATION=use_db_recovery_file_dest

VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=primary'

LOG_ARCHIVE_DEST_2='SERVICE=standby

VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=standby'

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

service_names='dg1'

STANDBY_FILE_MANAGEMENT='AUTO'

5- Create password file.

[oracle@server1 dbs]$ orapwd file=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwprimary password=oracle


force=y ignorecase=y

6- Now restart the primary database to mount stage....

[oracle@server1 ~]$ export ORACLE_SID=primary

SQL startup mount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initprimary.ora;

7- On Archivelog, force logging and flashback on.....

SQL> alter database archivelog;

SQL> alter database force Logging;

SQL> alter database flashback on;

8- Create standby redologs on primary databse with formula {Total Existing +1}.

SQL> alter database add standby logfile '/u01/app/oracle/oradata/dg1/Stdredo1.LOG' size 50m;

SQL> alter database add standby logfile '/u01/app/oracle/oradata/dg1/Stdredo2.LOG' size 50m;

SQL> alter database add standby logfile '/u01/app/oracle/oradata/dg1/Stdredo3.LOG' size 50m;

SQL> alter database add standby logfile '/u01/app/oracle/oradata/dg1/Stdredo4.LOG' size 50m;

9- Shutdown Primary database. [Done]

10- Create required directories on standby server


[root@server2 ~]# mkdir -p /u01/app/oracle/admin/dg1/adump

[root@server2 ~]# mkdir -p /u01/app/oracle/admin/dg1/dpdump

[root@server2 ~]# mkdir -p /u01/app/oracle/admin/dg1/pfile

[root@server2 ~]# mkdir -p /u01/app/oracle/oradata/dg1/

[root@server2 ~]# mkdir -p /u01/app/oracle/fast_recovery_area/dg1

[root@server2 ~]# mkdir -p /u01/app/oracle/fast_recovery_area/DG1

[root@server2 ~]# chown -R oracle:oinstall /u01/app/oracle/fast_recovery_area/

[root@server2 ~]# chown -R oracle:oinstall /u01/app/oracle/oradata/

[root@server2 ~]# chown -R oracle:oinstall /u01/

[root@server2 ~]# chmod -R 777 /u01/app/oracle/fast_recovery_area/

[root@server2 ~]# chmod -R 777 /u01/app/oracle/oradata/

[root@server2 ~]# chmod -R 777 /u01/

11- Copy all datafiles,redologs, standby redologs from Primary (Server1} to Standby {Server2} on same location;

[oracle@server1 ~]$ scp /u01/app/oracle/oradata/dg1/*.* [email protected]:/u01/app/oracle/oradata/dg1/

12- Mount primary database ..

SQL> startup mount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initprimary.ora;

13- Create standby Controlfile.

SQL> alter database create standby controlfile as '/u01/app/oracle/control.ctl';

SQL> create spfile from pfile;

SQL> shutdown immediate;

SQL> startup;

14.Copy control file to standby database on both location oradata & fast_recovery_area and rename.
Server1:

[oracle@server1 ~]$ scp /u01/app/oracle/control.ctl [email protected]:/u01/app/oracle/oradata/dg1/

[oracle@server1 ~]$ scp /u01/app/oracle/control.ctl [email protected]:/u01/app/oracle/fast_recovery_area/dg1/

Server2:

[oracle@server2 ~]$ mv /u01/app/oracle/oradata/dg1/control.ctl /u01/app/oracle/oradata/dg1/control01.ctl

[oracle@server2 ~]$ mv /u01/app/oracle/fast_recovery_area/dg1/control.ctl


/u01/app/oracle/fast_recovery_area/dg1/control02.ctl

15. Register Primary Database with Listener

Global Database name: primary_DGMGRL

SID: primary

Start listener

16. Now copy initprimary.ora file to any location on standby server

and rename it to initstandby.ora

Server1:

[oracle@server1 ~]$ scp /u01/app/oracle/product/11.2.0/db_1/dbs/initprimary.ora


[email protected]:/u01/app/oracle/product/11.2.0/db_1/dbs/

Server2:

[oracle@server2 ~]$ mv /u01/app/oracle/product/11.2.0/db_1/dbs/initprimary.ora


/u01/app/oracle/product/11.2.0/db_1/dbs/initstandby.ora

17. Change parameters in pfile (standby)

Edit initstandby.ora file and add below mention changes ....

[oracle@server2 ~]$ vi /u01/app/oracle/product/11.2.0/db_1/dbs/initstandby.ora

###########################################

#Data Guard Parameter

###########################################
*.dispatchers='(protocol=TCP) (service=standby_DGMGRL)'

DB_UNIQUE_NAME='STANDBY'

FAL_CLIENT='standby'

FAL_SERVER='primary'

LOG_ARCHIVE_CONFIG='DG_CONFIG=(primary,standby)'

LOG_ARCHIVE_DEST_1='LOCATION=use_db_recovery_file_dest

VALID_FOR=(ALL_LOGFILES,ALL_ROLES)

DB_UNIQUE_NAME=standby'

LOG_ARCHIVE_DEST_2='SERVICE=primary

VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=primary'

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

service_names='dg1'

STANDBY_FILE_MANAGEMENT='AUTO'

18. --- Create Password file for standby database

[oracle@server2 ~]$ orapwd file=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwstandby password=oracle force=y


ignorecase=y

19. Register database with listener and restart listener

Global Database name: standby_DGMGRL

SID: standby

[oracle@server2 ~]$ lsnrctl stop

[oracle@server2 ~]$ lsnrctl start

20. ...startup mount standby from pfile

[oracle@server2 ~]$ export ORACLE_SID=standby


SQL> startup mount pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initstandby.ora;

SQL> create spfile from pfile;

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database flashback on;

21. ...... Services Configuration:

ON Primary.........

Service name dg1

hostname: server2.oracle.com

netservice name: standby

ON Standby.............

Service name dg1

hostname: server1.oracle.com

netservice name: primary

22. ... check switching of log files;

ON Primary……………

SQL> alter system switch logfile;

SQL> select count(*) from v$archived_log;

ON Standby.......................

SQL> select name,archived,applied from v$archived_log; (Status archive not applied yet)

on Standby:.................
SQl> alter system set LOG_ARCHIVE_DEST_2='SERVICE=primary LGWR AFFIRM ASYNC

VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=primary';

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect;

SQL> select name,archived,applied from v$archived_log;

SQL> select process,status from v$managed_standby;

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

You might also like