step by step configuration three diff physical multiple standby server using vmware workstation(linux platform) in script method --oracle 11gr2 dataguard
PRIMARY(initk1.ora) STANDBY1(initk2.ora) STANDBY2(initk3.ora)
db_name --> k1 k1 k1
db_unique_name --> K1 K2 k3
directory_name --> k1 k2 k3
server_ip --> 192.168.62.128 192.168.62.129 192.168.62.130
tns_name --> k1tns k2tns k3tns
***********************************************************************************************************************************************
sample steps
step 0) arrange three diff server and install only 11gr2 do not create db follow below steps to the create db
step 1) create strcture for two standby
step 2)copy "pfk1" at prim_db server
step 3)run "dbk1.sh" at primary
step 4)send "k1" data through scp to "k2" and "k3" server
step 5)check "fairewal on disable" and run "lister" for 3 server
step 6)copy "pfk2 "and "pfk3" at stdby1 and stdby2
step 7)run "dbk2.sh" and "dbk3"
-------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>--------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>---------------------------------->>>>>>>>>>>>>>>>>>>>>
1) create standby_db structre standby 1 and standby2---------->for stand_db1
cd
mkdir k2
cd k2
mkdir admin oradata
cd admin
mkdir pfile diag create
cd ..
cd oradata
mkdir control log archive data
cd
tree k2
------------------------------------ for standby 2
cd
mkdir k3
cd k3
mkdir admin oradata
cd admin
mkdir pfile diag create
cd ..
cd oradata
mkdir control log archive data
cd
tree k3
----->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>---------------
2)vi dbk1.sh ----->for prim_db
mkdir k1
cd k1
mkdir admin oradata
cd admin
mkdir pfile diag create
cd ..
cd oradata
mkdir control log archive data
cd
cp /home/oracle/pfk1 /home/oracle/k1/admin/pfile/initk1.ora
cd
export ORACLE_SID=k1
sqlplus / as sysdba <<EOF
startup pfile='/home/oracle/k1/admin/pfile/initk1.ora' nomount;
create database k1
datafile '/home/oracle/k1/oradata/data/system01.dbf' size 400m
sysaux datafile '/home/oracle/k1/oradata/data/systemaux01.dbf' size 300m
undo tablespace undo01 datafile '/home/oracle/k1/oradata/data/undo01.dbf' size 100m
default temporary tablespace temp01 tempfile '/home/oracle/k1/oradata/data/temp01.dbf' size 100m
logfile group 1 '/home/oracle/k1/oradata/log/log01.log' size 10m,
group 2 '/home/oracle/k1/oradata/log/log02.log' size 10m;
@?/rdbms/admin/catalog.sql;
@?/rdbms/admin/catproc.sql;
create spfile from pfile='/home/oracle/k1/admin/pfile/initk1.ora';
alter database add standby logfile group 3 '/home/oracle/k1/oradata/log/std3.log' size 100m;
alter database add standby logfile group 4 '/home/oracle/k1/oradata/log/std4.log' size 100m;
create table kf(id number(10));
create tablespace tbs datafile '/home/oracle/k1/oradata/data/tbs.dbf' size 500m;
exec dbms_logmnr_d.set_tablespace('tbs');
alter database add supplemental log data(all) columns;
alter database force logging;
alter database close;
alter database archivelog;
shut immediate;
!
EOF
export ORACLE_SID=k1
sqlplus / as sysdba <<EOF
startup pfile='/home/oracle/k1/admin/pfile/initk1.ora';
create spfile from pfile='/home/oracle/k1/admin/pfile/initk1.ora';
alter database close;
alter database create standby controlfile as '/home/oracle/control01.ctl';
shut immediate;
!cd $ORACLE_HOME/dbs
!export ORACLE_SID=k1
!orapwd file=orapwk1 password=sys force=y
!cp $ORACLE_HOME/dbs/orapwk1 /home/oracle/orapwk2
!cp $ORACLE_HOME/dbs/orapwk1 /home/oracle/orapwk3
EOF
---------------------------------------------------------------------
vi pfk1 -------->for prim_db
vi initk1.ora
db_name=k1
sga_target=600m
control_files='/home/oracle/k1/oradata/control/control01.ctl'
diagnostic_dest='/home/oriacle/k1/admin/diag'
log_archive_config='DG_CONFIG=(k1,k2,k3)'
db_unique_name=k1
log_archive_dest_2='SERVICE=k2tns ASYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=k2'
log_archive_dest_3='SERVICE=k3tns ASYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=k3'
db_file_name_convert='/home/oracle/k2/oradata/data','/home/oracle/k1/oradata/data','/home/oracle/k3/oradata/data','/home/oracle/k1/oradata/data',
log_file_name_convert='/home/oracle/k2/oradata/log','/home/oracle/k1/oradata/log','/home/oracle/k3/oradata/log','/home/oracle/k1/oradata/log',
fal_client=k1tns
fal_server=k2tns,k3tns
standby_file_management=auto
remote_login_passwordfile=exclusive
log_archive_dest_state_1=enable
log_archive_dest_state_2=enable
------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>--------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3)server prim db listener and tns
]$ cd $ORACLE_HOME/network/admin
vi listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.128)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = k1)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
)
tnsnames.ora
k1tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k1)
)
)
k2tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k2)
)
)
k3tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k3)
)
)
------------------------------------------------------------------------
server2 stand_db 1 listener and tns
]$ cd $ORACLE_HOME/network/admin
vi listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.129)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = k2)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
)
)
tnsnames.ora
k1tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k1)
)
)
k2tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k2)
)
)
k3tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k3)
)
)
-----------------------------------------------------------------------
server3 stand_db 2 listener and tns
]$ cd $ORACLE_HOME/network/admin
vi listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.130)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = k3)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
)
)
tnsnames.ora
k1tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k1)
)
)
k2tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k2)
)
)
k3tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.62.130)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = k3)
)
)
------>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>---------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>----------------
4)start the listner after run below commands in three server
[root@localhost6 ~]# /sbin/ifconfig
[root@localhost6 ~]# neat
[root@localhost6 ~]# service network restart
[root@test3 ~]# service iptables status
Firewall is stopped.
[root@test3 ~]# service iptables stop
[root@test3 ~]#
AT PRIM
shut immediate;
for stdby 1:-
scp /home/oracle/control01.ctl oracle@192.168.62.129:/home/oracle/k2/oradata/control/
(copy paste individual)
scp /home/oracle/k1/oradata/data/* oracle@192.168.62.129:/home/oracle/k2/oradata/data/
(copy paste individual)
scp /home/oracle/orapwk2 oracle@192.168.62.129:/home/oracle/
-----------------------------------------------------------------------------------------------
for stdby 2:-
scp /home/oracle/control01.ctl oracle@192.168.62.130:/home/oracle/k3/oradata/control/
(copy paste individual)
scp /home/oracle/k1/oradata/data/* oracle@192.168.62.130:/home/oracle/k3/oradata/data/
(copy paste individual)
scp /home/oracle/orapwk3 oracle@192.168.62.130:/home/oracle/
note :-"don't open primdb when taking backups and sending data through scp becouse if u open primdb it will throw error when opening standby1 and standby2
-------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>----------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>----------------------
5)serv2 ------------>for stdby_db1
vi dbk2.sh
cp /home/oracle/pfk2 /home/oracle/k2/admin/pfile/initk2.ora
cd $ORACLE_HOME/dbs
rm orapwk2
cd
export ORACLE_SID=k2
mv /home/oracle/orapwk2 $ORACLE_HOME/dbs
cd
export ORACLE_SID=k2
sqlplus / as sysdba <<EOF
startup pfile='/home/oracle/k2/admin/pfile/initk2.ora' nomount;
alter database mount standby database;
alter database open;
alter database recover managed standby database disconnect from session;
create spfile from pfile='/home/oracle/k2/admin/pfile/initk2.ora';
shut immediate;
!
EOF
export ORACLE_SID=k1
sqlplus / as sysdba <<EOF
startup pfile='/home/oracle/k2/admin/pfile/initk2.ora' nomount;
alter database mount standby database;
alter database open;
alter database recover managed standby database disconnect from session;
create spfile from pfile='/home/oracle/k2/admin/pfile/initk2.ora';
EOF
--------------------------------------------------------------------------
vi pfk2 ------------->for stdby_db1
db_name=k1
sga_target=600m
control_files='/home/oracle/k2/oradata/control/control01.ctl'
diagnostic_dest='/home/oracle/k2/admin/diag'
log_archive_config='DG_CONFIG=(k2,k1)'
db_unique_name=k2
log_archive_dest_2='SERVICE=k1tns ASYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=k1'
db_file_name_convert='/home/oracle/k1/oradata/data','/home/oracle/k2/oradata/data'
log_file_name_convert='/home/oracle/k1/oradata/log','/home/oracle/k2/oradata/log'
fal_client=k2tns
fal_server=k1tns
standby_file_management=auto
remote_login_passwordfile=exclusive
log_archive_dest_state_1=enable
log_archive_dest_state_2=enable
------------>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>--------------------
6) for serv3 ----------->stdby2
vi dbk3.sh
cp /home/oracle/pfk3 /home/oracle/k3/admin/pfile/initk3.ora
cd $ORACLE_HOME/dbs
rm orapwk3
export ORACLE_SID=k3
mv /home/oracle/orapwk3 $ORACLE_HOME/dbs
cd
export ORACLE_SID=k3
sqlplus / as sysdba <<EOF
startup pfile='/home/oracle/k3/admin/pfile/initk3.ora' nomount;
alter database mount standby database;
alter database open;
alter database recover managed standby database disconnect from session;
create spfile from pfile='/home/oracle/k3/admin/pfile/initk3.ora';
shut immediate;
!
EOF
export ORACLE_SID=k1
sqlplus / as sysdba <<EOF
startup pfile='/home/oracle/k3/admin/pfile/initk3.ora' nomount;
alter database mount standby database;
alter database open;
alter database recover managed standby database disconnect from session;
create spfile from pfile='/home/oracle/k3/admin/pfile/initk3.ora';
EOF
--------------------------------------------------------------------------------
vi pfk3 ------------->for stand_db2
db_name=k1
sga_target=600m
control_files='/home/oracle/k3/oradata/control/control01.ctl'
diagnostic_dest='/home/oracle/k3/admin/diag'
log_archive_config='DG_CONFIG=(k3,k1)'
db_unique_name=k3
log_archive_dest_2='SERVICE=k1tns ASYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=k1'
db_file_name_convert='/home/oracle/k1/oradata/data','/home/oracle/k3/oradata/data'
log_file_name_convert='/home/oracle/k1/oradata/log','/home/oracle/k3/oradata/log'
fal_client=k3tns
fal_server=k1tns
standby_file_management=auto
remote_login_passwordfile=exclusive
log_archive_dest_state_1=enable
log_archive_dest_state_2=enable
------------>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>------------>>>>>>>>>>>>>>>>>>>>>>>>>>>>----------------
7) create unique_db spfile for both db
select name,db_unique_name,database_role,SWITCHOVER_STATUS from v$database;
select APPLIED,CREATOR,SEQUENCE# from v$archived_log;
alter database recover managed standby database cancel;
alter database recover managed standby database using current logfile disconnect;
alter database recover managed standby database disconnect from session;
prim :-
startup
alter system switch logfile;
stdby:-
startup nomount;
alter database mount standby database;
alter database open;
alter database recover managed standby database disconnect from session;
Comments
Post a Comment