ADG系列之oracle rac到单机的ADG环境搭建

发布时间:2020-06-26 13:04:43 作者:跑步跑步
来源:网络 阅读:1308

地址规划:

RAC: 1.1.1.62 rac5-vip

      1.1.1.64 rac6-vip

db_name hxzg

db_unique_name  hxzg


rac5-dg 1.1.1.68 

db_name hxzg

db_unique_name hxzgdg

归档路径:/archivelog

数据文件路径:/oradata/hxzg/


一、基本环境准备

1、确认机器为归档模式

archive log list

2、开启主库的force logging

alter database force logging;

二、主库的操作

2.1修改参数

alter database force logging;

alter system set log_archive_config='dg_config=(hxzg,hxzgdg)' scope=both;

alter system set  log_archive_dest_1='location=+archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=hxzg';

alter system set LOG_ARCHIVE_DEST_2='SERVICE=hxzgdg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=hxzgdg' scope=both;    

alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both;    

alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both;    

alter system set FAL_SERVER=hxzgdg scope=both;       

alter system set FAL_CLIENT=hxzg1 scope=both;       

alter system set STANDBY_FILE_MANAGEMENT=auto scope=both;  

2.2 同步口令文件


三、配置网络

  1. tns配置

    节点1/2/备库的tnsnames.ora文件下添加如下内容:


hxzg1 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.62)(PORT = 1521))

    (ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.63)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = hxzg)

    )

  )


hxzgdg =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.68)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = hxzgdg)

    )

  )

2、配置备库的listener

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = prod)

      (ORACLE_HOME = /oracle/app/db)

      (SID_NAME = hxzgdg)

    )

  )


LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))

    )

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.68)(PORT = 1521))

    )

  )



ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON


四、备库参数配置

获取主库的参数,在此基础上进行修改

*.audit_file_dest='/oracle/app/oracle/admin/hxzg/adump'

*.audit_trail='db'

*.cluster_database=false

*.compatible='11.2.0.4.0'

*.control_files='/oradata/hxzg/control01.ctl'

*.db_block_size=8192

*.db_create_file_dest='/oradata/hxzg/'

*.db_domain=''

*.db_name='hxzg'

db_unique_name='hxzgdg'

*.db_recovery_file_dest_size=4621074432

*.diagnostic_dest='/oracle/app/oracle'

*.fal_client='HXZGDG'

*.fal_server='HXZG1'

*.log_archive_config='dg_config=(hxzg,hxzgdg)'

*.log_archive_dest_1='location=/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=hxzgdg'

*.log_archive_dest_2='SERVICE=hxzg1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=hxzg'

*.log_archive_dest_state_1='ENABLE'

*.log_archive_dest_state_2='ENABLE'

*.memory_target=1200m

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='exclusive'

*.standby_file_management='AUTO'

*.undo_tablespace='UNDOTBS1'



--创建目录

mkdir -p /oracle/app/oracle/admin/hxzg/adump

mkdir -p /oradata/hxzg


五、初始化数据库

在主库上执行备份动作

run

{

allocate channel ch2 type disk maxpiecesize =5120M;

allocate channel ch3 type disk maxpiecesize =5120M;

allocate channel ch4 type disk maxpiecesize =5120M;

allocate channel ch5 type disk maxpiecesize =5120M;

backup 

AS COMPRESSED BACKUPSET 

database filesperset 10 format '/backup/%d_DF_%T_%s_%p.bak';

 backup  AS COMPRESSED BACKUPSET 

 archivelog all format '/backup/%d_ARC_%T_%s_%p.bak';

 backup format '/backup/ctrl_%d_%T_%s'

 current controlfile for standby;

 backup spfile format '/backup/spfile_%d_%T_%s';

 release channel ch2;

 release channel ch3;

 release channel ch4;

 release channel ch5;

 }


2、在备库上进行还原

RMAN> restore standby controlfile from '/backup/ctrl_HXZG_20171108_40';


RMAN> 

run{

set newname for database to '/oradata/hxzg/%b';

restore database;

switch datafile all;

}



3、创建standbylogfile

alter database add standby logfile thread 1 group 5 ('/oradata/hxzg/st_1_logfile5') size 50M;

alter database add standby logfile thread 1 group 6 ('/oradata/hxzg/st_1_logfile6') size 50M;

alter database add standby logfile thread 1 group 7 ('/oradata/hxzg/st_1_logfile7') size 50M;

alter database add standby logfile thread 1 group 11 ('/oradata/hxzg/st_1_logfile11') size 50M;



alter database add standby logfile thread 2 group 8 ('/oradata/hxzg/st_2_logfile8') size 50M;

alter database add standby logfile thread 2 group 9 ('/oradata/hxzg/st_2_logfile9') size 50M;

alter database add standby logfile thread 2 group 10 ('/oradata/hxzg/st_2_logfile10') size 50M;

alter database add standby logfile thread 1 group 12 ('/oradata/hxzg/st_2_logfile12') size 50M;



启动mrp

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

七、相关检查

1 在主库上检查第二归档终点是否正常

select name,status,error from v$archive_dest;


推荐阅读:
  1. adg_redirect_dml
  2. Oracle 12C Rac到Rac搭建ADG

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

oracle adg 列之 %d

上一篇:Parrot 3.6 安装mitmproxy

下一篇:二叉树(二)---线索化二叉树

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》