数据库
首页 > 数据库> > rhel6+ oracle 11g rac +dg环境下添加 dg单节点云主机

rhel6+ oracle 11g rac +dg环境下添加 dg单节点云主机

作者:互联网

上云端新建DG库,master :代表主服务器,AWSDG:为新DG库:
下面是具体操作步骤:
1
master
$cd $ORACLE_HOME/dbs
scp orapweipdb1 oracle@awsdg_ip:$ORACLE_HOME/dbs
awsdg:
$cd $ORACLE_HOME/dbs/
mv orapwpdb1 orapwawsdg /

2 dg 的参数文件备份及修改到AWSDG
dg--init.ora--scp awsdg --change awsdg others info---initawsdg.ora
awsdg
3 awsdg 到 nomount
startup nomount pfile='/home/oracle/initawsdg.ora'

4 master 建控制文件 ; awsdg 用控制文件到mount;
master
alter database create standby controlfile as '/home/oracle/stdby_control01.ctl';
scp -r /home/oracle/stdby_control01.ctl' oracle@awsdg_ip:/home/oracle/
awsdg
sql>alter database mount standby database;

5 awsdg建议静态监听
awsdg
vi $ORACLE_HOME/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/app/product/11.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = awsdg)
(ORACLE_HOME = /u01/oracle/app/product/11.2.0/db_1)
(GLOBAL_DBNAME=awsdg)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
(ADDRESS = (PROTOCOL = TCP)(HOST = AWSDG_IP)(PORT = 1521))
)
)
6 awsdg 在tnsnames.ora中增加主库及自己的信息
PDB1=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = pip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID=eipdb1)
)
)

EIPDB2=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = pip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = vip )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID=eipdb2)
)
)

EIPDB=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan_ip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = eipdb)
)
)

EIPDBST=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = eipdbst)
)
)

AWSDG=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = awsdg_ip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = awsdg)
)
)
7 master 2 node 增加相awsdg选项
vi $ORACLE_HOME/network/admin/tnsnames.ora
AWSDG=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = awSDG_IP)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = awsdg)
)
)

8 awsdg删除后重新建standby logfile;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 9;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 10;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 11;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 12;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 13;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 14;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 15;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 16;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 17;
ALTER DATABASE DROP STANDBY LOGFILE GROUP 18;

alter database add standby logfile group 9 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo09.log' size 512m;
alter database add standby logfile group 10 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo10.log' size 512m;
alter database add standby logfile group 11 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo11.log' size 512m;
alter database add standby logfile group 12 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo12.log' size 512m;
alter database add standby logfile group 13 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo13.log' size 512m;
alter database add standby logfile group 14 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo14.log' size 512m;
alter database add standby logfile group 15 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo15.log' size 512m;
alter database add standby logfile group 16 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo16.log' size 512m;
alter database add standby logfile group 17 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo17.log' size 512m;
alter database add standby logfile group 18 '/u01/oracle/app/fast_recovery_area/AWSDG/onlinelog/awsdg_redo18.log' size 512m;

9 master 将asm中的文件转换成本地文件形式。
run {

copy archivelog '+DATA/PROD/1_29_856078807.arc' to '/home/oracle/1_29_856078807.arc';

copy archivelog '+DATA/PROD/1_30_856078807.arc' to '/home/oracle/1_30_856078807.arc';

copy archivelog '+DATA/prod/2_14_856078807.arc' to '/home/oracle/2_14_856078807.arc';

copy archivelog '+DATA/prod/2_15_856078807.arc' to '/home/oracle/2_15_856078807.arc';

copy archivelog '+DATA/prod/2_16_856078807.arc' to '/home/oracle/2_16_856078807.arc';

}
scp 到awsdg指定路径下

10 aws注册相关archivelog日志

alter database register logfile '/arch/sdyprod/1_29_856078807.arc';

……

Database altered.

SQL> alter database register logfile '/arch/sdyprod/2_16_856078807.arc';

Database altered.
11 更改主库的相关设置,两节点都要做
alter system set log_archive_dest_3='SERVICE=awsdg lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=awsdg';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_3=ENABLE;
alter system set log_archive_config='(EIPDB,eipdbst,awsdg)';//后边两个为DG库的services name名

12 awsdg 开启应用:
alter database open;
alter database recover managed standby database using current logfile disconnect;

标签:rhel6,11g,database,standby,dg,oracle,awsdg,logfile,alter
来源: https://blog.51cto.com/6247406/2540893