ORACLE RAC ASM环境下DATAGUARD搭建步骤
1、准备工作
Host IP DB_NAME DB_UNIQUE_NAME Net Service Name
主库192.168.1.209 imsdb imsdb imsdb , imsdb1, imsdb2
oracle11g 创建数据库备库192.168.1.42 imsdb imsdb_s imsdb_s, imsdb_s imsdb_s
保护模式:默认最大性能模式
注意DataGuard正常启动顺序:
注意DataGuard正常启动顺序:
启动顺序: 先standby ,后imsdbmary;
关闭顺序: 先imsdbmary ,后standby;
数据库版本:11.2.0.3.0
1.1、[主库]备份数据库、参数文件、控制文件
ASMCMD> a a
a /u01
---oracle---
export ORACLE_SID=imsdb1
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
cd /u01/app/oracle/product/11.2.0/dbhome_1/bin
./sqlplus /nolog
export ORACLE_SID=imsdb2
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
cd /u01/app/oracle/product/11.2.0/dbhome_1/bin
----oracle----------------
export ORACLE_SID=+ASM2
export ORACLE_HOME=/opt/11.2.0/grid
cd /opt/11.2.0/grid/bin
备份参数文件:
SQL>create pfile=’ +DATA/’ from spfile=’ +DATA/a’;
a /data/11.2.0/a
cp /data/11.2.0/a +DATA/imsdb
备份控制文件:
cp 备份,手工复制, alter database backup controlfile to trace;
备份数据库:
$ rman target /
RMAN> backup full database format '/backup/backup_%T_%s_%p.bak';
Startup nomount pfile=’/u01/11.2.0/oracle/product/11.2.0/a’
1.2、[主库]检查数据库是否支持Data Guard,是否归档模式,Enable force logging
$ sqlplus '/as sysdba'
确认主库处于归档模式
SQL> archive log list (先检查是否归档模式,不是则修改)
startup mount
alter database archivelog;
alter database open;
将imsdbmary数据库置为FORCE LOGGING模式
SQL> alter database force logging; (强制产生日志)
SQL> select force_logging from v$database;
1.3、[主库]如果主库没有密码文件则建立密码文件,从而可以OS验证的方式登陆(此步骤省略)
$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=oracle entries=5
若主库存在密码文件,则需要将文件拷贝到备库$ORACLE_HOME/dbs
1.4、[主库]设置主库初始化参数
$ sqlplus '/as sysdba'
修改主库参数
alter system set db_unique_name=imsdb scope=spfile;
alter system set log_archive_config = 'DG_CONFIG=(imsdb,imsdb_s)' scope=spfile;
alter system set log_archive_dest_1='LOCATION=/oraback/backup/log/ VALID_FOR=(ALL
_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=imsdb' sid='imsdb2' scope=spfile;
alter system set log_archive_dest_1='LOCATION=/oraback/backup/log/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=imsdb' sid='imsdb1' scope=spfile;
alter system set log_archive_dest_2 = 'SERVICE=imsdb_s reopen=60 lgwr async VALID_FOR=( ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=imsdb_s' scope=spfile;
alter system set log_archive_dest_state_1 = ENABLE;
alter system set log_archive_dest_state_2 = disable;
alter system set log_archive_dest_state_3 = ENABLE;
alter system set fal_server=imsdb scope=spfile;
alter system set fal_client=imsdb_s scope=spfile;
alter system set db_file_name_convert='/data/oradata/imsdb/','+DATA1/imsdb/datafile/',’'/data/oradata/imsdb/','+DATA1/imsdb/tempfile scope=spfile ;
alter system set log_file_name_convert='/data/oradata/imsdb/','+DATA1/imsdb/onlinelog/' scope=spfile ;
alter system set standby_file_management='AUTO' scope=both;
然后重启数据库:
SQL> shutdown immediate
SQL> startup;
1.5、[备库]上修改配置a文件,添加静态监听
备库
grid@mylxd0005.intranet.local:/grid/product/11.2.0.4/network/admin >a
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = imsdb)
(ORACLE_HOME = /app/oracle/11.2.0/db_1)
(SID_NAME = imsdb)
)
)
)
1.6、[主/备库]上修改配置a文件
1.6.1、主库配置:
--$ORACLE_HOME/network/admin 修改ORACLE_HOME目录下的a
/u01/11.2.0/oracle/product/11.2.0/network/a
imsdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.209)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = imsdb)
)
)
imsdb_s =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.42)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = imsdb)
)
)
Imsdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.201)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = imsdb1)
)
)
1.6.2、备份库配置:
imsdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.209)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论