我的编程空间,编程开发者的网络收藏夹
学习永远不晚

Oracle 12C Rac到Rac搭建ADG

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

Oracle 12C Rac到Rac搭建ADG

1、环境介绍
搭建一套ADG灾备环境。主库环境为12.1.2.0 RAC,备库同主库,软件补丁均已安装。
2、配置步骤
2.1 归档

 select log_mode from v$database;  #####是否为归档模式
 alter database force logging;           #####强制归档

2.2 主库standby log

alter database add standby logfile thread 1 group 5  ('+DATADG') size 2048M;
alter database add standby logfile thread 1 group 6  ('+DATADG') size 2048M;
alter database add standby logfile thread 1 group 7  ('+DATADG') size 2048M;
alter database add standby logfile thread 1 group 8  ('+DATADG') size 2048M;
alter database add standby logfile thread 1 group 9  ('+DATADG') size 2048M;
alter database add standby logfile thread 1 group 10 ('+DATADG') size 2048M;
alter database add standby logfile thread 2 group 11    ('+DATADG') size 2048M;
alter database add standby logfile thread 2 group 12    ('+DATADG') size 2048M;
alter database add standby logfile thread 2 group 13    ('+DATADG') size 2048M;
alter database add standby logfile thread 2 group 14    ('+DATADG') size 2048M;
alter database add standby logfile thread 2 group 15    ('+DATADG') size 2048M;
alter database add standby logfile thread 2 group 16    ('+DATADG') size 2048M;

3、文件
3.1 密码文件

拷贝主库密码文件到备库,最开始放在$ORACLE_HOME/dbs目录下,后续配置完成后,需要将密码文件存放在ASM磁盘组中并进行改名。
 scp orapwbmacdb IP: $ORACLE_HOME/dbs1
 ASMCMD> pwcopy /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwbmacdb1 +datadg/bmacdbdg/password/orapwbmacdb
copying /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwbmacdb1 -> +datadg/bmacdbdg/password/orapwbmacdb

3.2 参数文件

拷贝主库参数文件到备库,放在$ORACLE_HOME/dbs目录下,恢复完成后,需要将参数文件存放在ASM磁盘组中,并通过pfile指定其位置。参数文件内容如下:
*.audit_file_dest='/u01/app/oracle/admin/bmacdb/adump'
*.control_files='+DATADG/BMACDB/control01.ctl','+DATADG/BMACDB/control02.ctl'
*.db_file_name_convert='+DATADG/BMACDB/DATAFILE/','+DATADG/BMACDB/DATAFILE/','+SSDDG/BMACDB/DATAFILE/','+DATADG/BMACDB/DATAFILE/','+DATADG/bmacdb/','+DATADG/BMACDB/DATAFILE/'
*.db_unique_name='bmacdbdg'
*.log_archive_config='DG_CONFIG=(bmacdb,bmacdbdg)'
*.log_archive_dest_1='LOCATION=+ARCHDG VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=bmacdbdg'
*.log_archive_dest_2='SERVICE=BMACDB1 ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=BMACDB'
*.log_file_name_convert='+SSDDG/bmacdb/','+LOGDG/BMACDB/ONLINELOG/'
*.fal_server='BMACDB'
以上参数时我们需要修改的地方。

3.3 目录结构

mkdir -p /u01/app/oracle/admin/bmacdb/adump
ASM:
+DATADG/BMACDB/DATAFILE
+LOGDG/BMACDB/ONLINELOG
创建完目录结构后,启动数据库到nomount状态。
startup nomount

3.4 配置监听

在配置ADG开始阶段,需要在备库静态注册监听,搭建完成后,可以将静态注册信息删掉。静态注册信息如下:/u01/app/12.1.0/grid/network/admin/listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = bmacdbdg)
      (ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
      (SID_NAME = bmacdb1)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = IP地址)(PORT = 1521))
    )
  )
配置完监听后启动监听,静态监听信息如下:
Service "bmacdbdg" has 1 instance(s).
  Instance "bmacdb1", status UNKNOWN, has 1 handler(s) for this service...
