您好,登錄后才能下訂單哦!
1、搭建環境
主庫 oracle11gR2 備庫 oracle11gR2
db_name orcl orcl
db_unique_name orcl standby239
配置host文件
主庫:primaryHost 備庫:standbyHost
準備庫都置于歸檔模式。
2、配置靜態監聽
主備庫都配置
listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = /data/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /data/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = /data/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = standby239)
(ORACLE_HOME = /data/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
配置tnsnames.ora
主備庫配置
standby239 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standbyHost)(PORT = 1521))
(CONNECT_DATA =
(UR = A)
(SERVER = DEDICATED)
(SERVICE_NAME = standby239)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = primaryHost)(PORT = 1521))
(CONNECT_DATA =
(UR = A)
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
3、主備庫生成密碼文件
使用orapwd
orapwd file=$ORACLE_HOME/dbs/orapworcl password=xxxxx ignorecase=Y
4、生成standbylog
alter database add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby07.log') size 50m;
alter database add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby05.log') size 50m;
alter database add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby04.log') size 50m;
alter database add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby06.log') size 50m;
5、修改dg參數
主庫
alter system set db_unique_name=orcl scope=spfile;
alter system set log_archive_config='dg_config=(orcl,standby239)' scope=both;
alter system set log_archive_dest_1='location=/data/oracle/flash_recovery_area/ORCL valid_for=(all_logfiles,all_roles) db_unique_name=orcl' scope=both;
alter system set log_archive_dest_2='service=standby239 async lgwr valid_for=(online_logfiles,primary_role) db_unique_name=standby239' 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=standby239 scope=both;
alter system set fal_client=orcl scope=both;
alter system set standby_file_management=AUTO;
備庫
alter system set db_unique_name=standby239 scope=spfile;
alter system set log_archive_config='dg_config=(orcl,standby239)' scope=both;
alter system set log_archive_dest_1='location=/data/oracle/flash_recovery_area/ORCL valid_for=(all_logfiles,all_roles) db_unique_name=standby239' scope=both;
alter system set log_archive_dest_2='service=orcl async lgwr valid_for=(online_logfiles,primary_role) db_unique_name=orcl' 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=orcl scope=both;
alter system set fal_client=standby239 scope=both;
alter system set standby_file_management=AUTO;
6、使用rman duplicate主庫到備庫
將備庫置于未裝載狀態
rman target sys/xxxx auxiliary sys/xxxx@standby239
duplicate target database for standby nofilenamecheck from active database;
如果需要重命名的話,使用set newname for
7、將備庫置于active dataguard模式
alter database mount standby database;
alter database open read only;
alter database recover managed standby database disconnect from session;
或者 alter database recover managed standby database using current logfile disconnect from session;(實時應用日志模式)
這樣就可以實驗主庫和備庫的狀態了。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。