Oracle 11G使用DG Broker创建DataGuard
1.环境:
a.主机环境:CentOS6.5
b.软件环境:oracle 11.2.0.4
c.主机信息:
DG1:192.168.100.51(数据库sid:atest)
DG2:192.168.100.52
2.前提工作(主从都要设置):
a.关闭防火墙:/etc/init.d/iptables stop
b.关闭selinux:setenforce 0
查看状态:getenforce(关闭状态:Permissive)
3.3.主库设置:
a.设置主库db_unique_name:
alter system set db_unique_name='patest' scope=spfile;
b.设置主库为强制记录日志:
alter database force logging;
检查状态(YEs为强制):
select name,force_logging from v$database;
c.设置standy_file_management:
alter system set standby_file_management ='AUTO';
d.创建standbylog:
alter database add standby logfile group 11 '/u01/app/oracle/oradata/ATEST/standbylog/standby11.log' size 50m;
alter database add standby logfile group 12 '/u01/app/oracle/oradata/ATEST/standbylog/standby12.log' size 50m;
alter database add standby logfile group 13 '/u01/app/oracle/oradata/ATEST/standbylog/standby13.log' size 50m;
alter database add standby logfile group 14 '/u01/app/oracle/oradata/ATEST/standbylog/standby14.log' size 50m;
e.开启归档(简单不详述):
alter system set log_archive_dest_1='location=/u01/app/oracle/oradata/ATEST/archivelog';
alter database archivelog;
f.开启DGbroker:
alter system set DG_BROKER_START=TRUE;
g.传输pfile和密码文件:
create pfile from spfile;
scp initatest.ora orapwatest 192.168.100.52:/u01/app/oracle/product/11.2.0/db1/dbs/
h.设置监听:atest,patest,patest_DGMGRL
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = atest)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
(SID_NAME = atest)
)
(SID_DESC =
(GLOBAL_DBNAME = patest)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
(SID_NAME = atest)
)
(SID_DESC =
(GLOBAL_DBNAME = patest_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
(SID_NAME = atest)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vijay01.database.com)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
i.设置tnsnames.ora
ATEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.51)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = atest)
)
)
PATEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.51)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = atest)
)
)
SATEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.52)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = atest)
)
)
4.备库设置:
a.设置监听:atest,satest,satest_DGMGRL
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = atest)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
(SID_NAME = atest)
)
(SID_DESC =
(GLOBAL_DBNAME = satest)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
(SID_NAME = atest)
)
(SID_DESC =
(GLOBAL_DBNAME = satest_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db1)
(SID_NAME = atest)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vijay02.database.com)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
b.设置tnsnames.ora