`
sjk2013
  • 浏览: 2186527 次
文章分类
社区版块
存档分类
最新评论

Data Guard 部署物理备库的 10 大注意事项

 
阅读更多
这 10 点主要是面向 10g R2 以后的 DG 部署

① 主库设置为force logging模式


idle> select force_logging from v$database;

idle> alter database force logging;


② 主库设置为归档模式


idle> archive log list;
idle> shutdown immediate;
idle> startup mount;
idle> alter database archivelog;
idle> archive log list;


③ 配置Standby Redo Log

配置 standby redo log


④ 创建密匙文件(如果不存在的话)

先看文档的解释:

            You must have SYSDBA system privileges for the user accounts that you use to manage the primary and standby database instances
            Furthermore, the SYS user must have the same password on all databases in the configuration.
   
       

如果密码不一致会怎样?

案例如下:

Error 1031 received logging on to the standby
Errors in file /u01/app/oracle/diag/rdbms/pri/orcl/trace/orcl_arcf_5769.trc:
ORA-01031: insufficient privileges
PING[ARCf]: Heartbeat failed to connect to standby 'std'. Error is 1031.

显然、抛出 ORA-01031: insufficient privileges

使用 DBCA 建库会在 $ORACLE_HOME/dbs 下自动创建密匙文件
如若没有、可使用 orapwd 命令行工具、其 file 和 password 为必填参数、
例如(假设当前目录是 $ORACLE_HOME/dbs ):
orapwd file=orapworcl password=oracle entries=30 (Linux/Unix 平台命名规则:orapw[sid])



⑤ 设置初始化参数

DG 初始化参数列表



⑥ 数据库的版本要一致

官方文档提到:

You must install the same release of Oracle Database Enterprise Edition for the primary database and all standby databases in your Data Guard configuration


⑦ 独立的控制文件

摘自官网:
The primary database and each standby database must have their own control files.

可通过下列语句为备库创建控制文件:

alter database create standby controlfile as '/home/oracle/dg01.ctl';

控制文件通常需要多份、要么手工将上述文件 cp 几份、要么用命令多创建几个出来

需要注意的是、如果选择多次执行上述命令创建出多份、务必确保执行创建时数据库处于 MOUNT 状态

否则、几个控制文件的 SCN 号可能并不匹配、导致 备库 无法正常启动到 MOUNT 状态

另外、创建完控制文件之后到备库创建完成这段时间内(比如max(sequence#一样大))、要保证主库不再有结构上的变化(如:增加表空间等)



⑧ 统一的存储或文件管理

摘自官网:
If any databases use ASM and/or OMF, all should use the same combination


⑨ 启动物理备库以及 Redo 应用

完成对 物理备库的配置之后、就可以启动该备库、不过、某些情况下可以以 read only 模式打开

但、多数情况、应该启动到 mount 状态

如果直接执行 startup缺省会以 read only 模式打开

Oracle 会根据 控制文件判断是否为物理备库、如果是、默认启动到 read only 模式

所以、通常、我们只需:

startup mount;

进入 mount 之后、物理备库就开始接收主库发送的 redo 、然后、你可以继续通过一些命令应用这些 redo :

比如,启动 redo 应用:

alter database recover managed standby database disconnect from session;

或者附加 using current logfile 子句启动实时应用:

alter database recover managed standby database using current logfile disconnect from session;

实时、需要 LGWR sync 或者 async模式


⑩ 停止 物理备库

正常情况下、停止 物理备库之前、应该首先停止 主库

如果直接停止备库、轻则主库的alert 告警、重则、主库直接 shutdown

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics