ORACLE中使用RAMA删除部分日志

前端之家收集整理的这篇文章主要介绍了ORACLE中使用RAMA删除部分日志前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.登陆RAMA并查看相关日志文件
rman
connect target sys/oracle
list archivelog all


[oracle@oracledb ~]$ rman

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jan 20 07:05:17 2017

Copyright (c) 1982,2011,Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target sys/oracle

connected to target database: ORCL (DBID=1460481228)

RMAN> list archivelog all;

using target database control file instead of recovery catalog
List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key     Thrd Seq     S Low Time           
------- ---- ------- - -------------------
3       1    10      A 2017-01-17 07:43:53
        Name: /u01/oracle/oralog/ARC0000000010_0932700493.0001_570d2ccc.log

4       1    11      A 2017-01-17 07:45:00
        Name: /u01/oracle/oralog/ARC0000000011_0932700493.0001_570d2ccc.log

5       1    12      A 2017-01-17 08:10:51
        Name: /u01/oracle/oralog/ARC0000000012_0932700493.0001_570d2ccc.log

6       1    13      A 2017-01-17 08:16:51
        Name: /u01/oracle/oralog/ARC0000000013_0932700493.0001_570d2ccc.log

7       1    14      A 2017-01-18 01:26:22
        Name: /u01/oracle/oralog/ARC0000000014_0932700493.0001_570d2ccc.log

8       1    15      A 2017-01-18 07:19:54
        Name: /u01/oracle/oralog/ARC0000000015_0932700493.0001_570d2ccc.log

9       1    16      A 2017-01-18 21:48:33
        Name: /u01/oracle/oralog/ARC0000000016_0932700493.0001_570d2ccc.log

10      1    17      A 2017-01-18 21:52:13
        Name: /u01/oracle/oralog/ARC0000000017_0932700493.0001_570d2ccc.log

11      1    18      A 2017-01-18 21:57:10
        Name: /u01/oracle/oralog/ARC0000000018_0932700493.0001_570d2ccc.log

12      1    19      A 2017-01-18 22:01:34
        Name: /u01/oracle/oralog/ARC0000000019_0932700493.0001_570d2ccc.log

13      1    20      A 2017-01-18 22:06:37
        Name: /u01/oracle/oralog/ARC0000000020_0932700493.0001_570d2ccc.log

14      1    21      A 2017-01-19 06:24:46
        Name: /u01/oracle/oralog/ARC0000000021_0932700493.0001_570d2ccc.log

15      1    22      A 2017-01-19 06:30:16
        Name: /u01/oracle/oralog/ARC0000000022_0932700493.0001_570d2ccc.log

16      1    23      A 2017-01-19 06:35:43
        Name: /u01/oracle/oralog/ARC0000000023_0932700493.0001_570d2ccc.log


2.发现有key从3到16的日志文件,现在我们来删除几个,手工到归档路径删除几个归档日志文件

[root@oracledb ~]# su - oracle
[oracle@oracledb ~]$ rm /u01/oracle/oralog/ARC0000000010_0932700493.0001_570d2ccc.log

 
 
RMAN> crosscheck archivelog all;
released channel: ORA_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=60 device type=DISK @H_502_24@validation Failed for archived log archived log file name=/u01/oracle/oralog/ARC0000000010_0932700493.0001_570d2ccc.log RECID=3 STAMP=933493501 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000011_0932700493.0001_570d2ccc.log RECID=4 STAMP=933495053 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000012_0932700493.0001_570d2ccc.log RECID=5 STAMP=933495411 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000013_0932700493.0001_570d2ccc.log RECID=6 STAMP=933557190 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000014_0932700493.0001_570d2ccc.log RECID=7 STAMP=933578400 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000015_0932700493.0001_570d2ccc.log RECID=8 STAMP=933630524 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000016_0932700493.0001_570d2ccc.log RECID=9 STAMP=933630741 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000017_0932700493.0001_570d2ccc.log RECID=10 STAMP=933631032 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000018_0932700493.0001_570d2ccc.log RECID=11 STAMP=933631300 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000019_0932700493.0001_570d2ccc.log RECID=12 STAMP=933631604 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000020_0932700493.0001_570d2ccc.log RECID=13 STAMP=933661492 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000021_0932700493.0001_570d2ccc.log RECID=14 STAMP=933661823 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000022_0932700493.0001_570d2ccc.log RECID=15 STAMP=933662145 validation succeeded for archived log archived log file name=/u01/oracle/oralog/ARC0000000023_0932700493.0001_570d2ccc.log RECID=16 STAMP=933662456 Crosschecked 14 objects
以上可知,recid=3的文件 @H_502_24@validation Failed for archived log


