0% found this document useful (0 votes)
11 views11 pages

Data Guard Configuration

Oracle Dataguard configuration step by step.

Uploaded by

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

Data Guard Configuration

Oracle Dataguard configuration step by step.

Uploaded by

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

Data Guard Document

Dataguard Configuration
---------------------------------
Primary Server
Installed Database
IP: 192.168.9.10
Hostname: primary

Secondary Server
Should be Software only
IP: 192.168.9.100
Hostname: standby

----------------------------------
Start Process
----------------------------------
Step-1
------
Login Priamary Server

Login DB
Check FORCE LOGGING is enabled.

SQL>SELECT force_logging FROM v$database;

FOR
-----
No

SQL> ALTER DATABASE FORCE LOGGING;


Database altered.

SQL>SELECT force_logging FROM v$database;

FOR
-----

Page 1
Data Guard Document
Yes

----------------------------------------
Step-2
------
Create redo log for standby
Run following commands on primary server

SQL>

ALTER DATABASE ADD STANDBY LOGFILE


'/u01/app/oracle/oradata/orcl/srl01.log'
SIZE 52428800;

SQL>ALTER DATABASE ADD STANDBY LOGFILE


'/u01/app/oracle/oradata/orcl/srl02.log'
SIZE 52428800
;

SQL>ALTER DATABASE ADD STANDBY LOGFILE


'/u01/app/oracle/oradata/orcl/srl03.log'
SIZE 52428800
;

SQL>
ALTER DATABASE ADD STANDBY LOGFILE
'/u01/app/oracle/oradata/orcl/srl04.log'
SIZE 52428800
;

-------------------------------------------

Step-3
-------

Page 2
Data Guard Document

check db name.db unoque name of primary server


SQL> show paramter db_name

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
db_name string orcl

SQL> show paramter db_unique_name


NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string orcl

--------------------------------------------
Step -4
-------

set the LOG_ARCHIVE_CONFIG and LOG_ARCHIVE_DEST_2 parameters on primary server.

SQL>ALTER SYSTEM SET log_archive_config = 'dg_config=(orcl,standby1)';

SQL>ALTER SYSTEM SET log_archive_dest_2 ='service=standby1 async valid_for=(online_logfile,primary_role)


db_unique_name=standby1';

---for confirmation

SQL>show parameter log_archive_config;

SQL>show parameter log_archive_dest_2;

----------------------------------------------------

Step-5
------

Page 3
Data Guard Document

Issue the following statements on primary server to determine your database's archival state, and then put
the primary database in ARCHIVELOG mode
to enable automatic archiving.

SQL> archive log list

---if Automatic archival Disabled then shut DB and enable archive log

SQL> shut immediate


SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open
-----now exit
SQL> exit;

-----------------------------------------------------------

Step-6
-------

Login Standby Server, Create TNS entry by using netca tool


or mannualy entry in tnsnames.ora

ORCL =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.9.10)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ORCL)

Page 4
Data Guard Document

------------------------------------------------------------------

Step-7
------

Login standby server, Create LISTENER entry using netca tool and add extra entry
If below entry not present in LISTENER then you can not connect auxiliary DB from primary.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = standby1)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = standby1)
)
)

--------------------------------------------------------------------

Step-8

Login primary server create entry in tnsnames.ora manually or netca tool

STANDBY1 =

(DESCRIPTION =

Page 5
Data Guard Document

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.9.100)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = STANDBY1)

-----------------------------------------------------------------------

Step-9
------

Stop and restart Listener on both servers and aslo perform tnsping
both sides should be ok result

-------------------------------------------------------------------------

Step-10
-------

Login priamary server and copy password file to standby

oracle@primary> cd $ORACLE_HOME/dbs
oracle@primary> scp orapworcl.ora
[email protected]:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwstandby1.ora

-----------------------------------------------------------------------------

Page 6
Data Guard Document
Step-11
-------

Login standby server, Create DB_NAME entry

oracle@standby> cd $ORACLE_HOME/dbs
oracle@standby dbs> echo DB_NAME=standby1 > initstandby1.ora

------------------------------------------------------------------------------

Step-12
------

Login standby server, and create direcotories as present in priamry

oracle@standby> mkdir -p $ORACLE_BASE/admin/standby1/adump

oracle@standby> mkdir -p $ORACLE_BASE/oradata/standby1

-------------------------------------------------------------------------------

Step-13
-------

login standby server

oracle@standby> export ORACLE_SID=standby1

----checking

oracle@standby> echo $ORACLE_SID


standby1

oracle@standby> sqlplus / as sysdba

Page 7
Data Guard Document
SQL> startup nomoun pfile=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initstandby1.ora

Oracle istance started

SQL> exit

--------------------------------------------------------------------------

Step-14
-------

Login primary server, using RMAN utility

oracle@primary> rman

RMAN> connect target sys


connected to target database: ORCL

---now connect auxiliary db of standby1

RMAN> connect auxiliary sys@standby1


connected to auxiliary database: STANDBY1 (not mounted)

--------now run following command

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 'orcl','standby1'

Page 8
Data Guard Document
set db_unique_name='standby1'
set db_file_name_convert='/orcl/','/standby1/'
set log_file_name_convert='/orcl/','/standby1/'
set control_files='/u01/app/oracle/oradata/standby1/standby1.ctl'
set log_archive_max_processes='5'
set fal_client='standby1'
set fal_server='orcl'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(orcl,standby1)'
set log_archive_dest_2='service=orcl ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=orcl'
;
}

------if facing MEMORY_TARGET issue during RMAN Cloning


login primary server
first check source database memory traget

oracle@primary> sqlplus / as sysdba


SQL> show paprameter memory_target

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
memory_target big integer 2G

now login standby


set following in initstandby

oracle@standby> vi /u01/app/oracle/product/11.2.0/dbs/initstandby1.ora

---------enter following entry

*.memory_target=2147483648

login as root

Page 9
Data Guard Document
root@standby# umount tmpfs
root@standby# mount -t tmpfs shmfs -o size=2G /dev/shm

------------------------------------------------------

if Facing conflict error

RMAN-05001: auxiliary file name /home/oracle/DATABASE/SHIP01.ora conflicts with a file used by the
target database

UpdateRMAN script as below in primary server


Set new location in db_file_name_convert
##set db_file_name_convert='/orcl/','/standby1/'

set db_file_name_convert='/home/oracle/DATABASE','/home/oracle/DATABASE1'

rerun rman script


------------------------------------------------------------------------------------

Step-15
-------
Perform a log switch on the primary database and redo will start being sent to the standby.

oracle@primary> export ORACLE_SID=orcl


oracle@primary> sqlplus / as sysdba

SQL> alter system switch logfile;

------------------------------------------------------------------------------------

Step-16
-------
Login standby server

oracle@primary> export ORACLE_SID=standby1

Page 10
Data Guard Document
oracle@primary> sqlplus / as sysdba

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;
Database altered.

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SEQUENCE# APP
---------- ---
2907 YES
2908 YES
2909 YES
2910 YES
2911 YES
2912 YES
2913 YES
2914 YES

-----------------------Successully Created----------------------------------

Page 11

You might also like