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

地址规划:

成都创新互联公司服务项目包括南城网站建设、南城网站制作、南城网页制作以及南城网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,南城网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到南城省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

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;


文章题目:ADG系列之oraclerac到单机的ADG环境搭建
链接分享:http://ybzwz.com/article/giphjd.html