Oracle 11G 搭建Dataguard步骤


ORACLEORACLEORACLEORACLE 11G11G11G11G 搭建DATAGUARD DATAGUARD DATAGUARD DATAGUARD 步骤 1111 安装环境 在主机 1上安装数据库软件 ,并建监听和实例 ,在主机 2上安装数据库软件 , 并建监听,但不建实例。 主机 1 主机 2 操作系统 redhat6.1 64 位redhat6.1 64 位 主机名 dg1 db2 IP 192.168.132.3 192.168.132.4 数据库软件版本 oracle 11.2.0.1.0 oracle 11.2.0.1.0 ORACLE_BASE/oracle/app/oracle/ /oracle/app/oracle/ ORACLE_HOME $ORACLE_BASE/product/11.2.0/ db_1 $ORACLE_BASE/product/11.2.0/ db_1 ORACLE_SID dbtest 闪回区 4G 归档 开启 2222 主数据库配置 2.12.12.12.1 设置数据库强制归档 sqlplus / as sysdba SQL> ALTERDATABASEFORCELOGGING; SQL> select force_logging from v$database; FOR --- YES 2.22.22.22.2 添加STANDBY STANDBY STANDBY STANDBY 日志文件 SQL>alter database add standby logfile group 4 ('/oradata/dbtest/redo04.log') size 50m; SQL>alter database add standby logfile group 5 ('/oradata/dbtest/redo05.log') size 50m; SQL>alter database add standby logfile group 6 ('/oradata/dbtest/redo06.log') size 50m; SQL>alter database add standby logfile group 7 ('/oradata/dbtest/redo07.log') size 50m; SQL> select * from v$logfile order by 1; 2.32.32.32.3 修改参数文件 2.3.12.3.12.3.12.3.1 生成pfilepfilepfilepfile SQL>create pfile from spfile; SQL>shutdown immediate; 2.3.22.3.22.3.22.3.2 修改pfilepfilepfilepfile vi $ORACLE_HOME/dbs/initdbtest.ora 在最后添加如下内容: *.db_unique_name=dbtest1 *.fal_server='dbtest1' *.fal_client='dbtest2' *.standby_file_management=auto *.db_file_name_convert='/oradata/dbtest/','/oradata/dbtest/' *.log_file_name_convert='/oradata/dbtest/','/oradata/dbtest/' *.log_archive_config='dg_config=(dbtest1,dbtest2)' *.log_archive_dest_2='service=dbtest2 LGWRSYNCAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=dbtest2' *.log_archive_dest_state_2='ENABLE' 2.3.32.3.32.3.32.3.3 生成spfilespfilespfilespfile SQL> create spfile from pfile; File created. 2.42.42.42.4 修改监听配置文件 2.52.52.52.5 修改TNS TNS TNS TNS 配置文件 [oracle@dg1 admin]$ cat tnsnames.ora # tnsnames.ora Network Configuration File: /oracle/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. DBTEST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.132.3)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbtest1) ) ) DBTEST1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.132.3)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbtest1) ) ) DBTEST2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.132.4)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbtest2) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) ) 2.62.62.62.6 重启监听服务 lsnrctl stop lsnrctl start 2.72.72.72.7 配置最大可用模式 SQL> startup ORACLE instance started SQL> alter database set standby database to maximize availability; Database altered. SQL> exit 2.82.82.82.8 备份数据库 [oracle@dg1 admin]$ rman target / RMAN> backup database plus archivelog; RMAN> backup current controlfile for standby; RMAN> exit 备份完成后会在闪回区生产备份文件 3333 备数据库配置 3.13.13.13.1 建立相应的文件目录 包括 dump 文件目录 ,闪回区 ,数据文件目录 ,可以通过 show parameter dest 命令查看 mkdir -p /oracle/app/oracle/admin/dbtest/adump mkdir -p /oracle/app/oracle/admin/dbtest/dpdump mkdir -p /oracle/app/oracle/diag/rdbms/dbtest1/dbtest/trace mkdir -p /oracle/app/oracle/diag/rdbms/dbtest1/dbtest/cdump mkdir -p /oracle/app/oracle/flash_recovery_area mkdir -p /oradata/dbtest 3.23.23.23.2 从主数据库服务器上拷贝文件 注意:下面命令在主数据库上执行 3.2.13.2.13.2.13.2.1 拷贝闪回区内容 [oracle@dg1 admin]$ cd /oracle/app/oracle/flash_recovery_area scp -r ./* 192.168.132.4:/oracle/app/oracle/flash_recovery_area/ 3.2.23.2.23.2.23.2.2 拷贝参数文件 [oracle@dg1 flash_recovery_area]$ cd $ORACLE_HOME/dbs scp ./* 192.168.132.4:/oracle/app/oracle/product/11.2.0/db_1/dbs/ 3.2.33.2.33.2.33.2.3 拷贝监听文件 [oracle@dg1 dbs]$ cd ../network/admin/ scp *.ora 192.168.132.4:/oracle/app/oracle/product/11.2.0/db_1/network/admin/ 3.33.33.33.3 修改监听配置文件 修改 ip地址 3.43.43.43.4 修改TNS TNS TNS TNS 配置文件 修改 ip地址 3.53.53.53.5 重启监听服务 lsnrctl stop lsnrctl start 3.63.63.63.6 恢复数据库 [oracle@dg2 admin]$ rman target sys/funo1234@dbtest1 auxiliary / RMAN> duplicate target database for standby nofilenamecheck; RMAN> exit 3.73.73.73.7 修改参数文件 [oracle@dg2 admin]$ sqlplus / as sysdba SQL> shutdown immediate; vi $ORACLE_HOME/dbs/initdbtest.ora 修改如下内容 *.db_unique_name=dbtest2 SQL> create spfile from pfile; 3.83.83.83.8 启动数据库 SQL> startup nomount; SQL> alter database mount standby database; SQL> alter database add standby logfile; SQL> alter database add standby logfile; SQL> alter database add standby logfile; SQL> alter database add standby logfile; SQL> alter database recover managed standby database using current logfile disconnect from session; 3.93.93.93.9 验证 主库备库均执行如下命令: SQL> archive log list; 主库 备库 如果最后一行数字相同,说明配置成功 3.103.103.103.10 切换到只读模式 SQL> alter database recover managed standby database cancel; SQL> alter database open read only; 3.113.113.113.11 切换到同步模式 SQL> shutdown immediate; SQL> startup nomount; SQL> alter database mount standby database; SQL> alter database recover managed standby database using current logfile disconnect from session;
还剩7页未读

继续阅读

下载pdf到电脑,查找使用更方便

pdf的实际排版效果,会与网站的显示效果略有不同!!

需要 8 金币 [ 分享pdf获得金币 ] 0 人已下载

下载pdf

pdf贡献者

li6026

贡献于2015-04-27

下载需要 8 金币 [金币充值 ]
亲,您也可以通过 分享原创pdf 来获得金币奖励!
下载pdf