Академический Документы
Профессиональный Документы
Культура Документы
This document explains the step by step process of building the 11g R2 (11.2.0.1) 3-Node RAC primary to 2-Node RAC Physical Standby DataGuard on Oracle Enterprise Linux
Clusterware
Cluster Nodes
SCAN
SCAN listener Host/port
VIPs
PRIMARY
11g R2 Grid Infrastructure (11.2.0.1)
node1, node2, node3 (3-node RAC)
lab-scan.hingu.net
SCAN VIPs (port 1525)
node1-vip, node2-vip, node3-vip
STANDBY
11g R2 Grid Infrastructure (11.2.0.1)
dr-node1, dr-node2 (2-node RAC)
dr-lab-scan.hingu.net
SCAN VIPs (port 1525)
dr-node1-vip, dr-node2-vip
DB_UNIQUE_NAME
DB_NAME
DB Instances
DB LISTENER
DB Listener Host/port
DB STORAGE
File Management
ASM diskgroup for DB files
ASM Diskgroup for Recovery Files
ORACLE_HOME
11g R2 RAC version
OS
USA
BHAVIN
bhavin1, bhavin2, bhavin3
BHAVIN_LISTENER
node1-vip, node2-vip, node3-vip (port 1530)
ASM
OMF
DATA
FRA
/u01/app/oracle/db11201
11.2.0.1
Oracle Enterprise Linux 5.5 (32 bit)
INDIA
BHAVIN
bhavin1, bhavin2
BHAVIN_LISTENER
dr-node1-vip, dr-node2-vip (port 1530)
ASM
OMF
DATA
FRA
/u01/app/oracle/db11201
11.2.0.1
Oracle Enterprise Linux 5.5 (32 bit)
PRIMARY Site:
3-node 11g R2 Grid Infrastructure (11.2.0.1) has been installed and configured.
3-node RAC software (11.2.0.1) has been installed and configured.
ASM diskgroup DATA and FRA has been created.
Database BHAVIN is created on ASM and configured to use OMFs.
DB listener BHAVIN_LISTENER has been created and running on port 1530.
Database Instances are configured with LOCAL_LISTENER and REMOTE_LISTENER parameters.
DR Site:
2-node 11g R2 Grid Infrastructure (11.2.0.1) has been installed and configured.
2-node RAC software (11.2.0.1) has been installed and configured.
ASM diskgroup DATA and FRA has been created.
DB listener BHAVIN_LISTENER has been created and running on port 1530.
Click here for the detail information on installing/configuring 11g R2 Grid Infrastructure, Installing 11g R2 RAC, creating LISTENERs and creating a RAC database on ASM.
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
1/9
3/14/2015
The db_unique_name parameter has already been set to the appropriate value during the initial creation of the RAC database.
The log_archive_dest_state_n andremote_login_passwordfile have default values set to ENABLE and EXCLUSIVE respectively. So, only below mentioned parameter needed to be changed
here.
alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(USA,INDIA)' scope=both sid='*';
alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=USA' scope=both sid='*';
alter system set LOG_ARCHIVE_DEST_2='SERVICE=INDIA ARCH VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=INDIA' scope=both sid='*';
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile sid='*';
alter system set log_archive_max_processes=8 scope=both sid='*';
alter system set fal_server=INDIA scope=both sid='*';
alter system set db_file_name_convert='INDIA','USA' scope=spfile sid='*';
alter system set log_file_name_convert='INDIA','USA' scope=spfile sid='*';
alter system set standby_file_management=AUTO scope=both sid='*';
Verify that the values are set correctly for these parameters after bouncing the database.
set linesize 500 pages 0
col value for a90
col name for a50
select name, value
from v$parameter
where name in ('db_name','db_unique_name','log_archive_config', 'log_archive_dest_1','log_archive_dest_2',
'log_archive_dest_state_1','log_archive_dest_state_2', 'remote_login_passwordfile',
'log_archive_format','log_archive_max_processes','fal_server','db_file_name_convert',
'log_file_name_convert', 'standby_file_management')
Here, the total no. of online redo groups are 6 and the maximum size of these groups is 52M. So, 3 Standby Redo Log groups per thread with size of 52M each should be created on Primary
as well as standby database.
ASMCMD> mkdir +fra/usa/STANDBYLOG (connected as griduser using asmcmd)
alter system set standby_file_management=manual scope=both sid='*';
alter database add standby logfile thread 1 group 7'+fra/usa/standbylog/standby_group_07.log' size 52M;
alter database add standby logfile thread 1 group 8'+fra/usa/standbylog/standby_group_07.log' size 52M;
alter database add standby logfile thread 1 group 9'+fra/usa/standbylog/standby_group_07.log' size 52M;
alter database add standby logfile thread 2 group 10'+fra/usa/standbylog/standby_group_10.log' size 52M;
alter database add standby logfile thread 2 group 11'+fra/usa/standbylog/standby_group_11.log' size 52M;
alter database add standby logfile thread 2 group 12'+fra/usa/standbylog/standby_group_12.log' size 52M;
alter database add standby logfile thread 3 group 13'+fra/usa/standbylog/standby_group_13.log' size 52M;
alter database add standby logfile thread 3 group 14'+fra/usa/standbylog/standby_group_14.log' size 52M;
alter database add standby logfile thread 3 group 15'+fra/usa/standbylog/standby_group_15.log' size 52M;
alter system set standby_file_management=auto scope=both sid='*';
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
2/9
3/14/2015
Take the backup of the primary database and the standby controlfile. Create the staging directory to hold the RMAN backup.
mkdir /home/oracle/backup
rman target / nocatalog
run
{
sql "alter system switch logfile";
allocate channel ch1 type disk format '/home/oracle/backup/Primary_bkp_for_stndby_%U';
backup database;
backup current controlfile for standby;
sql "alter system archive log current";
}
Update TNSNAMES.ora
Add the tns alias for each of the instances of the primary database.
USA1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip.hingu.net)(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = usa.hingu.net)
(SID = bhavin1)
)
)
USA2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip.hingu.net)(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = usa.hingu.net)
(SID = bhavin2)
)
)
USA3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node3-vip.hingu.net)(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = usa.hingu.net)
(SID = bhavin3)
)
)
Copy the tnsnames.ora on all the instances under$ORACLE_HOME/network/admin to keep the same tnsnames.ora on all the instances.
Copy the RMAN Backup files and init.ora from Primary to Standby:
Copy the backups from primary node1 to dr-node1 under the same location as primary node1 (/home/oracle/backup). Also copy the pfile that was created for standby on primary
node1 to the dr-node1.
scp $ORACLE_HOME/dbs/pfile_for_standby.txt dr-node1:$ORACLE_HOME/dbs/pfile_for_standby.txt
scp r /home/oracle/backup dr-node1:/home/oracle
Copy the Password File from Primary to all the nodes in Standby.
Copy the file $ORACLE_HOME/dbs/orapwbhavin1from Primary node 1 to both the standby nodes under the directory $ORACLE_HOME/dbswith the name
oforapwbhavin1 and orapwbhavin2for dr-node1 and dr-node2 respectively.
scp $ORACLE_HOME/dbs/orapwbhavin1 dr-node1:$ORACLE_HOME/dbs/orapwbhavin1
scp $ORACLE_HOME/dbs/orapwbhavin1 dr-node2:$ORACLE_HOME/dbs/orapwbhavin2
On dr-node2:
mkdir p /u01/app/oracle/admin/india/adump
mkdir p /u01/app/oracle/diag/rdbms/india/bhavin2
cd /u01/app/oracle/diag/rdbms/india/bhavin2
mkdir trace cdump
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
3/9
3/14/2015
bhavin2.instance_number=2
bhavin1.local_listener='LISTENER_BHAVIN1'
bhavin2.local_listener='LISTENER_BHAVIN2'
*.log_archive_config='DG_CONFIG=(USA,INDIA)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=INDIA'
*.log_archive_dest_2='SERVICE=USA ARCH VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=USA'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=8
*.log_file_name_convert='USA','INDIA'
*.memory_target=1484783616
*.open_cursors=300
*.processes=1024
*.remote_listener='dr-lab-scan.hingu.net:1525'
*.remote_login_passwordfile='exclusive'
*.service_names='INDIA','india.hingu.net'
*.sessions=1131
*.standby_file_management='AUTO'
bhavin2.thread=2
bhavin1.thread=1
bhavin1.undo_tablespace='UNDOTBS1'
bhavin2.undo_tablespace='UNDOTBS2'
Now, Modify the LOCAL_LISTENER parameters in the tnsnames.ora to reflect the drspecific vip host names (On the Standby Nodes only).
LISTENER_BHAVIN1=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = dr-node1-vip.hingu.net)(PORT = 1530)))
LISTENER_BHAVIN2=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = dr-node2-vip.hingu.net)(PORT = 1530)))
INDIA1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dr-node1-vip.hingu.net)(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = india.hingu.net)
(SID = bhavin1)
)
)
INDIA2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dr-node2-vip.hingu.net)(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = india.hingu.net)
(SID = bhavin2)
)
)
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
4/9
3/14/2015
Add the below TNS alias for standby database/instances into the tnsnames.ora file on all the primary hosts.
INDIA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dr-lab-scan.hingu.net)(PORT = 1525))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = india.hingu.net)
)
)
INDIA1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dr-node1-vip.hingu.net)(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = india.hingu.net)
(SID = bhavin1)
)
)
INDIA2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dr-node2-vip.hingu.net)(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = india.hingu.net)
(SID = bhavin2)
)
)
Perform the log switch on the primary database so initiate the log Transport.
alter system switch logfile
After creating the spfile, create the below init.ora files under $ORACLE_HOME/dbson both the dr nodes with the spfile entry so that the instance can start with the newly created spfile.
On dr-node1:
[oracle@dr-node1 dbs]$ cat initbhavin1.ora
spfile='+data/india/parameterfile/spfileINDIA.ora'
On dr-node2:
[oracle@dr-node1 dbs]$ cat initbhavin2.ora
spfile='+data/india/parameterfile/spfileINDIA.ora'
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
5/9
3/14/2015
If the standby database should not start in open mode, then it can be changed by below command. The valid options are open (default), mount and nomount.
srvctl modify database -d india -s mount
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
6/9
3/14/2015
After updating these listener.ora files, restart listeners on each of these nodes.
Modify the init parameters:
Modify these below DataGuard Broker related parameters on both the sides.
Standby:
mkdir +fra/india/DATAGUARDCONFIG
mkdir +data/india/DATAGUARDCONFIG
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+fra/india/DATAGUARDCONFIG/dgb_config02.ora' SCOPE=BOTH sid='*';
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+data/india/DATAGUARDCONFIG/dgb_config01.ora' SCOPE=BOTH sid='*';
alter system set dg_broker_start=true scope=both sid='*';
primary:
mkdir +fra/usa/DATAGUARDCONFIG
mkdir +data/usa/DATAGUARDCONFIG
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+fra/usa/DATAGUARDCONFIG/dgb_config02.ora' SCOPE=BOTH sid='*';
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+data/usa/DATAGUARDCONFIG/dgb_config01.ora' SCOPE=BOTH sid='*';
alter system set dg_broker_start=true scope=both sid='*';
Create Configuration:
Connect to the DGMGRL and run the below statements to create and enable theDataGuard configuration. Verify that the DG Broker is configured correctly and it has all the databases
and instances registered as expected.
CREATE CONFIGURATION 'DG_Config' AS PRIMARY DATABASE IS 'usa' CONNECT IDENTIFIER IS 'usa';
ADD DATABASE 'india' AS CONNECT IDENTIFIER IS india;
Enable Configuration:
enable configuration;
Verify Configuration:
show configuration;
show database verbose india;
show database verbose usa
show instance verbose bhavin1 on database usa
show instance verbose bhavin2 on database usa
show instance verbose bhavin3 on database usa
show instance verbose bhavin1 on database india
show instance verbose bhavin2 on database india
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
7/9
3/14/2015
Switchover:
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
8/9
3/14/2015
After the successful Switchover operation , start the remaining instances on both the databases. Modify the database configuration in OCR with their appropriate role and start option.
Add any custom services to the new Primary (india) database that were removed earlier.
srvctl modify database d usa r physical_standby s mount
srvctl modify database d india r primary s open
srvctl add service -d india -s oltp -r bhavin1,bhavin2 -r primary -e session -m basic -B SHORT (on the new Primary cluster)
srvctl add service -d usa -s oltp -r bhavin1,bhavin2,bhavin3 -rphysical_standby -e session -m basic -B SHORT (on the new standby cluster)
data:text/html;charset=utf-8,%3Cp%20class%3D%22MsoNormal%22%20style%3D%22margin%3A%200in%200in%200.0001pt%3B%20font-size%3A%20med
9/9