Physical Standby Database (11g)-ADG
2019獨角獸企業重金招聘Python工程師標準>>>
一、主庫打開forcelogging
startup mount;
alter database force logging;
二、主 ?備 庫配置監聽
主:listener.oraSID_LIST_LISTENER?=?(SID_LIST?=??????(SID_DESC?=?????????????(GLOBAL_DBNAME?=?primary)?????????????(ORACLE_HOME?=?/u01/app/oracle/product/11.2.0/db_1)????????(SID_NAME?=?primary)?????????))???LISTENER?=??(DESCRIPTION_LIST?=????(DESCRIPTION?=??????(ADDRESS?=?(PROTOCOL?=?IPC)(KEY?=?EXTPROC1521))??????(ADDRESS?=?(PROTOCOL?=?TCP)(HOST?=?primary)(PORT?=?1521))????)??)??備:listener.oraSID_LIST_LISTENER?=?(SID_LIST?=??????(SID_DESC?=?????????????(GLOBAL_DBNAME?=?standby)?????????????(ORACLE_HOME?=?/u01/app/oracle/product/11.2.0/db_1)????????(SID_NAME?=?standby)?????????))???LISTENER?=??(DESCRIPTION_LIST?=????(DESCRIPTION?=??????(ADDRESS?=?(PROTOCOL?=?IPC)(KEY?=?EXTPROC1521))??????(ADDRESS?=?(PROTOCOL?=?TCP)(HOST?=?standby)(PORT?=?1521))????)??)??主、備:tnsnames.oraPRIMARY?=??(DESCRIPTION?=????(ADDRESS?=?(PROTOCOL?=?TCP)(HOST?=?primary)(PORT?=?1521))????(CONNECT_DATA?=??????(SERVER?=?DEDICATED)??????(SERVICE_NAME?=?primary)????)??)?STANDBY?=??(DESCRIPTION?=????(ADDRESS?=?(PROTOCOL?=?TCP)(HOST?=?standby)(PORT?=?1522))????(CONNECT_DATA?=??????(SERVER?=?DEDICATED)??????(SERVICE_NAME?=?standby)????)??)三、主庫配置DG參數
配置spfile信息
alter system set db_name='primary' scope=spfile;
-- 主備db_name必須一致;
alter system set db_unique_name='primary' scope=spfile;
alter system set log_archive_config='DG_CONFIG=(primary,standby)' scope=spfile;
alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/fast_recovery_area valid_for=(all_logfiles,all_roles) db_unique_name=primary' ?scope=spfile;
alter system set log_archive_dest_2='SERVICE=standby lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=standby' scope=spfile;
--注意每一個=前后均不能有空格,否則報錯;
alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE;
alter system set standby_file_management=AUTO scope=spfile;
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
alter system set fal_server=primary scope=spfile;--11g中fal參數已被廢除,fal-fetch archivelog 進程,一般情況下看不到此進程;
alter system set fal_client=standby scope=spfile;
?
shutdown abort;
startup;
?
四、主 備 庫創建密碼文件【一 至 四 保證主庫處于mount或者以下】
orapwd?file=orapw$ORACLE_SID?password=redhat?entries=5??--主庫orapwd?file=orapw$ORACLE_SID?password=redhat?entries=5??--備庫五、主庫手動創建pfile并傳到備庫
create pfile='/tmp/initstandby.ora' from spfile;
scp -r $ORACLE_BASE/admin/ ?$ORACLE_BASE/diag/ $ORACLE_BASE/oradata/ ?$ORACLE_BASE/fast_recovery_area/ standby:/$ORACLE_BASE
六、復制數據文件到備庫
scp?-r?$ORACLE_BASE/admin/??$ORACLE_BASE/diag/?$ORACLE_BASE/oradata/??$ORACLE_BASE/fast_recovery_area/?standby:/$ORACLE_BASE說明:其實傳過去的數據,備庫并不使用。備庫使用的是主庫的目錄!
七、利用指定的pfile復制出來的spfile打開備庫到nomount狀態
create?spfile?from?pfile='$ORACLE_HOME/dbs/initstandby.ora'startup?nomount;八、備庫創建相關配置參數
備庫配置
利用主庫傳過來的pfile啟動到nomount狀態,并配置如下:
?
create spfile from pfile='$ORACLE_HOME/dbs/initstandby.ora'
startup nomount;
alter system set db_name=primary scope=spfile;
alter system set db_unique_name=standby scope=spfile;
alter system set log_archive_config='DG_CONFIG=(primary,standby)' scope=spfile;
alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/fast_recovery_area valid_for=(all_logfiles,all_roles) db_unique_name=standby' ?scope=spfile;
alter system set log_archive_dest_2='SERVICE=primary lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=primary' scope=spfile;
alter system set standby_file_management=AUTO scope=spfile;
alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
alter system set fal_server=standby scope=spfile; ?
alter system set fal_client=primary scope=spfile;
shutdown abort;
startup nomount;
create pfile from spfile;
九、主庫利用rman duplicate 創建備庫
rman?target?sys/redhat@primary?auxiliary?sys/redhat@standby?nocatalogduplicate?target?database?for?standby?from?active?database?nofilenamecheck;十、查看備庫并open備庫
--備庫創建后會自動mount
alter database open;
十一、主 ?備 庫增加 standby 日志
a.先查看本地log大小以及路徑?select?a.bytes,a.members,b.status,b.member?from?v$log?a,v$logfile?b?where?a.group#=b.group#;?b.在primary/standby創建4組standby?logalter?database?add?standby?logfile?group?4?'/u01/app/oracle/oradata/primary/redo04.log'?size?50m?;alter?database?add?standby?logfile?group?5?'/u01/app/oracle/oradata/primary/redo05.log'?size?50m?;alter?database?add?standby?logfile?group?6?'/u01/app/oracle/oradata/primary/redo06.log'?size?50m;alter?database?add?standby?logfile?group?7?'/u01/app/oracle/oradata/primary/redo07.log'?size?50m;十二、打開備庫實時應用日志,打開flashback功能
recover managed standby database using current logfile disconnect from session;
注意:
主庫的flashback on 可以在線打開;
備庫的flashback on必須按如下步驟操作:
SQL>?select?flashback_on?from?v$database;?FLASHBACK_ON------------------NO?SQL>?alter?database?recover?managed?standby?database?cancel;?Database?altered.?SQL>?alter?database?flashback?on;?Database?altered.?SQL>??alter?database?recover?managed?standby?database?disconnect?from?session;?Database?altered.?SQL>?select?flashback_on?from?v$database;?FLASHBACK_ON------------------YES十三、相關測試
創建表空間以及相關數據,發現備庫秒看
至此11g物理DG配置完畢!
轉載于:https://my.oschina.net/1272149624/blog/618290
總結
以上是生活随笔為你收集整理的Physical Standby Database (11g)-ADG的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小米8断流是什么意思(小米官方售后服务)
- 下一篇: 小米8相当于苹果几(小米官方售后服务)