主库连接串配置
主库tnsnames.ora新增到备库的连接串,并且在RAC两个节点同时新增:
BMACDBDG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = IP地址)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bmacdbdg)
    )
  )
配置完成后,进行连通性测试:
sqlplus sys/password@BMACDBDG as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 18 14:28:16 2019
Copyright (c) 1982, 2014, Oracle.  All rights reserved.

备库连接串配置
备库tnsnames.ora新增到主库的连接串,并且在RAC两个节点同时新增:
BMACDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = IP地址)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bmacdb)
    )
  )
配置完成后,进行连通性测试:
sqlplus sys/password@BMACDB as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 18 14:29:29 2019
Copyright (c) 1982, 2014, Oracle.  All rights reserved.

4、恢复备库

source /home/oracle/.profile 
rman target sys/password@BMACDB auxiliary sys/password@BMACDBDG <<EOF
run
{
allocate channel cl1 type disk;
allocate auxiliary channel c1 type disk;
duplicate target database for standby from active database nofilenamecheck;
release channel c1;
release channel cl1;
}
EOF
给脚本授予执行权限并执行脚本:
chmod +x dg.sh
nohup ./dg.sh &

5、修改主库参数

alter system set log_archive_config='dg_config=(bmacdb,bmacadg,bmacdg,bmacdbdg)';
alter system set log_archive_dest_4='service=BMACDBDG async valid_for=(online_logfiles,primary_role) db_unique_name=bmacdbdg';

6、备库spfile

SQL> create spfile ='+datadg/bmacdbdg/spfilebmacdb.ora' from pfile;

File created.
oracle@bmacdrdb1:/home/oracle>cd $ORACLE_HOME/dbs
oracle@bmacdrdb1:/u01/app/oracle/product/12.1.0/dbhome_1/dbs>cat initbmacdb1.ora
spfile ='+datadg/bmacdbdg/spfilebmacdb.ora'

7、备库RAC添加资源

srvctl add database -db bmacdbdg -dbname bmacdb -oraclehome /u01/app/oracle/product/12.1.0/dbhome_1 -dbtype RAC -role PHYSICAL_STANDBY
srvctl add instance -db bmacdbdg -instance bmacdb1 -node bmacdrdb1 
srvctl add instance -db bmacdbdg -instance bmacdb2 -node bmacdrdb2 
srvctl modify database -db bmacdbdg -spfile '+datadg/bmacdbdg/spfilebmacdb.ora' -pwfile '+datadg/bmacdbdg/password/orapwbmacdb'
srvctl modify database -db bmacdbdg -diskgroup DATADG,LOGDG
备库配置信息:
oracle@bmacdrdb1:/home/oracle>srvctl config database -d bmacdbdg
Database unique name: bmacdbdg
Database name: bmacdb
Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1
Oracle user: oracle
Spfile: +datadg/bmacdbdg/spfilebmacdb.ora
Password file: +datadg/bmacdbdg/password/orapwbmacdb
Domain: 
Start options: open
Stop options: immediate
Database role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
Server pools: 
Disk Groups: DATADG,LOGDG
Mount point paths: 
Services: 
Type: RAC
Start concurrency: 
Stop concurrency: 
OSDBA group: dba
OSOPER group: oper
Database instances: bmacdb1,bmacdb2
Configured nodes: bmacdrdb1,bmacdrdb2
Database is administrator managed

8、应用日志

alter database recover managed standby database disconnect from session;
alter database recover managed standby database cancel;
alter database open;
alter database recover managed standby database using current logfile disconnect;
select open_Mode,DATABASE_ROLE from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

Oracle 12C Rac到Rac搭建ADG

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

Oracle RAC如何搭建

这篇文章将为大家详细讲解有关Oracle RAC如何搭建,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。RAC搭建一、准备工作. 11.规划. 12.网络配适器准备(rac1& rac2). 23.关闭防火
2023-06-01

Oracle 12c RAC 安装文档

博客园 首页 新随笔 联系 管理 订阅 随笔- 91  文章- 0  评论- 11  Oracle 12c RAC 安装文档   参考文档
Oracle 12c RAC 安装文档
2018-01-24

编程热搜

目录