溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Dataguard環(huán)境修改主庫和standby庫online redo log&standby redo log大小

發(fā)布時(shí)間:2020-08-07 19:07:12 來源:ITPUB博客 閱讀:287 作者:guocun09 欄目:關(guān)系型數(shù)據(jù)庫

當(dāng)前環(huán)境:

Oracle 11.0.2.4  primary+standby

3組redo log group(每組200M),4組standby redo log

因?yàn)闃I(yè)務(wù)增加日誌切換頻繁,計(jì)劃修改redo logfile 到250M

select * from v$logfile

1        ONLINE    /data/mes/redo01.log

2        ONLINE    /data/mes/redo02.log

3        ONLINE    /data/mes/redo03.log

11        STANDBY    /data/mes/standbylog11.log

12        STANDBY    /data/mes/standbylog12.log

13        STANDBY    /data/mes/standbylog13.log

14        STANDBY    /data/mes/standbylog14.log


分析說明:

1>  因?yàn)閞edo logfile不能直接修改大小,計(jì)劃先新增log group后,再刪除原log group

2>  因?yàn)閐ataguard環(huán)境涉及到主庫和standby的redo log、standby redo log相對(duì)複雜,分為下面8個(gè)步驟


具體步驟:

1. Standby 增加standby redo log

SQL> alter database recover managed standby database cancel;

Database altered.

 

SQL> alter database add standby logfile group 31 ('/data/mes/standbylog31.log') size 250M;

 

Database altered.

 

SQL> alter database add standby logfile group 32 ('/data/mes/standbylog32.log') size 250M;

 

Database altered.

 

SQL> alter database add standby logfile group 33 ('/data/mes/standbylog33.log') size 250M;

 

Database altered.

 

SQL> alter database add standby logfile group 34 ('/data/mes/standbylog34.log') size 250M;

 

Database altered.

 

2. Standby 上刪除原standby redo log

SQL> alter database drop logfile group 11;

 

Database altered.

 

SQL> alter database drop logfile group 12;   

 

Database altered.

 

SQL> alter database drop logfile group 13;       

 

Database altered.

 

SQL> alter database drop logfile group 14;

 

Database altered.


3. 主庫上創(chuàng)建新redo log

SQL>  alter database add logfile group 21 ('/data/mes/standbylog21.log') size 250M;

 

Database altered.

 

SQL> alter database add logfile group 22 ('/data/mes/standbylog22.log') size 250M;

 

Database altered.

 

SQL> alter database add logfile group 23 ('/data/mes/standbylog23.log') size 250M;

 

Database altered.

 

4.主庫上刪除原redo log

 

SQL> alter database drop logfile group 1;

 

Database altered.

 

SQL> alter database drop logfile group 2;

 

Database altered.

 

SQL> alter database drop logfile group 3;

alter database drop logfile group 3

*

ERROR at line 1:

ORA-01623: log 3 is current log for instance mes (thread 1) - cannot drop

ORA-00312: online log 3 thread 1: '/data/mes/redo03.log'

注:切換主庫redo logfile,待log group 3不為current和active時(shí)再刪除

 

SQL> alter system switch logfile;

 

System altered.

 

SQL> alter database drop logfile group 3;

 

Database altered.

 

5. Standby上增加新redo log

SQL> show parameter standby

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

standby_archive_dest                 string      ?/dbs/arch

standby_file_management              string      AUTO

SQL> alter system set standby_file_management=manual;     

 

System altered.

 

SQL> alter database add logfile group 21 ('/data/mes/standbylog21.log') size 250M;

 

Database altered.

 

SQL> alter database add logfile group 22 ('/data/mes/standbylog22.log') size 250M;

 

Database altered.

 

SQL> alter database add logfile group 23 ('/data/mes/standbylog23.log') size 250M;

 

Database altered.

 

 

6.Standby上刪除原redo log

SQL> alter database drop logfile group 1;

 

Database altered.

 

SQL> alter database drop logfile group 2;

 

Database altered.

 

SQL> alter database drop logfile group 3;

alter database drop logfile group 3

*

ERROR at line 1:

ORA-01623: log 3 is current log for instance mes (thread 1) - cannot drop

ORA-00312: online log 3 thread 1:

'/u01/product/fast_recovery_area/MESDG/onlinelog/o1_mf_3_f46lgbqp_.log'

 
在standby中查詢 v$log group 3為CURRENT狀態(tài)固不能drop 所以報(bào)錯(cuò)


在主庫和standby分別執(zhí)行下列SQL:

SELECT DISTINCT THREAD#,max(SEQUENCE#) OVER(PARTITION BY THREAD#) A FROM V$ARCHIVED_LOG;

主庫SEQUENCE#: 67,standby SEQUENCE#:65

standby運(yùn)用下新產(chǎn)生的日誌以便switch current狀態(tài)的group 3

 

SQL> alter database recover managed standby database using current logfile disconnect;

 

Database altered.

查看standby中v$log  3 不為CURRENT 了,取消MRP再次drop group 3成功

 

SQL> alter database recover managed standby database cancel;

 

Database altered.

 

SQL> alter database drop logfile group 3;

 

Database altered.

 

7.主庫增加新standby redo log

SQL> alter database add standby logfile group 31 ('/data/mes/standbylog31.log') size 250M;

 

Database altered.

 

SQL> alter database add standby logfile group 32 ('/data/mes/standbylog32.log') size 250M;

 

Database altered.

 

SQL> alter database add standby logfile group 33 ('/data/mes/standbylog33.log') size 250M;

 

Database altered.

 

SQL> alter database add standby logfile group 34 ('/data/mes/standbylog34.log') size 250M;

 

Database altered.

 

 

8.主庫刪除原standby redo log

SQL> alter database drop logfile group 11;

 

Database altered.

 

SQL> alter database drop logfile group 12;   

 

Database altered.

 

SQL> alter database drop logfile group 13;

 

Database altered.

 

SQL> alter database drop logfile group 14;

 

Database altered.

 

最後,standby中開啟MRP后,所有操作完成

SQL> alter system set standby_file_management=auto;

 

System altered.

 

SQL> alter database recover managed standby database using current logfile disconnect;            

 

Database altered.

 

select * from v$logfile

21          ONLINE      /data/mes/standbylog21.log

22          ONLINE      /data/mes/standbylog22.log

23          ONLINE      /data/mes/standbylog23.log

31          STANDBY     /data/mes/standbylog31.log

32          STANDBY     /data/mes/standbylog32.log

33          STANDBY     /data/mes/standbylog33.log

34          STANDBY     /data/mes/standbylog34.log

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI