Oracle 如何規(guī)范清理v$archived_log記錄實例詳解
單機實例上面,v$archived_log 很多,有上萬條記錄了,所以得清理一下,不然每次查詢都直接滾屏幕了
SQL> select sequence#,applied from v$archived_log order by sequence# ;
SEQUENCE# APPLIED
....................
SEQUENCE# APPLIED
---------- ---------
9376 NO
9377 NO
9377 NO
9378 NO
9378 NO
9379 NO
9379 NO
9380 NO
9380 NO
9381 NO
9381 NO
SEQUENCE# APPLIED
---------- ---------
9382 NO
9382 NO
11200 rows selected.
SQL>
然后查看下當(dāng)前的歸檔記錄
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 164
Next log sequence to archive 166
Current log sequence 166
SQL>
看到歸檔記錄才是164,和v$archived_log里面上W的記錄數(shù)不匹配,這是因為這是rman備份恢復(fù)遺留下來的記錄,所以需要清理一下。
清理記錄,采用sys.dbms_backup_restore.resetCfileSection(11);清理:
SQL> execute sys.dbms_backup_restore.resetCfileSection(11);
PL/SQL procedure successfully completed.
SQL> select sequence#,applied from v$archived_log order by sequence# ;
no rows selected
SQL>
再次測試,可以查看到日志記錄變化了,v$archived_log已經(jīng)是最新的,只有一條記錄數(shù)存在了:
SQL> alter system switch logfile;
System altered.
SQL> select sequence#,applied from v$archived_log order by sequence# ;
SEQUENCE# APPLIED
---------- ---------
166 NO
SQL> execute sys.dbms_backup_restore.resetCfileSection(11);
PL/SQL procedure successfully completed.
SQL> select sequence#,applied from v$archived_log order by sequence# ;
no rows selected
SQL>
擴展話題,單機實例可以用上,述辦法操作,那么Oracle集群比如dg呢,分析master庫、standby庫
#master庫上v$archived_log表記錄數(shù):
SQL> select count(1) from v$archived_log;
COUNT(1)
----------
623616
SQL>
#standby庫上v$archived_log表記錄數(shù):
SQL> select count(1) from v$archived_log;
COUNT(1)
----------
2226823
SQL>
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
您可能感興趣的文章:- Oracle中的游標(biāo)和函數(shù)詳解
- oracle獲取當(dāng)前時間,精確到毫秒并指定精確位數(shù)的實現(xiàn)方法
- Linux靜默安裝Oracle11g部分問題的解決方法
- win10 oracle11g安裝報錯問題集合 附解決方法
- Oracle連接遠程數(shù)據(jù)庫的四種方法
- Oracle解析復(fù)雜json的方法實例詳解
- Oracle存儲過程、包、方法使用總結(jié)(推薦)
- oracle創(chuàng)建表空間、授權(quán)、創(chuàng)建用戶、導(dǎo)入dmp文件