删除Oracle归档日志方法
一、查看归档日志情况1:在数据库处于打开状态查看数据归档状态:C:\\Users\\Administratorsqlplus/nologSQL*Plus:Release11.2.0.3.0ProductiononFriMar2..
一、查看归档日志情况
1:在数据库处于打开状态
查看数据归档状态:
C:\Users\Administrator>sqlplus /nolog
SQL*Plus: Release 11.2.0.3.0 Production on Fri Mar 23 12:10:31 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> connect /as sysdba;
Connected.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
查看闪回区大小
SQL> show parameter db_re
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string D:\app\Administrator\fast_reco very_area
从这里可以看出闪回去的位置和大小
去查看归档所在目录的真实大小 .这里就是闪回区所在的目录,如果真实目录的大小是不是已经打到闪回区的大小,如果是可以增大闪回区的大小,使用下面命令
SQL> alter system set db_recovery_file_dest_size=6G;
System altered.
2:数据已经关闭状态数据已经关闭,在开启是报错.可以把数据库开启到mount 状态下修改参数
SQL> startup mount
ORACLE instance started.
Total System Global Area 2572144640 bytes
Fixed Size 2257952 bytes
Variable Size 570428384 bytes
Database Buffers 1979711488 bytes
Redo Buffers 19746816 bytes
Database mounted.
可以再这种模式下修改参数 ,和查看.修改完毕后,在开启数据库
SQL> alter database open;
Database altered.
二、删除归档日志方法
方法1 :可以先删除磁盘上的日志文件,在去数据库里删除逻辑日志记录登陆到rman
C:\Users\Administrator>rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Mar 23 12:31:50 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST (DBID=2076824462)
RMAN>
查看日志清单
RMAN> list archivelog all;
using target database control file instead of recovery catalog
List of Archived Log Copies for database with db_unique_name TEST
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
1 1 2 A 23-MAR-12
Name: D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2012_03_23
\O1_MF_1_2_7PQYKCLL_.ARC
这里可以看到日志清单;
检查归档日志状态;
RMAN> crosscheck archivelog all;
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=8 device type=DISK
validation failed for archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\
012_03_23\O1_MF_1_2_7PQYKCLL_.ARC RECID=1 STAMP=778681261
validation failed for archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\
012_03_23\O1_MF_1_3_7PQYKGH3_.ARC RECID=2 STAMP=778681262
validation failed for archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\
012_03_23\O1_MF_1_4_7PQYKKFQ_.ARC RECID=3 STAMP=778681265
validation failed for archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\
012_03_23\O1_MF_1_5_7PQYKQTW_.ARC RECID=4 STAMP=778681272
validation failed for archived log
删除日志:
RMAN> delete expired archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=8 device type=DISK
List of Archived Log Copies for database with db_unique_name TEST
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
1 1 2 X 23-MAR-12
Name: D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2012_03_23
\O1_MF_1_2_7PQYKCLL_.ARC
2 1 3 X 23-MAR-12
Name: D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2012_03_23
\O1_MF_1_3_7PQYKGH3_.ARC
3 1 4 X 23-MAR-12
Name: D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2012_03_23
\O1_MF_1_4_7PQYKKFQ_.ARC
4 1 5 X 23-MAR-12
Name: D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2012_03_23
\O1_MF_1_5_7PQYKQTW_.ARC
5 1 6 X 23-MAR-12
Name: D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2012_03_23
\O1_MF_1_6_7PQYKSX0_.ARC
这里会提示你是否删除:
Do you really want to delete the above objects (enter YES or NO)? y
deleted archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2
012_03_23\O1_MF_1_2_7PQYKCLL_.ARC RECID=1 STAMP=778681261
deleted archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2
012_03_23\O1_MF_1_3_7PQYKGH3_.ARC RECID=2 STAMP=778681262
deleted archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2
012_03_23\O1_MF_1_4_7PQYKKFQ_.ARC RECID=3 STAMP=778681265
deleted archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2
012_03_23\O1_MF_1_5_7PQYKQTW_.ARC RECID=4 STAMP=778681272
deleted archived log
archived log file name=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\TEST\ARCHIVELOG\2
012_03_23\O1_MF_1_6_7PQYKSX0_.ARC RECID=5 STAMP=778681274
Deleted 5 EXPIRED objects
查看闪回区使用状态SQL> select * from v$flash_recovery_area_usage;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
-------------------- ------------------ ------------------------- ---------------
下一篇: 【HTML5】标记文字