日志在寫滿以后會自動進行切換的,當然沒有寫滿時也可以進行手工方式強制切換 alter system switch logfile;
創(chuàng)新互聯(lián)公司專注于兩當網(wǎng)站建設服務及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供兩當營銷型網(wǎng)站建設,兩當網(wǎng)站制作、兩當網(wǎng)頁設計、兩當網(wǎng)站官網(wǎng)定制、成都微信小程序服務,打造兩當網(wǎng)絡公司原創(chuàng)品牌,更為您提供兩當網(wǎng)站排名全網(wǎng)營銷落地服務。
這個我就實在不知道了,9I上好你沒有這個參數(shù)吧。找人問了問,人家也沒說。
本文對Oracle11g中的自動數(shù)據(jù)庫維護任務管理做一個總體介紹,文章保持簡潔出于兩個原因: 1、大部分人都還沒有接觸過這些設置。盡管這么說,如果你是在夜間處理維護任務的,如果在晚上打開一個維護窗口并不是一個好主意,你可能想要改變這一切。2、基本的管理任務都是自我控
dataguard的熱備就是就是邏輯DG(有一點延遲,但是基本上數(shù)據(jù)量不大的話,還是可以的),現(xiàn)在用的不多,現(xiàn)在應用多的一般都是物理DG。因為物理DG比邏輯dg更加穩(wěn)定,而且不會出現(xiàn)太大的資源調(diào)用,影響系統(tǒng)。
自動切換這里,要說明,dg的切換是有一套流程的,都可以自動有腳本完成,但是最后一步一定是手動的,所以不能完成全自動切換,最多就是半自動。
oracle dg 三大模式切換
1、最大性能模式MAXIMUM PERFORMANCE --默認模式,最大性能模式特點。
192.168.1.181
SQL?select?database_role,protection_mode,protection_level?from?v$database;
DATABASE_ROLE??PROTECTION_MODE???PROTECTION_LEVEL
----------------?--------------------?--------------------
PRIMARY?????MAXIMUM?PERFORMANCE?MAXIMUM?PERFORMANCE
SQL?col?dest_name?for?a25
SQL?select?dest_name,status?from?v$archive_dest_status;
DEST_NAME?????????STATUS
-------------------------?---------
LOG_ARCHIVE_DEST_1????VALID
LOG_ARCHIVE_DEST_2????VALID
SQL?show?parameter?log_archive
NAME?????????????????TYPE????VALUE
------------------------------------?-----------?---------------------------
log_archive_config??????????string???dg_config=(orcl,db01)
log_archive_dest_1??????????string???location=/home/oracle/arch_orc
l?valid_for=(all_logfiles,all_
roles)?db_unique_name=orcl
log_archive_dest_2??????????string???service=db_db01?LGWR?ASYNC?val
id_for=(online_logfiles,primar
y_roles)?db_unique_name=db01
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_orcl
Oldest?online?log?sequence???31
Next?log?sequence?to?archive??33
Current?log?sequence??????33
192.168.1.183
SQL?select?database_role,protection_mode,protection_level?from?v$database;
DATABASE_ROLE??PROTECTION_MODE???PROTECTION_LEVEL
----------------?--------------------?--------------------
PHYSICAL?STANDBY?MAXIMUM?PERFORMANCE?MAXIMUM?PERFORMANCE
SQL?col?dest_name?for?a25
SQL?select?dest_name,status?from?v$archive_dest_status;
DEST_NAME?????????STATUS
-------------------------?---------
LOG_ARCHIVE_DEST_1????VALID
LOG_ARCHIVE_DEST_2????VALID
SQL?show?parameter?log_archive
NAME?????????????????TYPE????VALUE
------------------------------------?-----------?---------------------------
log_archive_config??????????string???dg_config=(db01,orcl)
log_archive_dest_1??????????string???location=/home/oracle/arch_db0
1?valid_for=(all_logfiles,all_
roles)?db_unique_name=db01
log_archive_dest_2??????????string???service=db_orcl?LGWR?ASYNC?val
id_for=(online_logfiles,primar
y_roles)?db_unique_name=orcl
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_orcl
Oldest?online?log?sequence???31
Next?log?sequence?to?archive??33
Current?log?sequence??????33
192.168.1.181
SQL?alter?system?switch?logfile;
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_orcl
Oldest?online?log?sequence???32
Next?log?sequence?to?archive??34
Current?log?sequence??????34
192.168.1.183
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_db01
Oldest?online?log?sequence???32
Next?log?sequence?to?archive??0
Current?log?sequence??????34
2 、最大性能模式--切換到--最大高可用 ?(默認是最大性能模式---MAXIMUM PERFORMANCE)。
192.168.1.181
SQL?select?DATABASE_ROLE,PROTECTION_MODE,PROTECTION_LEVEL?from?v$database;?
DATABASE_ROLE??PROTECTION_MODE???PROTECTION_LEVEL
----------------?--------------------?--------------------
PRIMARY?????MAXIMUM?PERFORMANCE?MAXIMUM?PERFORMANCE
SQL?show?parameter?log_archive_dest_2
NAME?????????????????TYPE????VALUE
------------------------------------?-----------?---------------------------
log_archive_dest_2??????????string???service=db_db01?LGWR?ASYNC?val
id_for=(online_logfiles,primar
y_roles)?db_unique_name=db01
192.168.1.181
SQL?shutdown?immediate
192.168.1.183
SQL?alter?database?recover?managed?standby?database?cancel;
SQL?shutdown?immediate
192.168.1.181
SQL?startup?mount;
SQL?alter?database?set?standby?database?to?maximize?availability;
SQL?alter?system?set?log_archive_dest_2='service=db_db01?LGWR?SYNC?valid_for=(online_logfiles,primary_roles)?db_unique_name=db01'?scope=spfile;
192.168.1.183
SQL?startup?nomount
SQL?alter?database?mount?standby?database;
SQL?alter?system?set?log_archive_dest_2='service=db_orcl?LGWR?SYNC?valid_for=(online_logfiles,primary_roles)?db_unique_name=orcl'?scope=spfile;
SQL?shutdown?immediate
SQL?startup?nomount
SQL?alter?database?mount?standby?database;
192.168.1.181
SQL?startup
SQL?col?dest_name?for?a25
SQL?select?dest_name,status?from?v$archive_dest_status;
DEST_NAME?????????STATUS
-------------------------?---------
LOG_ARCHIVE_DEST_1????VALID
LOG_ARCHIVE_DEST_2????VALID
SQL?show?parameter?log_archive_dest_2
NAME?????????????????TYPE????VALUE
------------------------------------?-----------?---------------------------
log_archive_dest_2??????????string???service=db_db01?LGWR?SYNC?vali
d_for=(online_logfiles,primary
_roles)?db_unique_name=db01
SQL?select?database_role,protection_level,protection_mode?from?v$database;
DATABASE_ROLE??PROTECTION_LEVEL???PROTECTION_MODE
----------------?--------------------?--------------------
PRIMARY?????MAXIMUM?AVAILABILITY?MAXIMUM?AVAILABILITY
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_orcl
Oldest?online?log?sequence???34
Next?log?sequence?to?archive??36
Current?log?sequence??????36
192.168.1.183
SQL?col?dest_name?for?a25
SQL?select?dest_name,status?from?v$archive_dest_status;
DEST_NAME?????????STATUS
-------------------------?---------
LOG_ARCHIVE_DEST_1????VALID
LOG_ARCHIVE_DEST_2????VALID
SQL?show?parameter?log_archive_dest_2
NAME?????????????????TYPE????VALUE
------------------------------------?-----------?---------------------------
log_archive_dest_2??????????string???service=db_orcl?LGWR?SYNC?vali
d_for=(online_logfiles,primary
_roles)?db_unique_name=orcl
SQL?select?database_role,protection_level,protection_mode?from?v$database;
DATABASE_ROLE??PROTECTION_LEVEL???PROTECTION_MODE
----------------?--------------------?--------------------
PHYSICAL?STANDBY?MAXIMUM?AVAILABILITY?MAXIMUM?AVAILABILITY
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_db01
Oldest?online?log?sequence???35
Next?log?sequence?to?archive??0
Current?log?sequence??????36
192.168.1.181
SQL?alter?system?switch?logfile;
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_orcl
Oldest?online?log?sequence???35
Next?log?sequence?to?archive??37
Current?log?sequence??????37
192.168.1.183
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_db01
Oldest?online?log?sequence???36
Next?log?sequence?to?archive??0
Current?log?sequence??????37
3、最大高可用--切換到--最保護能模式,DG最大保護模式Maximum protection。
192.168.1.181
SQL?shutdown?immediate
192.168.1.183
SQL?shutdown?immediate
192.168.1.181
SQL?alter?database?set?standby?database?to?maximize?protection;
SQL?shutdown?immediate
192.168.1.183
SQL?startup?nomount
SQL?alter?database?mount?standby?database;
192.168.1.181
SQL?startup
SQL?col?dest_name?for?a25
SQL?select?dest_name,status?from?v$archive_dest_status;
DEST_NAME?????????STATUS
-------------------------?---------
LOG_ARCHIVE_DEST_1????VALID
LOG_ARCHIVE_DEST_2????VALID
SQL?show?parameter?log_archive_dest_2
NAME?????????????????TYPE????VALUE
------------------------------------?-----------?---------------------------
log_archive_dest_2??????????string???service=db_db01?LGWR?SYNC?vali
d_for=(online_logfiles,primary
_roles)?db_unique_name=db01
SQL?select?database_role,protection_level,protection_mode?from?v$database;
DATABASE_ROLE??PROTECTION_LEVEL???PROTECTION_MODE
----------------?--------------------?--------------------
PRIMARY?????MAXIMUM?PROTECTION??MAXIMUM?PROTECTION
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_orcl
Oldest?online?log?sequence???37
Next?log?sequence?to?archive??39
Current?log?sequence??????39
192.168.1.183
SQL?col?dest_name?for?a25
SQL?select?dest_name,status?from?v$archive_dest_status;
DEST_NAME?????????STATUS
-------------------------?---------
LOG_ARCHIVE_DEST_1????VALID
LOG_ARCHIVE_DEST_2????VALID
SQL?show?parameter?log_archive_dest_2
NAME?????????????????TYPE????VALUE
------------------------------------?-----------?---------------------------
log_archive_dest_2??????????string???service=db_db01?LGWR?SYNC?vali
d_for=(online_logfiles,primary
_roles)?db_unique_name=db01
SQL?select?database_role,protection_level,protection_mode?from?v$database;
DATABASE_ROLE??PROTECTION_LEVEL???PROTECTION_MODE
----------------?--------------------?--------------------
PRIMARY?????MAXIMUM?PROTECTION??MAXIMUM?PROTECTION
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_db01
Oldest?online?log?sequence???37
Next?log?sequence?to?archive??0
Current?log?sequence??????39
192.168.1.181
SQL?alter?system?switch?logfile;
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_orcl
Oldest?online?log?sequence???38
Next?log?sequence?to?archive??40
Current?log?sequence??????40
192.168.1.183
SQL?archive?log?list
Database?log?mode???????Archive?Mode
Automatic?archival???????Enabled
Archive?destination??????/home/oracle/arch_db01
Oldest?online?log?sequence???37
Next?log?sequence?to?archive??0
Current?log?sequence??????40
1~盡量別用不標準的SQL。但是分頁之類的語句沒辦法避免,只能夠加參數(shù)動態(tài)在mybtais配置文件中切換。
2~mybtais用的時候別偷懶用接口自動生成dao的方式,dao還是老老實實在代碼實現(xiàn)多個數(shù)據(jù)源切換。