您好,登錄后才能下訂單哦!
地址規劃:
RAC: 1.1.1.62 rac5-vip
1.1.1.64 rac6-vip
db_name hxzg
db_unique_name hxzg
rac5-dg 1.1.1.68
db_name hxzg
db_unique_name hxzgdg
歸檔路徑:/archivelog
數據文件路徑:/oradata/hxzg/
一、基本環境準備
1、確認機器為歸檔模式
archive log list
2、開啟主庫的force logging
alter database force logging;
二、主庫的操作
2.1修改參數
alter database force logging;
alter system set log_archive_config='dg_config=(hxzg,hxzgdg)' scope=both;
alter system set log_archive_dest_1='location=+archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=hxzg';
alter system set LOG_ARCHIVE_DEST_2='SERVICE=hxzgdg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=hxzgdg' scope=both;
alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both;
alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both;
alter system set FAL_SERVER=hxzgdg scope=both;
alter system set FAL_CLIENT=hxzg1 scope=both;
alter system set STANDBY_FILE_MANAGEMENT=auto scope=both;
2.2 同步口令文件
略
三、配置網絡
tns配置
節點1/2/備庫的tnsnames.ora文件下添加如下內容:
hxzg1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.62)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.63)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = hxzg)
)
)
hxzgdg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.68)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = hxzgdg)
)
)
2、配置備庫的listener
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = prod)
(ORACLE_HOME = /oracle/app/db)
(SID_NAME = hxzgdg)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.1.1.68)(PORT = 1521))
)
)
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
四、備庫參數配置
獲取主庫的參數,在此基礎上進行修改
*.audit_file_dest='/oracle/app/oracle/admin/hxzg/adump'
*.audit_trail='db'
*.cluster_database=false
*.compatible='11.2.0.4.0'
*.control_files='/oradata/hxzg/control01.ctl'
*.db_block_size=8192
*.db_create_file_dest='/oradata/hxzg/'
*.db_domain=''
*.db_name='hxzg'
db_unique_name='hxzgdg'
*.db_recovery_file_dest_size=4621074432
*.diagnostic_dest='/oracle/app/oracle'
*.fal_client='HXZGDG'
*.fal_server='HXZG1'
*.log_archive_config='dg_config=(hxzg,hxzgdg)'
*.log_archive_dest_1='location=/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=hxzgdg'
*.log_archive_dest_2='SERVICE=hxzg1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=hxzg'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.memory_target=1200m
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='exclusive'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
--創建目錄
mkdir -p /oracle/app/oracle/admin/hxzg/adump
mkdir -p /oradata/hxzg
五、初始化數據庫
在主庫上執行備份動作
run
{
allocate channel ch2 type disk maxpiecesize =5120M;
allocate channel ch3 type disk maxpiecesize =5120M;
allocate channel ch4 type disk maxpiecesize =5120M;
allocate channel ch5 type disk maxpiecesize =5120M;
backup
AS COMPRESSED BACKUPSET
database filesperset 10 format '/backup/%d_DF_%T_%s_%p.bak';
backup AS COMPRESSED BACKUPSET
archivelog all format '/backup/%d_ARC_%T_%s_%p.bak';
backup format '/backup/ctrl_%d_%T_%s'
current controlfile for standby;
backup spfile format '/backup/spfile_%d_%T_%s';
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
}
2、在備庫上進行還原
RMAN> restore standby controlfile from '/backup/ctrl_HXZG_20171108_40';
RMAN>
run{
set newname for database to '/oradata/hxzg/%b';
restore database;
switch datafile all;
}
3、創建standbylogfile
alter database add standby logfile thread 1 group 5 ('/oradata/hxzg/st_1_logfile5') size 50M;
alter database add standby logfile thread 1 group 6 ('/oradata/hxzg/st_1_logfile6') size 50M;
alter database add standby logfile thread 1 group 7 ('/oradata/hxzg/st_1_logfile7') size 50M;
alter database add standby logfile thread 1 group 11 ('/oradata/hxzg/st_1_logfile11') size 50M;
alter database add standby logfile thread 2 group 8 ('/oradata/hxzg/st_2_logfile8') size 50M;
alter database add standby logfile thread 2 group 9 ('/oradata/hxzg/st_2_logfile9') size 50M;
alter database add standby logfile thread 2 group 10 ('/oradata/hxzg/st_2_logfile10') size 50M;
alter database add standby logfile thread 1 group 12 ('/oradata/hxzg/st_2_logfile12') size 50M;
啟動mrp
alter database recover mananged standby database using current logfile disconnect from session;
七、相關檢查
1 在主庫上檢查第二歸檔終點是否正常
select name,status,error from v$archive_dest;
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。