Step6:配置Oracle Dataguard

很多时候我们搭建oracle dataguard想在主库出现问题的时候备库能够马上顶上,而且前段应用不需要做修改.这样子才能体现dg的优势.下面我搭建的方法是针对这部分的.其实主要是将两个库的db_unique_name设置一样.

前期的很多东西可以参考之前写的step.我这边只是简单的说明

一.primary database

a.init parameter

[oracle@dg1 dbs]$ more initprimary.ora
db_name=DG
control_files=/u01/app/oradata/cntl.ctl
db_block_size=8192
undo_tablespace=UNDOTBS1

#add lance
DB_UNIQUE_NAME=primary
#LOG_ARCHIVE_CONFIG=’DG_CONFIG=(primary,standby)’
LOG_ARCHIVE_DEST_1=’LOCATION=/u01/app/oracle/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES)’
LOG_ARCHIVE_DEST_2=’SERVICE=dg2 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)’
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=enable
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
*.fal_server=dg2
*.fal_client=dg1
*.STANDBY_FILE_MANAGEMENT=AUTO
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30

b.listener.ora&&tnsnames.ora

[oracle@dg1 admin]$ more listener.ora
SID_LIST_dg1 =
(SID_LIST =
(SID_DESC =
#(GLOBAL_DBNAME = primary_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/11.2.0)
(SID_NAME = primary)
)
)

dg1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))
)
)


[oracle@dg1 admin]$ more tnsnames.ora
dg1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primary)
)
)

dg2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.110)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primary)
)
)

二.standby database

a.initparmeter

[oracle@dg2 dbs]$ more initstandby.ora
db_name=DG
control_files=/u01/app/oradata/con.ctl
DB_UNIQUE_NAME=primary
#LOG_ARCHIVE_CONFIG=’DG_CONFIG=(standby,primary)’
LOG_ARCHIVE_DEST_1=’LOCATION=/u01/app/oracle/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES)’
LOG_ARCHIVE_DEST_2=’SERVICE=dg1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)’
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=enable
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
*.fal_server=dg1
*.fal_client=dg2
*.STANDBY_FILE_MANAGEMENT=AUTO
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
#LOG_ARCHIVE_MAX_PROCESSES=30
log_file_name_convert=’/u01/app/oracle/arch’,'/u01/app/oracle/arch’

b.listener.ora&&tnsnames.ora

[oracle@dg2 admin]$ more listener.ora
SID_LIST_dg2 =
(SID_LIST =
(SID_DESC =
# (GLOBAL_DBNAME = standby_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/11.2.0)
(SID_NAME = primary)
)
)

dg2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.110)(PORT = 1521))
)
)


[oracle@dg2 admin]$ more tnsnames.ora
dg1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primary)
)
)

dg2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.110)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
)

当dg出现问题后,将备库ip修改一下就OK啦。


你可能感兴趣的:(oracle,dataguard,Step6)