rhel6.4-11.2.0.3-RAC搭建單節點DG
RAC搭建單節點備庫ADG(active data guard)
掌握DG的核心思想,不管是單節點-單節點、RAC-單節點還是RAC-RAC,都差不多,本質是一樣的,come on
1、/etc/hosts RAC和備機保持一致即可
2、修改資料庫為強制日誌模式
SQL> select force_logging from v$database
SQL> alter database force logging
3、修改資料庫處於歸檔模式
SQL> select open_mode,log_mode from v$database;
4、在主庫上修改引數檔案
-------------------------------------------------------------------------------
Primary Database: Primary Role Initialization Parameters
-------------------------------------------------------------------------------
DB_NAME=chicago
DB_UNIQUE_NAME=chicago
LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'
CONTROL_FILES='/arch1/chicago/control1.ctl', '/arch2/chicago/control2.ctl'
LOG_ARCHIVE_DEST_1=
'LOCATION=/arch1/chicago/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=chicago'
LOG_ARCHIVE_DEST_2=
'SERVICE=boston ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=boston'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
-------------------------------------------------------------------------------
Primary Database: Standby Role Initialization Parameters
-------------------------------------------------------------------------------
FAL_SERVER=boston
DB_FILE_NAME_CONVERT='boston','chicago'
LOG_FILE_NAME_CONVERT=
'/arch1/boston/','/arch1/chicago/','/arch2/boston/','/arch2/chicago/'
STANDBY_FILE_MANAGEMENT=AUTO
-------------------------------------------------------------------------------
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(ora11g,beiku)';
SQL> show parameter LOG_ARCHIVE_DEST_1
SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=+data/ora11g/archivelog/ #歸檔位置可人為指定 VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ora11g';
SQL> alter system set LOG_ARCHIVE_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='/arch1/boston/control1.ctl', '/arch2/boston/control2.ctl'
DB_FILE_NAME_CONVERT='chicago','boston'
LOG_FILE_NAME_CONVERT=
'/arch1/chicago/','/arch1/boston/','/arch2/chicago/','/arch2/boston/'
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_1=
'LOCATION=/arch1/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=/arch1/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;
接下來就是驗證階段和主備切換
有需要,就繼續研究吧
掌握DG的核心思想,不管是單節點-單節點、RAC-單節點還是RAC-RAC,都差不多,本質是一樣的,come on
1、/etc/hosts RAC和備機保持一致即可
2、修改資料庫為強制日誌模式
SQL> select force_logging from v$database
SQL> alter database force logging
3、修改資料庫處於歸檔模式
SQL> select open_mode,log_mode from v$database;
4、在主庫上修改引數檔案
-------------------------------------------------------------------------------
Primary Database: Primary Role Initialization Parameters
-------------------------------------------------------------------------------
DB_NAME=chicago
DB_UNIQUE_NAME=chicago
LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'
CONTROL_FILES='/arch1/chicago/control1.ctl', '/arch2/chicago/control2.ctl'
LOG_ARCHIVE_DEST_1=
'LOCATION=/arch1/chicago/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=chicago'
LOG_ARCHIVE_DEST_2=
'SERVICE=boston ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=boston'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
-------------------------------------------------------------------------------
Primary Database: Standby Role Initialization Parameters
-------------------------------------------------------------------------------
FAL_SERVER=boston
DB_FILE_NAME_CONVERT='boston','chicago'
LOG_FILE_NAME_CONVERT=
'/arch1/boston/','/arch1/chicago/','/arch2/boston/','/arch2/chicago/'
STANDBY_FILE_MANAGEMENT=AUTO
-------------------------------------------------------------------------------
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(ora11g,beiku)';
SQL> show parameter LOG_ARCHIVE_DEST_1
SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=+data/ora11g/archivelog/ #歸檔位置可人為指定 VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ora11g';
SQL> alter system set LOG_ARCHIVE_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='/arch1/boston/control1.ctl', '/arch2/boston/control2.ctl'
DB_FILE_NAME_CONVERT='chicago','boston'
LOG_FILE_NAME_CONVERT=
'/arch1/chicago/','/arch1/boston/','/arch2/chicago/','/arch2/boston/'
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_1=
'LOCATION=/arch1/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=/arch1/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;
接下來就是驗證階段和主備切換
有需要,就繼續研究吧
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30310891/viewspace-1728967/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- dg搭建 單點-單點
- DG RAC - 單點搭建
- 單節點DG的switchover切換介紹
- consul 多節點/單節點叢集搭建
- 單節點DG的failover切換介紹AI
- mongo資料庫單節點搭建Go資料庫
- 一個節點rac+單節點dg網路配置(listener.ora與tnsnames.ora)
- 11g兩個節點RAC搭建單例項DG過程問題以及解決方法單例
- 11g 兩個節點RAC 搭建單例項DG詳細步驟以及注意事項單例
- oracle11g單節點DataGuard搭建Oracle
- 搭建RAC到單例項DG單例
- oracle11g單節點DGbroker搭建Oracle
- ORACLE 11G 建立 DATAGUARD(雙節點RAC-->單例項DG)Oracle單例
- hadoop叢集搭建——單節點(偽分散式)Hadoop分散式
- DG搭建
- 單機Linux下搭建MongoDB副本集-三節點LinuxMongoDB
- 主庫RAC,備庫單節點ASM的dataguard搭建ASM
- RAC 雙節點 轉單節點流程
- 【DG】搭建(一)
- MongoDB叢集搭建(包括隱藏節點,仲裁節點)MongoDB
- Oracle 11g單主搭建物理DGOracle
- duplicate搭建DG最大效能(rac-單例項)單例
- 基於minikube快速搭建kubernetes單節點環境
- linux下單節點oracle資料庫間ogg搭建LinuxOracle資料庫
- 4.2 叢集節點初步搭建
- DG搭建配置方案
- ROSE HA切換節點導致DG失敗、恢復ROS
- 透過RMAN備份搭建單節點ADG(oracle11g)Oracle
- greenplum單節點安裝
- DM8搭建2節點DMDSC
- Geth搭建多節點私有鏈條
- HAC叢集更改IP(單節點更改、全部節點更改)
- Oracle RAC+DG搭建Oracle
- RMAN不停機搭建DG
- ora11_node_dg(1)DG搭建過程
- 物理DG、邏輯DG和快照DG的搭建(視訊講解)
- 使用kubeadm搭建一單節點k8s測試叢集K8S
- vertica單節點安裝教程