|
We all know that recorded in the controlfile in every a archivelog information, of course, after they in the OS to the physical file delete out in our controlfile still recording these archivelog information, there is in Oracle's OEM Manager visual log to show when we manually clear the file archive directory, these records have not been removed from the controlfile us, that is oracle does not know these files no longer exist! this time we have to do manual scavenging then, here I go through the experiment, you can try this approach:
1. Go to rman
2. connect target /
3. crosscheck archivelog all;
4. delete expired archivelog all;
This time we will certainly go OEM seen see, if you've never done this action, we can compare the controlfile from this action before the size of the operation after the controlfile!
ORACLE properly remove and archive space reclamation methods
ORACLE properly remove and archive space reclamation methods
ORACLE often a log file is full, the performance / oraarchive this file space occupancy 100% why we must not complain ORACLE archive maintenance tools, a lot of people just delete wrong, wrong, ORACLE there, and very intelligent, you can correct and delete archived FLASHBACK, but remember, ORACLE ORACLE archive logs for data recovery and backup is very important, not a last resort do not delete archived logs.
Archive log deletion process
Log in to ORACLE database server to a host or via a network connection
Enter the ORACLE data backup tool
rman target /
Or rman target / @ orcl
In the Command window inside the implementation
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
Explanation
SYSDATA-7, indicating that the current system time seven days ago, before the archive log keyword indicates 7 days ago, if you use the flashback function will delete flashback data.
Similarly, you can delete from seven days ago to the present all the logs, but the order to think clearly, to finish this deletion, the best full backup of the database immediately
DELETE ARCHIVELOG FROM TIME 'SYSDATE-7';
UNIX / LINUX can also find the archive data under 7 days ago by FIND, delete sub-operation using EXEC
find / oraarchive -xdev -mtime +7 -name "* .dbf" -exec rm -f {};
This still leaves the archive file is not managed in the RMAN
Still need to run the following two commands in RMAN
crosscheck archivelog all;
delete expired archivelog all;
So it was not as easy to use the method above, but with the benefits of FIND is that you can in the conditions, and the EXEC child do many operations to achieve more complex functions
3. brief overview report obsolete command
Use report obsolete expired backup command reports
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename / Handle
-------------------- ------ ------------------ ------ --------------
Backup Set 125 01-NOV-04
Backup Piece 125 01-NOV-04 / data1 / oracle / orabak / full_1_541045804
Backup Set 131 04-NOV-04
Backup Piece 131 04-NOV-04 / data1 / oracle / orabak / full_AVATAR2_20041104_131
....
Backup Set 173 06-DEC-04
Backup Piece 173 06-DEC-04 / data1 / oracle / orabak / full_AVATAR2_20041206_173
Backup Set 179 11-DEC-04
Backup Piece 179 11-DEC-04 /data1/oracle/orabak/arch544588206.arc
.....
Backup Piece 189 17-DEC-04 /data1/oracle/orabak/arch545106606.arc
Backup Set 190 17-DEC-04
Backup Piece 190 17-DEC-04 /data1/oracle/orabak/arch545106665.arc
Backup Set 191 20-DEC-04
Backup Piece 191 20-DEC-04 / data1 / oracle / orabak / arch_AVATAR2_20041220_194
Archive Log 2973 20-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2985.dbf
Archive Log 2971 20-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2984.dbf
.....
Archive Log 2705 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2717.dbf
Archive Log 2704 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2716.dbf
Archive Log 2703 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2715.dbf
Archive Log 2702 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2714.dbf
4. Use the delete obsolete command to delete outdated backups:
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename / Handle
-------------------- ------ ------------------ ------ --------------
Backup Set 125 01-NOV-04
Backup Piece 125 01-NOV-04 / data1 / oracle / orabak / full_1_541045804
....
Archive Log 2704 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2716.dbf
Archive Log 2703 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2715.dbf
Archive Log 2702 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2714.dbf
Do you really want to delete the above objects (enter YES or NO)? Yes
deleted backup piece
backup piece handle = / data1 / oracle / orabak / full_AVATAR2_20041206_173 recid = 173 stamp = 544156241
.....
deleted archive log
archive log filename = / opt / oracle / oradata / avatar2 / archive / 1_2715.dbf recid = 2703 stamp = 545108268
deleted archive log
archive log filename = / opt / oracle / oradata / avatar2 / archive / 1_2714.dbf recid = 2702 stamp = 545107659
Deleted 286 objects
RMAN> crosscheck archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid = 19 devtype = DISK
specification does not match any archive log in the recovery catalog
5 rman archive log with crosscheck examination, two archive log is a failure:
RMAN> crosscheck archivelog all;
Release channels: ORA_DISK_1
Distribution channels: ORA_DISK_1
Channel ORA_DISK_1: sid = 14 devtype = DISK
Validation of archived log failed
Archived log file name = D: ORACLEORADATATESTARCHIVE1_47.DBF record ID = 1 timestamp = 572 866
683
Validation of archived log failed
Archived log file name = D: ORACLEORADATATESTARCHIVE11_48.DBF Record ID = 2 timestamp = 57286
6931
2 objects have been cross-checked
6 Try to synchronize it, look okay, not the result, crosscheck or failure:
RMAN> resync catalog;
Starting full recovery catalog resync
To complete a full resync
RMAN> crosscheck archivelog all;
Release channels: ORA_DISK_1
Distribution channels: ORA_DISK_1
Channel ORA_DISK_1: sid = 14 devtype = DISK
Validation of archived log failed
Archived log file name = D: ORACLEORADATATESTARCHIVE1_47.DBF record ID = 1 timestamp = 572 866
683
Validation of archived log failed
Archived log file name = D: ORACLEORADATATESTARCHIVE11_48.DBF Record ID = 2 timestamp = 57286
6931
2 objects have been cross-checked
7 A list expired see if there is failure of the archive log, there is no proof of the failure of the archive log:
RMAN> list expired archivelog all;
Description and recovery catalog does not match any of the archived logs
8 to try to change the language setting, the results crosscheck again, two archive log had been successful:
RMAN> exit
Recovery Manager complete.
C:> set nls_lang = american_america.zhs16gbk
C:> rman catalogrman / rman @ safetarget /
Recovery Manager: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: TEST (DBID = 1870953724)
connected to recovery catalog database
RMAN> crosscheck archivelog all;
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid = 9 devtype = DISK
validation succeeded for archived log
archive log filename = D: ORACLEORADATATESTARCHIVE1_47.DBF recid = 1 stamp = 57286
6683
validation succeeded for archived log
archive log filename = D: ORACLEORADATATESTARCHIVE11_48.DBF recid = 2 stamp = 5728
66931
Crosschecked 2 objects |
|
|
|