[20181225]如何清除註冊的線上日誌.txt

lfree發表於2018-12-25

[20181225]如何清除註冊的線上日誌.txt


--//連結http://www.itpub.net/thread-2107381-1-1.html的討論,lz可能使用rman的catalog註冊了線上日誌當作歸檔日誌.

--//我大概演示這個過程,也許作者不是這樣操作的.


1.環境:

SYS@book> @ ver1

PORT_STRING                    VERSION        BANNER

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

x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production


SYS@book> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u01/app/oracle/archivelog/book/

Oldest online log sequence     703

Next log sequence to archive   705

Current log sequence           705


SELECT RECID

      ,NAME

      ,DEST_ID

      ,THREAD#

      ,SEQUENCE#

      ,CREATOR

      ,REGISTRAR

  FROM v$archived_log a

 WHERE a.name IS NOT NULL AND sequence# >= 703;


      RECID NAME                                                            DEST_ID    THREAD#  SEQUENCE# CREATOR REGISTR

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

      1249 /u01/app/oracle/archivelog/book/1_703_896605872.dbf                   1          1        703 ARCH    ARCH

      1250 /u01/app/oracle/archivelog/book/1_704_896605872.dbf                   1          1        704 ARCH    ARCH

--//當前並沒有線上日誌檔案在檢視v$archived_log中.


2.使用rman註冊:

RMAN> catalog archivelog '/mnt/ramdisk/book/redo01.log' ;

cataloged archived log

archived log file name=/mnt/ramdisk/book/redo01.log RECID=1251 STAMP=995797230


SELECT RECID

      ,NAME

      ,DEST_ID

      ,THREAD#

      ,SEQUENCE#

      ,CREATOR

      ,REGISTRAR

  FROM v$archived_log a

 WHERE a.name IS NOT NULL AND sequence# >= 703;


     RECID NAME                                                            DEST_ID    THREAD#  SEQUENCE# CREATOR REGISTR

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

      1249 /u01/app/oracle/archivelog/book/1_703_896605872.dbf                   1          1        703 ARCH    ARCH

      1250 /u01/app/oracle/archivelog/book/1_704_896605872.dbf                   1          1        704 ARCH    ARCH

      1251 /mnt/ramdisk/book/redo01.log                                          1          1        704 RMAN    RMAN


--//你可以發現線上日誌檔案註冊為歸檔,但是提示CREATOR=rman.如何取消很簡單執行:

--//參考連結:http://blog.itpub.net/267265/viewspace-748366/


3.如何取消.

SYS@book> execute dbms_backup_restore.resetcfilesection(11);

PL/SQL procedure successfully completed.


SELECT RECID

      ,NAME

      ,DEST_ID

      ,THREAD#

      ,SEQUENCE#

      ,CREATOR

      ,REGISTRAR

  FROM v$archived_log a

 WHERE a.name IS NOT NULL AND sequence# >= 703;


no rows selected


--//再重新註冊回去歸檔檔案.

RMAN> catalog start with '/u01/app/oracle/archivelog/book/';


searching for all files that match the pattern /u01/app/oracle/archivelog/book/


List of Files Unknown to the Database

=====================================

File Name: /u01/app/oracle/archivelog/book/1_696_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_698_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_704_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_703_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_695_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_701_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_697_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_700_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_699_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_702_896605872.dbf


Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done


List of Cataloged Files

=======================

File Name: /u01/app/oracle/archivelog/book/1_696_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_698_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_704_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_703_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_695_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_701_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_697_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_700_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_699_896605872.dbf

File Name: /u01/app/oracle/archivelog/book/1_702_896605872.dbf


SELECT RECID

      ,NAME

      ,DEST_ID

      ,THREAD#

      ,SEQUENCE#

      ,CREATOR

      ,REGISTRAR

  FROM v$archived_log a

 WHERE a.name IS NOT NULL AND sequence# >= 703;


     RECID NAME                                                            DEST_ID    THREAD#  SEQUENCE# CREATOR REGISTR

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

         3 /u01/app/oracle/archivelog/book/1_704_896605872.dbf                   1          1        704 RMAN    RMAN

         4 /u01/app/oracle/archivelog/book/1_703_896605872.dbf                   1          1        703 RMAN    RMAN


--//現在取消了線上日誌檔案的註冊.不知道還有什麼方法,理論rman應該可以做到,如何做,給測試看看.


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2286296/,如需轉載,請註明出處,否則將追究法律責任。

相關文章