Oracle 如何规范清理v$archived_log记录
发布时间:2020-12-12 14:55:27 所属栏目:百科 来源:网络整理
导读:单机实例上面,v$archived_log 很多,有上万条记录了,所以得清理一下,不然每次查询都直接滚屏幕了 SQL select sequence #,applied from v$archived_log order by sequence# ; SEQUENCE # APPLIED .................... SEQUENCE # APPLIED ---------- ----
单机实例上面,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>
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的记录数不匹配,这是因为这是rman备份恢复遗留下来的记录,所以需要清理一下。 清理记录,采用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>
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>
#master库上v$archived_log表记录数: SQL> select count(1) from v$archived_log;
COUNT(1) ----------
623616
SQL>
#standby库上v$archived_log表记录数: SQL> select count(1) from v$archived_log;
COUNT(1) ----------
2226823
SQL> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |