How to clear the archive log

Some time, the archive is full, we have to clear the archive log and then make the database normal.

The following way, maybe is useful to you.

1. For NO-DATAGUARD:

--- 1. Check the archivelog folder

# df -k

# su - oracle

$ sqlplus / as  sysdba

SQL> archive log  list;

 

--- 2. Move some old history archivelog files to the  other folder which have enough free space

Maybe sometimes, we  can't login the database or the rman, so, we must move some old archivelog  files to the other folder, so that we can login the rman.

 

--- 3. Clear the history archivelog

# su - oracle

$ rman target /

RMAN> delete  noprompt archivelog until time 'sysdate-1';

RMAN> crosscheck  archivelog all;

RMAN> delete  obsolete;

RMAN> exit;

sqlplus / as sysdba

SQL> alter  system switch logfile;

 

--- 4. Please finish a FULL backup for the current  database.

The old full backup  have become to invalid, we must backup the current database.

 

 

 

2. For DATAGUARD:

--- 1. Check the following on the  primary database and the standby database

On the primary database:

# su - oracle

$ sqlplus / as sysdba

SQL> archive log list;

On the standby database:

# su - oracle

$ sqlplus / as sysdba

SQL> set linesize 400

SQL> archive log list;

SQL> select process,status,thread#,sequence#,block#,blocks from  v$managed_standby;

 

--- 2. If the archivelog folder  close to full on the standby database

On the standby database:

You can clear archive log using the above steps.

 

--- 3. If the archivelog folder  close to full on the primary database

On the primary database:

# su - oracle

$ rman target /

RMAN> delete noprompt archivelog until time 'sysdate -1' backed up 1 times to device type disk;  <===== If there  are some archvielog files which didn’t move to the standby database after had  finished the full rman backup in the primary database,  will be move, and have to rebuild the  standby database.

If there are some old history archivelog can't delete, and show  warning:RMAN-08137

Please don't remove them directly, because of they didn't were moved to  the standby database, we have to check status of the standby database.

RMAN> crosscheck archivelog all;

RMAN> delete obsolete;

RMAN> exit;

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值