3.再次查看是否还有已删除日志文件的记录发现依然还存在列表中

RMAN> list archivelog all;

List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key     Thrd Seq     S Low Time           
------- ---- ------- - -------------------
@H_502_24@3 1 10 X 2017-01-17 07:43:53 Name: /u01/oracle/oralog/ARC0000000010_0932700493.0001_570d2ccc.log 
4       1    11      A 2017-01-17 07:45:00
        Name: /u01/oracle/oralog/ARC0000000011_0932700493.0001_570d2ccc.log

5       1    12      A 2017-01-17 08:10:51
        Name: /u01/oracle/oralog/ARC0000000012_0932700493.0001_570d2ccc.log

6       1    13      A 2017-01-17 08:16:51
        Name: /u01/oracle/oralog/ARC0000000013_0932700493.0001_570d2ccc.log

7       1    14      A 2017-01-18 01:26:22
        Name: /u01/oracle/oralog/ARC0000000014_0932700493.0001_570d2ccc.log

8       1    15      A 2017-01-18 07:19:54
        Name: /u01/oracle/oralog/ARC0000000015_0932700493.0001_570d2ccc.log

9       1    16      A 2017-01-18 21:48:33
        Name: /u01/oracle/oralog/ARC0000000016_0932700493.0001_570d2ccc.log

10      1    17      A 2017-01-18 21:52:13
        Name: /u01/oracle/oralog/ARC0000000017_0932700493.0001_570d2ccc.log

11      1    18      A 2017-01-18 21:57:10
        Name: /u01/oracle/oralog/ARC0000000018_0932700493.0001_570d2ccc.log

12      1    19      A 2017-01-18 22:01:34
        Name: /u01/oracle/oralog/ARC0000000019_0932700493.0001_570d2ccc.log

13      1    20      A 2017-01-18 22:06:37
        Name: /u01/oracle/oralog/ARC0000000020_0932700493.0001_570d2ccc.log

14      1    21      A 2017-01-19 06:24:46
        Name: /u01/oracle/oralog/ARC0000000021_0932700493.0001_570d2ccc.log

15      1    22      A 2017-01-19 06:30:16
        Name: /u01/oracle/oralog/ARC0000000022_0932700493.0001_570d2ccc.log

16      1    23      A 2017-01-19 06:35:43
        Name: /u01/oracle/oralog/ARC0000000023_0932700493.0001_570d2ccc.log

4.执行以下语句删除expired状态的日子文件

RMAN> delete expired archivelog all;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=60 device type=DISK
List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key     Thrd Seq     S Low Time           
------- ---- ------- - -------------------
3       1    10      X 2017-01-17 07:43:53
        Name: /u01/oracle/oralog/ARC0000000010_0932700493.0001_570d2ccc.log


Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=/u01/oracle/oralog/ARC0000000010_0932700493.0001_570d2ccc.log RECID=3 STAMP=933493501
Deleted 1 EXPIRED objects
注意执行删除时会进行询问,输入YES执行删除.

5.使用list archivelog all;再次查看时发现手工删除的日子文件已消失在此列表中了;

原文链接:https://www.f2er.com/oracle/210760.html

猜你在找的Oracle相关文章