windows环境DataGuard配置
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1. DataGuard 配置
主机:192.168.0.7(primary)
备机:192.168.0.8(standby)
配置条件:分别在primary 、standby 上安装数据库,并自动创建实例;安装路径、数据库实例名( citizen )和密码都设置成一样特别注意:文件夹权限必须与administartor 一致
1.1. Primary 主机操作
1、设置主数据库为force logging 模式
SQL>sqlplus "/as sysdba"
SQL>alter database force logging;
2、设置主数据库为归档模式,并以mount 启动数据库
SQL>archive log list
SQL>shutdown immediate
SQL>startup mount
SQL>alter database archivelog;
SQL>archive log list
3、添加" 备用联机日志文件"
SQL>select * from v$logfile;
再添加:
alter database add standby logfile group 4 ('D:\app\oradata\orcl\redo04.log') size 50m; alter database add standby logfile group 5 ('D:\app\oradata\orcl\redo05.log') size 50m; alter database add standby logfile group 6 ('D:\app\oradata\orcl\redo06.log') size 50m; alter database add standby logfile group 7 ('D:\app\oradata\orcl\redo07.log') size 50m; 路径与原来的日志路径一样
4、创建主库的初始化参数给备库用
SQL>Create pfile from spfile;
产生的文件名为initcitizen.ora 存放目录默认放在$ORACLE_HOME/databa下e 5、在主库创建监听和配置tnsnams.ora
listener.ora 配置如下:
SID_LIST_LISTENE中添加:红色添力卩
(SID_DESC =
(GLOBAL_DBNAME = citizen)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(SID_NAME = citizen)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = WIN-RKCE8P1N4VV)(PORT = 1521)) )
)
此处HOST 最好使用主机名
tnsnames.ora 配置如下:
添加:
primary =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 19.128.249.51)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = citizen)
)
)
standby =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 19.128.249.52)(PORT = 1521)) (CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = citize n)
)
)
监听配置完后,重启监听后,需要时间久一点primary 的服务才能启动起来
特别注意,需要使用下面pfile 启动,primary的服务才正式启动
6、在in itcitize n.ora 中添加以下容:
*log_archive_format='%T%S%r.ARC'
*DB_UNIQUE_NAME='primary'
*.log_archive_c on fig='DG_CONFIG=(primary,sta ndby)'
*log_archive_dest_1='locati on=D:\app\flash_recovery_area\orcl\ARCHIVELOG VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primary' *log_archive_dest_2='SERVICE=sta ndby arch
ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sta ndby'
*.STANDBY_FILE_MANAGEMENT=AUTO
*LOG_ARCHIVE_DEST_STATE_仁ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.FAL_SERVER='sta ndby'
*.FAL_CLIENT='primary'