######################################
搭建备库(DataGard)
author:guoyJoe;
createdate:2012-12-14
######################################
物理Standby创建时的操作步骤
1、创建主库的备份
2、创建Standby数据库控件文件
3、配置主备库的监听和网络服务名
4、配置主备库的初始化参数文件
5、复制备份集到Standby服务器
6、恢复Standby数据库
7、启动物理Standby数据库REDO应用
8、打开Standby数据库
9、切换主库的日志检测日志的传输与应用是否正常
*********************************************
物理Standby实际创建过程演示
*********************************************
一、库配置和相关操
1、配置vi /etc/hosts
192.168.0.158 bxdb
192.168.0.165 dg
2、确认主库处于归档模式:archive log list;
3、将主库置为Force Logging模式:
select force_logging from v$database;
alter database force logging;
4、配置主库的初始化参数
*.db_unique_name=ocp_pri
*.log_archive_config='DG_CONFIG=(ocp_pri,ocp_dg)'
*.log_archive_dest_1='LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ocp_pri'
*.log_archive_dest_2='SERVICE=standby LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ocp_dg'
*.log_archive_dest_state_2=DEFER
--主库切为备库时要用到
*.fal_server=standby
*.fal_client=primary
*.standby_file_management=AUTO
#*.db_file_name_convert='bxdb','bxdb'
#*.log_file_name_convert='bxdb','bxdb'
5、配置主库的listener.ora与tnsnames.ora文件
vi listener.ora
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=bxdb)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=bxdb)
(ORACLE_HOME=/u01/app/oracle/product/11g)
(SID_NAME=bxdb)))
vi tnsnames.ora
bxdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = bxdb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bxdb)
)
)
bxdb_dg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dg)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bxdb)
)
)