这篇文章主要为大家展示了" rhel6.4-11.2.0.3-RAC如何搭建单节点DG ",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下" rhel6.4-11.2.0.3-RAC如何搭建单节点DG "这篇文章吧。
皇家汽车俱乐部搭建单节点备库ADG(现役数据卫士)
掌握承蒙天恩的核心思想,不管是单节点-单节点、RAC-单节点还是RAC-RAC,都差不多,本质是一样的,来吧
1 、/等/主机皇家汽车俱乐部和备机保持一致即可
2、修改数据库为强制日志模式
从五美元数据库中选择强制日志记录
结构化查询语言更改数据库强制日志记录
3、修改数据库处于归档模式
结构化查询语言从五美元数据库中选择打开模式、日志模式
4、在主库上修改参数文件
-
主数据库:主角色初始化参数
-
数据库名=芝加哥
数据库_唯一_名称=芝加哥
LOG _ ARCHIVE _ CONFIG=' DG _ CONFIG=(芝加哥、波士顿)'
CONtrol _ FILES='/arch2/Chicago/CONtrol 1。' CTL ','/arch3/chicago/control2.ctl '
日志_存档_DEST_1=
LOCATION=/arch2/chicago/
有效期=(所有日志文件,所有角色)
' DB_UNIQUE_NAME=chicago '
日志_存档_DEST_2=
SERVICE=boston ASYNC
有效期=(在线日志文件,主要角色)
数据库唯一名称=波士顿'
日志_存档_ DEST _状态_ 1=启用
日志_存档_ DEST _状态_ 2=启用
远程登录密码文件=独占
LOG _ ARCHIVE _ FORMAT=% t _ % s _ % r.arc
日志_存档_最大_进程=30
-
主数据库:备用角色初始化参数
-
FAL _ SERVER=波士顿
' DB_FILE_NAME_CONVERT='波士顿','芝加哥'
日志文件名称转换=
/arch2/波士顿/','/arch2/芝加哥/','/arch3/波士顿/','/arch3/芝加哥/'
待机文件管理=自动
-
SQL alter system set LOG _ ARCH _ CONFIG=' DG _ CONFIG=(ora 11g,beiku)';
SQL显示参数日志_阿奇_ DEST _ 1
SQL更改系统集日志_存档_ DEST _ 1='位置=数据/ora 11g/存档日志/#归档位置可人为指定VALID_FOR=(ALL_LOGFILES,ALL _ ROLES)DB _ UNIQUE _ NAME=ora 11g ';
' SQL alter system set LOG _ ARCH _ DEST _ 2='
;SERVICE=beiku ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=beiku';
SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=spfile;
SQL> alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=spfile;
SQL> alter system set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile;
SQL> show parameter LOG_ARCHIVE_FORMAT # 静态参数,重启生效
SQL> alter system set LOG_ARCHIVE_MAX_PROCESSES=30 scope=spfile;
-----------------------------------------------------------
SQL> alter system set fal_server=beiku scope=spfile;
SQL> alter system set fal_client=ora11g scope=spfile; # fal_client设置本身,fal_server是对方,检查归档是否断档
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO SCOPE=SPFILE;
SQL> ALTER SYSTEM SET DB_FILE_NAME_CONVERT='+data/ora11g/','/oracle/app/beiku/' scope =spfile; #静态参数,重启生效
SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='+data/ora11g/','/oracle/app/beiku/' scope =spfile; #静态参数,重启生效
5、配置监听lisener.ora、配置网络服务名tnsnames.ora
通常使用netca来进行配置,特殊情况手工配置
主备机相互验证tnsping service_names
6、将主机$ORACLE_HOME/dbs/下的密码文件orapwORACLE_SID传至备机,可以用ssh/ftp
7、在主机/home/oracle下创建控制文件并且传至备机/home/oracle
SQL> alter database create standby controlfile as '/home/oracle/control01.ctl';
8、在主机/tmp下创建初始化参数文件,并且传至备机$ORACLE_HOME/dbs/下
SQL> create pfile='/tmp/initORACLE_SID.ora' from spfile;
9、修改备机初始化参数文件
-------------------------------------------------------------------------------
Modifying Initialization Parameters for a Physical Standby Database
-------------------------------------------------------------------------------
DB_NAME=chicago
DB_UNIQUE_NAME=boston
LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'
CONTROL_FILES='/arch2/boston/control1.ctl', '/arch3/boston/control2.ctl'
DB_FILE_NAME_CONVERT='chicago','boston'
LOG_FILE_NAME_CONVERT=
'/arch2/chicago/','/arch2/boston/','/arch3/chicago/','/arch3/boston/'
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_1=
'LOCATION=/arch2/boston/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=boston'
LOG_ARCHIVE_DEST_2=
'SERVICE=chicago ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=chicago'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=chicago
-------------------------------------------------------------------------------
*.audit_file_dest='/oracle/app/admin/beiku/adump'
*.audit_trail='db'
*.cluster_database=false
*.compatible='11.2.0.0.0'
*.control_files='/oracle/app/beiku/control01.ctl', '/oracle/app/beiku/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='ora11g'
*.diagnostic_dest='/oracle/app'
*.log_archive_max_processes=30
*.memory_target=1264582656
*.open_cursors=300
*.processes=150
*.remote_listener='node-scan:1521'
*.remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
DB_UNIQUE_NAME=beiku
LOG_ARCHIVE_CONFIG='DG_CONFIG=(ora11g,beiku)'
DB_FILE_NAME_CONVERT='+data/ora11g/','/oracle/app/beiku/'
LOG_FILE_NAME_CONVERT='+data/ora11g/','/oracle/app/beiku/'
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_1='LOCATION=/arch2/beiku/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=beiku'
LOG_ARCHIVE_DEST_2='SERVICE=ora11g ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ora11g'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
STANDBY_FILE_MANAGEMENT=AUTO
FAL_SERVER=ora11g
-------------------------------------------------------------------------------
10、在主机做数据库的备份集并且把备份集传至备机/home/oracle
[oracle@node2 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jul 10 15:21:21 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11G (DBID=4275958693)
RMAN> backup database format '/home/oracle/racfull_%s_%p';
11、在备机用RMAN做复制STANDBY数据库操作
注:要用用户名和密码(sys/oracle)连接主库和备库
[oracle@jason ~]$ rman target sys/oracle@ora11g auxiliary sys/oracle
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jul 10 14:13:15 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11G (DBID=4275958693)
connected to auxiliary database: ORA11G (not mounted) #备库启到nomount阶段,实例已经起来
RMAN> duplicate target database for standby;
Starting Duplicate Db at 10-JUL-15
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=10 device type=DISK
contents of Memory Script:
{
restore clone standby controlfile;
}
executing Memory Script
Starting restore at 10-JUL-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/racfull_8_1
channel ORA_AUX_DISK_1: piece handle=/home/oracle/racfull_8_1 tag=TAG20150710T122559
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oracle/app/beiku/control01.ctl
output file name=/oracle/app/beiku/control02.ctl
Finished restore at 10-JUL-15
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/oracle/app/beiku/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/oracle/app/beiku/system01.dbf";
set newname for datafile 2 to
"/oracle/app/beiku/sysaux01.dbf";
set newname for datafile 3 to
"/oracle/app/beiku/undotbs01.dbf";
set newname for datafile 4 to
"/oracle/app/beiku/users01.dbf";
set newname for datafile 5 to
"/oracle/app/beiku/undotbs02.dbf";
set newname for datafile 6 to
"/oracle/app/beiku/jason01.dbf";
restore
clone database
;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /oracle/app/beiku/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 10-JUL-15
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /oracle/app/beiku/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oracle/app/beiku/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oracle/app/beiku/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oracle/app/beiku/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oracle/app/beiku/undotbs02.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /oracle/app/beiku/jason01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/racfull_7_1
channel ORA_AUX_DISK_1: piece handle=/home/oracle/racfull_7_1 tag=TAG20150710T122559
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 10-JUL-15
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=884700883 file name=/oracle/app/beiku/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=884700883 file name=/oracle/app/beiku/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=884700883 file name=/oracle/app/beiku/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=884700883 file name=/oracle/app/beiku/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=884700883 file name=/oracle/app/beiku/undotbs02.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=15 STAMP=884700883 file name=/oracle/app/beiku/jason01.dbf
Finished Duplicate Db at 10-JUL-15
RMAN>
结束后会自动将备库启到mount状态
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
beiku MOUNTED
打开备库,此时备库正处在最大性能模式
SQL> alter database open read only; #11gDG已经可以在open的状态下应用归档
Database altered.
SQL> select protection_mode,database_role,open_mode from v$database;
PROTECTION_MODE DATABASE_ROLE OPEN_MODE
-------------------- ---------------- --------------------
MAXIMUM PERFORMANCE PHYSICAL STANDBY READ ONLY
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> select sequence#,thread#,applied from v$archived_log; #在主库双节点分别切换日志alter system switch logfile,在备库显示如下,DG已运行正常
SEQUENCE# THREAD# APPLIED
---------- ---------- ---------
121 1 YES
119 1 YES
120 1 YES
118 1 YES
122 1 YES
151 2 YES
149 2 YES
150 2 YES
152 2 YES
153 2 YES
154 2 YES
SEQUENCE# THREAD# APPLIED
---------- ---------- ---------
155 2 YES
156 2 YES
157 2 YES
123 1 YES
158 2 YES
159 2 YES
160 2 YES
161 2 YES
162 2 YES
163 2 YES
164 2 YES
SEQUENCE# THREAD# APPLIED
---------- ---------- ---------
124 1 YES
125 1 YES
126 1 YES
165 2 YES
127 1 YES
128 1 YES
12、配置DG为最大可用模式
在备库要创建STANDBY REDO LOGFILE
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- --------------------------------------------------
2 /oracle/app/beiku/redo02.log
1 /oracle/app/beiku/redo01.log
3 /oracle/app/beiku/redo03.log
4 /oracle/app/beiku/redo04.log
SQL> alter database add standby logfile group 5 ('/oracle/app/beiku/standby_redo05.log') size 50m;
SQL> alter database add standby logfile group 6 ('/oracle/app/beiku/standby_redo06.log') size 50m;
SQL> alter database add standby logfile group 7 ('/oracle/app/beiku/standby_redo07.log') size 50m;
SQL> alter database add standby logfile group 8 ('/oracle/app/beiku/standby_redo08.log') size 50m;
SQL> alter database add standby logfile group 9 ('/oracle/app/beiku/standby_redo09.log') size 50m;
SQL> alter database set standbydatabase to maximize availability;
SQL> alter database recover managedstandby database using current logfile disconnect from session; #启动实时恢复
SQL>alter database recover managed standby database cancel;
以上是“rhel6.4-11.2.0.3-RAC如何搭建单节点DG”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/96669.html