0% found this document useful (0 votes)
45 views

Data Gurad: Primary Standby

This document outlines the steps to configure a physical standby database for data guard. 1) It describes setting up the primary database to archive logs and configuring the necessary parameters. 2) It then outlines modifying the standby database initialization file and starting log apply services. 3) Finally, it discusses how to change the protection mode and perform switchover and failover operations between the primary and standby databases.

Uploaded by

sujeetsinghjsr
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)
45 views

Data Gurad: Primary Standby

This document outlines the steps to configure a physical standby database for data guard. 1) It describes setting up the primary database to archive logs and configuring the necessary parameters. 2) It then outlines modifying the standby database initialization file and starting log apply services. 3) Finally, it discusses how to change the protection mode and perform switchover and failover operations between the primary and standby databases.

Uploaded by

sujeetsinghjsr
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

DATA GURAD

PRIMARY STANDBY
DB_NAME prod prod
DB_UNIQUE_NAME prod test
LISTENER NAME primary standby
TNS NAME tostandby toprimary

Primary Database side:

Step 1:

Enable forced logging on your primary database:
SQL> ALTER DATABASE FORCE LOGGING;
Step 2:

Create a password file if it doesnt exist.
To check if a password file already exists, run the following command
SQL> select * from v$pwfile_users;
$cd %ORACLE_HOME%\database
$orapwd file=orapw$ORACLE_SID.ora password=xxxxxxxx force=y
Step 3:

Create pfile from spfile for the primary database
SQL>create pfile=$ORACLE_HOME/dbs/pfileprod.ora from spfile;
Steps 4:
pfile Parameters for primary database
db_name=prod
db_unique_name=prod
LOG_ARCHIVE_CONFIG='DG_CONFIG=(prod,test)'
LOG_ARCHIVE_DEST_1=
'LOCATION=/u01/prod/crd/arch
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=prod'
LOG_ARCHIVE_DEST_2=
'SERVICE=tostandby LGWR ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=test'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
remote_login_passwordfile='EXCLUSIVE'
FAL_SERVER=tostandby
FAL_CLIENT=toprimary
STANDBY_FILE_MANAGEMENT=AUTO

Step 5:
Enable Archiving on Primary.
If your primary database is not already in Archive Log mode, enable the archive log mode:
SQL>shutdown immediate;
SQL>startup mount;
SQL>alter database archivelog;
SQL>alter database open;
SQL>archive log list;
Step 6:
Create a Control File for the Standby Database
sql> startup mount;
sql> alter database create standby controlfile as '/u01/control.ctl';
sql> alter database open;
sql> shut immediate;

Step 7:
Copy Datafiles, redo logfiles, standby control file and pfile from Primary database to Standby database.

STANDBY DATABASE SIDE:
Step 1:
Modifying Initialization Parameters for a Physical Standby Database

DB_NAME=prod
DB_UNIQUE_NAME=test
LOG_ARCHIVE_CONFIG='DG_CONFIG=(prod,test)'
CONTROL_FILES='/u01/test/crd/control.ctl'
DB_FILE_NAME_CONVERT='prod','test'
LOG_FILE_NAME_CONVERT=
'/u01/prod/crd /u01/test/crd
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_1=
'LOCATION=/u01/test/arch/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=test'
LOG_ARCHIVE_DEST_2=
'SERVICE=toprimary LGWR ASYNC(it shut be in cap locs (LGWR ASYNC))
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=prod'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=toprimary
FAL_CLIENT=tostandby
Step 2:
Set up environment support by standby database
Export ORACLE_SID=test
Export ORACLE_HOME=/u01/app/oracle/product/11.2.0./dbhome_1
Export PARH=$ORACLE_HOME/bin:$PATH
Step 3:
Create a password file
$cd %ORACLE_HOME%\database
$orapwd file=orapw$ORACLE_SID.ora password=xxxxxxxx force=y

Step 4:
Configure listeners for the primary and standby databases.
PRIMARY:
Lsnrctl start primary
STANDBY:
Lsnrctl start standby
Step 5:
Create oracle net service names:
PRIMARY: tnsping tostandby
STANDBY: tnsping toprimary
Step 6:
Start the PHYSICAL STANDBY DATABASE:
SQL> startup nomount;
SQL> create spfile from pfile;
SQL>startup force nomount;
SQL>alter database mount standby database;
SQL>alter database open;
Step 7:
INITIATE LOG APPLY SERVICES
SQL>alter database recover managed standby database disconnect from session;
Step 8:
TO STOP LOG APPLY SERVICES
SQL>alter database recover managed standby database cancel;

CHANGING MODES

By default it will be in MAXIMUM PERFORMANCE
CHANGING TO MAXIMUM AVALIBALITY
At Standby location add STANDBY logfiles
Step 1:
SQL>alter database add standby logfile group3 /u01/test/crd/redo4.log size 11m;
SQL>alter database add standby logfile group3 /u01/test/crd/redo4.log size 11m;

Step 2:
Make changes in pfile at Primary Location:
Log_archive_dest_2=service=tostandby lgwr sync affirm
Step 3:
SQL>shut immediate
SQL>startup nomount
Step 4:
SQL>alter database set standby database to maximize availability;
Step 5:
SQL>select protection_mode from v$database;
Step 6:
SQL>alter database open

CHANGING TO MAXIMUM PROTECTION

At Standby location add STANDBY logfiles
Step 1:
SQL>alter database add standby logfile group3 /u01/test/crd/redo4.log size 11m;
SQL>alter database add standby logfile group3 /u01/test/crd/redo4.log size 11m;
Step 2:
Make changes in pfile at Primary Location:
Log_archive_dest_2=service=tostandby lgwr sync affirm
Step 3:
SQL>shut immediate
SQL>startup nomount
Step 4:
SQL>alter database set standby database to maximize protection;
Step 5:
SQL>select protection_mode from v$database;

Step 6:
SQL>alter database open

SWITCH OVER
Physical standby
Step1:
SQL>alter database commit to switchover to physical standyby;
SQL>shut immediate;
SQL>startup nomount
SQL>select database_role from from v$database;
SQL>select open_mode from v$database;
Standby location
Step 1:
SQL>alter database recover managed standby database disconnect;
SQL>alter database commit to switchover to primary;
SQL>shut immediate;
SQL>startup nomount;
SQL>select database_role from v$database;
SQL>alter database open;
SQL>select open_mode from v$database;
Check wheather its working properly
SQL>alter system switch logfile;
SQL>archive log list;
FAIL OVER
Standby database
Step 1:
SQL>alter database recover managed standby database finish;
SQL>alter database commit to switchover to primary;
SQL>select database_role from v$database;
Primary locataion
STEP 1:
SQL>alter database commit to switchover to physical standby
ORA-16416:switch over target is not synchronized with primary

You might also like