怎样清除v$v archived log

博客访问: 401084
博文数量: 119
博客积分: 1860
博客等级: 上尉
技术积分: 1326
注册时间:
偶尔有空上来看看
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: Oracle
查看到v$archived_log中的name字段为空,经测试发现通过rman备份归档并删除这些文件,name字段就变为空了。先查看当前name信息:SQL> select name from v$archived_log where sequence#>150;执行rman备份并删除输入:RMAN> backup archivelog sequence 163再查看,name就变空了。
阅读(1968) | 评论(0) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。wangjingshuai3 的BLOG
用户名:wangjingshuai3
文章数:35
访问量:2218
注册日期:
阅读量:5863
阅读量:12276
阅读量:336341
阅读量:1040274
51CTO推荐博文
&&&&&&&&&&&&&&&&&&&&&&&&如何删除彻底归档日志文件
--测试环境:
--虚拟机下&&Redhat5.4(bit)
--Oracle&11G&R2(64bit)&
--注意:语句只能在实验环境下执行,切勿在生产环境下执行!
--这个符号是解释
有颜色字体标示是需要注意的地方
--以下是我的操作步骤,大家可以一步一步跟练习,由于每个命令都有解析,所以就算没有什么oracle基础也行
--由于本人水平有限,也是处于学习充电阶段,大家有什么问题欢迎提出哦,咱们一起解决,嘿嘿
[root@orcl&~]#&su&C&oracle
--设置一下ORACLE_SID
[oracle@orcl&~]$&export&ORACLE_SID=denver
--查看一下denver实例是否启动
[oracle@orcl&~]$&ps&-ef|grep&oracle
root&&&&2&&0&04:23&tty1&&&&&00:00:00&su&-&oracle
oracle&&&&0&04:23&tty1&&&&&00:00:00&-bash
root&&&&&&0&09:43&pts/1&&&&00:00:00&su&-&oracle
oracle&&&&0&09:43&pts/1&&&&00:00:00&-bash
oracle&&29754&&&&&1&&0&09:50&?&&&&&&&&00:00:00/u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr&LISTENER&-inherit
root&&&&&&0&10:00&pts/3&&&&00:00:00&su&-&oracle
oracle&&&&0&10:00&pts/3&&&&00:00:00&-bash
oracle&&&&0&10:30&pts/3&&&&00:00:00&rlwrap&sqlplus&/&as&sysdba
oracle&&&&0&10:30&pts/2&&&&00:00:00&sqlplus&&&as&sysdba
oracle&&30198&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_pmon_denver
oracle&&30200&&&&&1&&0&10:33&?&&&&&&&&00:00:02&ora_vktm_denver
oracle&&30204&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_gen0_denver
oracle&&30206&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_diag_denver
oracle&&30208&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_dbrm_denver
oracle&&30210&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_psp0_denver
oracle&&30212&&&&&1&&0&10:33&?&&&&&&&&00:00:01&ora_dia0_denver
oracle&&30214&&&&&1&&0&10:33&?&&&&&&&&00:00:02&ora_mman_denver
oracle&&30216&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_dbw0_denver
oracle&&30218&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_lgwr_denver
oracle&&30220&&&&&1&&0&10:33&?&&&&&&&&00:00:01&ora_ckpt_denver
oracle&&30222&&&&&1&&0&10:33&?&&&&&&&&00:00:01&ora_smon_denver
oracle&&30224&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_reco_denver
oracle&&30226&&&&&1&&0&10:33&?&&&&&&&&00:00:01&ora_mmon_denver
oracle&&30229&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_mmnl_denver
oracle&&30231&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_d000_denver
oracle&&30233&&&&&1&&0&10:33&?&&&&&&&&00:00:00&ora_s000_denver
oracle&&&&0&10:33&?&&&&&&&&00:00:02&oracledenver&(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle&&30284&&&&&1&&0&10:34&?&&&&&&&&00:00:00&ora_arc0_denver
oracle&&30286&&&&&1&&0&10:34&?&&&&&&&&00:00:00&ora_arc1_denver
oracle&&30288&&&&&1&&0&10:34&?&&&&&&&&00:00:00&ora_arc2_denver
oracle&&30290&&&&&1&&010:34&?&&&&&&&&00:00:00&ora_arc3_denver
oracle&&30292&&&&&1&&0&10:34&?&&&&&&&&00:00:00&ora_qmnc_denver
oracle&&30311&&&&&1&&0&10:34&?&&&&&&&&00:00:00&ora_cjq0_denver
oracle&&30313&&&&&1&&0&10:34&?&&&&&&&&00:00:00&ora_q000_denver
oracle&&30315&&&&&1&&010:34&?&&&&&&&&00:00:00&ora_q001_denver
oracle&&30352&&&&&1&&0&10:39&?&&&&&&&&00:00:00&ora_smco_denver
oracle&&30354&&&&&1&&0&10:39&?&&&&&&&&00:00:00&ora_w000_denver
oracle&&&&0&10:43&pts/1&&&&00:00:00&rlwrap&rman&target&/
oracle&&&&0&10:43&pts/0&&&&00:00:04&rman&target&/
oracle&&&&0&10:43&?&&&&&&&&00:00:03&oracledenver(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle&&&&0&10:43&?&&&&&&&&00:00:00&oracledenver(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle&&&&0&10:43&?&&&&&&&&00:00:00&oracledenver(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
root&&&&&&0&10:45&pts/4&&&&00:00:00&su&-&oracle
oracle&&&&0&10:45&pts/4&&&&00:00:00&-bash
root&&&&&&0&11:05&pts/5&&&&00:00:00&su&-&oracle
oracle&&&&0&11:05&pts/5&&&&00:00:00&-bash
oracle&&&&0&11:05&pts/5&&&&00:00:00&ps&-ef
oracle&&&&0&11:05&pts/5&&&&00:00:00&grep&oracle
[oracle@orcl&~]$&sqlplus&/&as&sysdba
SQL*Plus:&Release&11.2.0.1.0&Production&onFri&Aug&8&11:06:06&2014
Copyright&(c)&,&Oracle.&&All&rights&reserved.
Connected&to:
Oracle&Database&11g&Enterprise&EditionRelease&11.2.0.1.0&-&Production
With&the&Partitioning,&OLAP,&Data&Miningand&Real&Application&Testing&options
--查看当前的归档模式
SQL&&archive&log&
Database&log&mode&&&&&&&&&&&&&&Archive&Mode
Automatic&archival&&&&&&&&&&&&&Enabled
Archive&destination&&&&&&&&&&&&USE_DB_RECOVERY_FILE_DEST
Oldest&online&log&sequence&&&&&6
Next&log&sequence&to&archive&&&8
Current&log&sequence&&&&&&&&&&&8
--下面的步骤是把归档模式更改为非归档模式,
--首先关了数据库
SQL&&shutdown&
Database&closed.
Database&dismounted.
ORACLE&instance&shut&down.
--将数据库启动到mount的模式下,这种模式下只打开控制文件,不打开数据文件
SQL&&startup&
ORACLE&instance&started.
Total&System&Global&Area&&&bytes
Fixed&Size&&&&&&&&&&&&&&&&&&1337860&bytes
Variable&Size&&&&&&&&&&&&&&bytes
Database&Buffers&&&&&&&&&&&bytes
Redo&Buffers&&&&&&&&&&&&&&&&5791744&bytes
Database&mounted.
--把数据库切换为非归档模式
SQL&&alter&database&
Database&altered.
--把数据库打开,此时打开数据文件
SQL&&alter&database&
Database&altered.
--查看归档的模式,此时就从归档模式à非归档模式
SQL&&archive&log&
Database&log&mode&&&&&&&&&&&&&&No&Archive&Mode
Automatic&archival&&&&&&&&&&&&&Disabled
Archive&destination&&&&&&&&&&&&USE_DB_RECOVERY_FILE_DEST
Oldest&online&log&sequence&&&&&6
Current&log&sequence&&&&&&&&&&&8
--下面的步骤是从非归档模式à归档模式,方法和上面的类似
SQL&&shutdown&
Database&closed.
Database&dismounted.
ORACLE&instance&shut&down.
SQL&&startup&
ORACLE&instance&started.
Total&System&Global&Area&&&bytes
Fixed&Size&&&&&&&&&&&&&&&&&&1337860&bytes
Variable&Size&&&&&&&&&&&&&&bytes
Database&Buffers&&&&&&&&&&&bytes
Redo&Buffers&&&&&&&&&&&&&&&&5791744&bytes
Database&mounted.
SQL&&alter&database&
Database&altered.
SQL&&alter&database&
Database&altered.
--此时就是归档模式
SQL&&archive&log&
Database&log&mode&&&&&&&&&&&&&&Archive&Mode
Automatic&archival&&&&&&&&&&&&&Enabled
Archive&destination&&&&&&&&&&&&USE_DB_RECOVERY_FILE_DEST
Oldest&online&log&sequence&&&&&6
Next&log&sequence&to&archive&&&8
Current&log&sequence&&&&&&&&&&&8
--看一下数据库是否位于archivelog模式中,并且归档过程正在进行
SQL&&select&log_mode&from&v$
------------
ARCHIVELOG
SQL&&select&archiver&from&v$
--查看归档日志的位置,由于是第一次切换到归档,所以没有文件
SQL&&select&name&from&v$archived_
--------------------------------------------------------------------------------
--日志切换,这里是手动切换日志,会产生一个归档日志
SQL&&alter&system&switch&
System&altered.
--上一步由于产生了一个归档日志,所以在这里能查到,并且能看到具体的位置
SQL&&select&name&from&v$archived_
--------------------------------------------------------------------------------
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_8_9y8j5
--下面多产生几个归档日志
SQL&&alter&system&switch&
System&altered.
System&altered.
System&altered.
System&altered.
System&altered.
System&altered.
--这里可以看一下归档日志的位置
SQL&&select&name&from&v$archived_
--------------------------------------------------------------------------------
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_8_9y8j5
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_9_9y8j6
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_10_9y8j
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_11_9y8j
--------------------------------------------------------------------------------
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_12_9y8j
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_13_9y8j
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_14_9y8j
8&rows&selected.
--切换到那个目录,查看一下归档文件
[oracle@orcl&~]$&cd/u01/app/oracle/flash_recovery_area/DENVER/archivelog//
[oracle@orcl&]$&ls
o1_mf_1_10_9y8j6t3q_.arc&&o1_mf_1_13_9y8j7166_.arc&&o1_mf_1_9_9y8j6o3g_.arc
o1_mf_1_11_9y8j6yhd_.arc&&o1_mf_1_14_9y8j7335_.arc
o1_mf_1_12_9y8j706o_.arc&&o1_mf_1_8_9y8j5wgj_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_10_9y8j6t3q_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_11_9y8j6yhd_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_12_9y8j706o_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_13_9y8j7166_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_14_9y8j7335_.arc
-rw-r-----&1&oracle&oinstall&-_mf_1_8_9y8j5wgj_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_9_9y8j6o3g_.arc
--通过rman对归档日志进行管理,下面是测试crosscheck&archivelog&all和delete&expired&--archivelog&all这两个命令
--连接rman
[oracle@orcl&]$&rman&target&/
Recovery&Manager:&Release&11.2.0.1.0&-Production&on&Fri&Aug&8&11:18:08&2014
Copyright&(c)&,&Oracle&and/or&itsaffiliates.&&All&rights&reserved.
connected&to&target&database:&DENVER(DBID=)
--检查无效的归档日志,succeeded表示成功,文件都有效
RMAN&&crosscheck&archivelog&
using&target&database&control&file&insteadof&recovery&catalog
allocated&channel:&ORA_DISK_1
channel&ORA_DISK_1:&SID=34&device&type=DISK
validation&succeeded&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_8_9y8j5wgj_.arcRECID=2&STAMP=
validation&succeeded&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_9_9y8j6o3g_.arcRECID=3&STAMP=
validation&succeeded&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_10_9y8j6t3q_.arcRECID=4&STAMP=
validation&succeeded&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_11_9y8j6yhd_.arcRECID=5&STAMP=
validation&succeeded&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_12_9y8j706o_.arcRECID=6&STAMP=
validation&succeeded&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_13_9y8j7166_.arcRECID=7&STAMP=
validation&succeeded&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_14_9y8j7335_.arcRECID=8&STAMP=
Crosschecked&7&objects
--这个命令是删除无效的归档日志,由于上面检查的没有无效的,所以这里什么也没有删除
RMAN&&delete&expired&archivelog&
released&channel:&ORA_DISK_1
allocated&channel:&ORA_DISK_1
channel&ORA_DISK_1:&SID=34&device&type=DISK
specification&does&not&match&any&archivedlog&in&the&repository
RMAN&&exit
Recovery&Manager&complete.
[oracle@orcl&]$&ls
o1_mf_1_10_9y8j6t3q_.arc&&o1_mf_1_13_9y8j7166_.arc&&o1_mf_1_9_9y8j6o3g_.arc
o1_mf_1_11_9y8j6yhd_.arc&&o1_mf_1_14_9y8j7335_.arc
o1_mf_1_12_9y8j706o_.arc&&o1_mf_1_8_9y8j5wgj_.arc
[oracle@orcl&]$&ll
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_10_9y8j6t3q_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_11_9y8j6yhd_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_12_9y8j706o_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_13_9y8j7166_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_14_9y8j7335_.arc
-rw-r-----&1&oracle&oinstall&-_mf_1_8_9y8j5wgj_.arc
-rw-r-----&1&oracle&oinstall&&&&&11:15&o1_mf_1_9_9y8j6o3g_.arc
--把归档日志的物理文件都删除
[oracle@orcl&]$&rm&*.arc
[oracle@orcl&]$&exit
--在删除归档文件的物理文件之后,在oracle里面可以查到
SQL&&select&name&from&v$archived_
--------------------------------------------------------------------------------
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_8_9y8j5
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_9_9y8j6
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_10_9y8j
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_11_9y8j
--------------------------------------------------------------------------------
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_12_9y8j
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_13_9y8j
/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_14_9y8j
8&rows&selected.
[oracle@orcl&~]$&cd/u01/app/oracle/flash_recovery_area/DENVER/archivelog//
--此时归档日志的物理文件已经删除完成,查看不到了
[oracle@orcl&]$&ll
--连接到rman
[oracle@orcl&]$&rman&target&/
Recovery&Manager:&Release&11.2.0.1.0&-Production&on&Fri&Aug&8&11:20:35&2014
Copyright&(c)&,&Oracle&and/or&itsaffiliates.&&All&rights&reserved.
connected&to&target&database:&DENVER(DBID=)
--现在检查无效的归档日志文件,failed表示就是无效的
RMAN&&crosscheck&archivelog&
using&target&database&control&file&insteadof&recovery&catalog
allocated&channel:&ORA_DISK_1
channel&ORA_DISK_1:&SID=42&device&type=DISK
validation&failed&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_8_9y8j5wgj_.arcRECID=2&STAMP=
validation&failed&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_9_9y8j6o3g_.arcRECID=3&STAMP=
validation&failed&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_10_9y8j6t3q_.arcRECID=4&STAMP=
validation&failed&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_11_9y8j6yhd_.arcRECID=5&STAMP=
validation&failed&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_12_9y8j706o_.arcRECID=6&STAMP=
validation&failed&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_13_9y8j7166_.arcRECID=7&STAMP=
validation&failed&for&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_14_9y8j7335_.arcRECID=8&STAMP=
Crosschecked&7&objects
--把上一步检查到了无效的归档日志都删除,要删除输入&&yes
--此处删除的其实是数据库控制文件里面对归档日志的记录,这里删除之后,在oracle里面就查不到归--档日志的信息了
RMAN&&delete&expired&archivelog&
released&channel:&ORA_DISK_1
allocated&channel:&ORA_DISK_1
channel&ORA_DISK_1:&SID=42&device&type=DISK
List&of&Archived&Log&Copies&for&databasewith&db_unique_name&DENVER
=====================================================================
Key&&&&Thrd&Seq&&&&&S&Low&Time&
-------&----&-------&-&---------
2&&&&&&1&&&&8&&&&&&&X&08-AUG-14
&&&&&&&Name:&/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_8_9y8j5wgj_.arc
3&&&&&&1&&&&9&&&&&&&X&08-AUG-14
&&&&&&&Name:/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_9_9y8j6o3g_.arc
4&&&&&&1&&&&10&&&&&&X&08-AUG-14
&&&&&&&Name:/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_10_9y8j6t3q_.arc
5&&&&&&1&&&&11&&&&&&X&08-AUG-14
&&&&&&&Name:/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_11_9y8j6yhd_.arc
6&&&&&&1&&&&12&&&&&&X&08-AUG-14
&&&&&&&Name:/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_12_9y8j706o_.arc
7&&&&&&1&&&&13&&&&&&X&08-AUG-14
&&&&&&&Name:&/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_13_9y8j7166_.arc
8&&&&&&1&&&&14&&&&&&X&08-AUG-14
&&&&&&&Name:/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_14_9y8j7335_.arc
Do&you&really&want&to&delete&the&aboveobjects&(enter&YES&or&NO)?&yes
deleted&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_8_9y8j5wgj_.arcRECID=2&STAMP=
deleted&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_9_9y8j6o3g_.arcRECID=3&STAMP=
deleted&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_10_9y8j6t3q_.arcRECID=4&STAMP=
deleted&archived&log
archived&log&file&name=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_11_9y8j6yhd_.arcRECID=5&STAMP=
deleted&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_12_9y8j706o_.arcRECID=6&STAMP=
deleted&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_13_9y8j7166_.arcRECID=7&STAMP=
deleted&archived&log
archived&log&filename=/u01/app/oracle/flash_recovery_area/DENVER/archivelog//o1_mf_1_14_9y8j7335_.arcRECID=8&STAMP=
Deleted&7&EXPIRED&objects
RMAN&&exit
Recovery&Manager&complete.
[oracle@orcl&]$&ll
[oracle@orcl&]$&exit
--此时再查看的话oracle里面就看不到归档日志的信息了
SQL&&select&name&from&v$archived_
--------------------------------------------------------------------------------
8&rows&selected.
SQL&&本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:未分类┆阅读(0)┆评论(0)博客访问: 3922
博文数量: 121
注册时间:
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: Oracle
原文地址: 作者:
1.初始化参数AUDIT_TRAIL用于控制数据库审计,取值说明:
none 禁用数据库审计
os 启用数据库审计,并将数据库审计记录定向到操作系统审计记录
db 启用数据库审计,并将数据库所有审计记录定向到数据库的SYS.AUD$表
db,extended 启用数据库审计,并将数据库所有审计记录定向到数据库的SYS.AUD$表。另外,填充SYS.AUD$表的SQLBIND 列和SQLTEXT CLOB 列。
xml 启用数据库审计,并将所有记录写到XML格式的操作系统文件中。
xml,extended 启用数据库审计,输出审计记录的所有列,包括SqlText和SqlBind的值。
Oracle公司还推荐使用基于OS文件的审计日志记录方式(OS audit trail files)。
2.不同设置下audit &trail的位置如下:
3.db 选项下的aud$表的迁移
在日常的数据库维护中,经常出现因为数据库登录审计的功能启动,导致system表空间被用满.从而出现异常,一般建议把aud$相关对象迁移到其他表空间,从而避免system被用完的风险.
10g及以前迁移方法
alter table AUDIT$ m
alter table AUDIT_ACTIONS m
alter table AUD$ m
alter table AUD$ move lob(SQLBIND) store as
SYS_ILC00041$$ (tablespace users);
alter table AUD$ move lob(SQLTEXT) store as
SYS_ILC00041$$ (tablespace users);
alter index I_AUDIT rebuild onl
alter index I_AUDIT_ACTIONS rebuild online tablespace
可以使用DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION进行迁移
conn / as sysdba
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION(audit_trail_type
=& DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD,
audit_trail_location_value =& 'USERS');
4.审计日志清理
10g及以前通过手工清理的方式或自定义作业来定期清理
DELETE FROM SYS.AUD$;
DELETE FROM SYS.AUD$
WHERE obj$name='EMP';
OS和XML选项下进行手动删除审计文件
11g 新特性
通过DBMS_AUDIT_MGMT包下的子过程进行手动或定期清理,功能如下
Subprogram
Description
Deletes audit trail
records/files that have been archived
Clears the timestamp set by
Creates a purge job for
periodically deleting the audit trail records/files
Undoes the setup and
initialization performed by the&
Drops the purge job created
using the&
Sets up the audit management
infrastructure and sets a default cleanup interval for audit trail
records/files
Checks to see if the&&has been run for an audit trail type
Sets a timestamp indicating
when the audit records/files were last archived
Sets the interval at which
the&&is called for the purge job that you specify
Enables or disables the purge
job that you specify
阅读(11) | 评论(0) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。怎样清除v$archived_log视图中的过期信息_数据库技术_Linux公社-Linux系统门户网站
你好,游客
怎样清除v$archived_log视图中的过期信息
来源:Linux社区&
作者:Darren_Guo
在使用RMAN命令删除归档后,查询v$archived_log视图会发现name列为空了,但其他列的信息还保留,时间长了会留下很多过期的信息,影响维护工作,需要将过期的信息删除。首先模拟下问题的出现过程:
--删除归档日志之前查看v$archived_log视图,情况正常
SQL& select dest_id,sequence#,name,blocks from v$archived_log;
& &DEST_ID SEQUENCE#& & & & & & & & & & NAME& & & & & & & & & & & &
---------- ---------- --------------------------------------------- ----------
101 & & & & &/oradata/archive/orcl_1_101_.arc & &
102 & & & & &/oradata/archive/orcl_1_102_.arc & &
103 & & & & &/oradata/archive/orcl_1_103_.arc & &
104 & & & & &/oradata/archive/orcl_1_104_.arc & &
105 & & & & &/oradata/archive/orcl_1_105_.arc & &
106 & & & & &/oradata/archive/orcl_1_106_.arc & &
107 & & & & &/oradata/archive/orcl_1_107_.arc & &
108 & & & & &/oradata/archive/orcl_1_108_.arc & &
--使用RAMN命令删除归档
RMAN& delete archivelog all;
--再次查询v$archived_log视图,name列为空
SQL& select dest_id,sequence#,name,blocks from v$archived_log;
& &DEST_ID SEQUENCE#& & & & & & & & & & NAME& & & & & & & & & & & &
---------- ---------- --------------------------------------------- ----------
101 & & & & & & & & & & & & & & & & & & & & & & & & & & & &2730
102 & & & & & & & & & & & & & & & & & & & & & & & & & & & &95711
103 & & & & & & & & & & & & & & & & & & & & & & & & & & & &94813
104 & & & & & & & & & & & & & & & & & & & & & & & & & & & &95048
105 & & & & & & & & & & & & & & & & & & & & & & & & & & & &94677
106 & & & & & & & & & & & & & & & & & & & & & & & & & & & &97494
107 & & & & & & & & & & & & & & & & & & & & & & & & & & & &94300
108 & & & & & & & & & & & & & & & & & & & & & & & & & & & &97494
& & & 出现这样的现象是因为使用RMAN命令在删除归档日志的时候不能够清楚控制文件中的内容,导致v$archived_log留下的过期的不完整信息。下面将归档信息进行清除:
--清除控制文件中关于v$archived_log的信息
SQL& execute sys.dbms_backup_restore.resetCfileSection(11);
PL/SQL procedure successfully completed.
--再次查询v$archived_log,信息已经被清除
SQL& select dest_id,sequence#,name,blocks from v$archived_log;
no rows selected
& & & 但是这样是把所有的v$archive_log信息都清除了,包括未过期的也会不清除。下面再将未过期的归档文件信息注册进来。
--我测试环境上归档日志都在/oradata/archive/中
RMAN& catalog start with '/oradata/archive/';
--再次查询v$archived_log,未被删除的归档信息可以查询到了
SQL& select dest_id,sequence#,name,blocks from v$archived_log;
& &DEST_ID SEQUENCE#& & & & & & & & & & &NAME& & & & & & & & & & & & BLOCKS
---------- ---------- --------------------------------------------- ----------
110 & & & & & /oradata/archive/orcl_1_110_.arc & &
111 & & & & & /oradata/archive/orcl_1_111_.arc & &
109 & & & & & /oradata/archive/orcl_1_109_.arc & &
更多相关信息见 专题页面
本文永久更新链接地址:
相关资讯 & & &
& (04/26/:26)
& (08/19/:26)
& (09/12/:31)
& (08/19/:44)
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并接受上述条款}

我要回帖

更多关于 archived什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信