Manage Audit File Directory Growth with cron (Doc ID 1298957.1)

简介: Manage Audit File Directory Growth with cron (Doc ID 1298957.1)
Step 1 - Identify the ASM audit directories
There are three directories that may contain audit files.  All three must be managed to control excessive growth.

Two default locations are based on environment variable settings when the ASM instance is started.  To determine the default locations for your system, login as the Grid Infrastructure software owner (typically either oracle or grid), set your environment so that you can connect to the ASM instance, then run the 'echo' commands provided below.  In this example, the two default audit directories are /u01/app/11.2.0/grid/rdbms/audit and /u01/app/oracle/admin/+ASM1/adump.


$ . /usr/local/bin/oraenv
ORACLE_SID = [+ASM1] ? +ASM1
The Oracle base for ORACLE_HOME=/u01/app/11.2.0/grid is /u01/app/oracle

$ echo $ORACLE_HOME/rdbms/audit
/u01/app/11.2.0/grid/rdbms/audit

$ echo $ORACLE_BASE/admin/$ORACLE_SID/adump
/u01/app/oracle/admin/+ASM1/adump


The third ASM audit directory can be found by logging into the ASM instance with SQL*Plus and running this statement:


$ sqlplus '/ as sysasm'

SQL> select value from v$parameter where name = 'audit_file_dest';

VALUE
--------------------------------------------------------------------------------
/u01/app/11.2.0/grid/rdbms/audit

All three ASM audit directories will be managed with cron(8).

Step 2 - Give Grid Infrastructure software owner permission to use cron
Audit files are owned by the Grid Infrastructure software owner, which is typically either oracle or grid.  Commands to move or remove audit files must be run as the Grid Infrastructure software owner.  As root, add the Grid Infrastructure software owner to /etc/cron.allow file.  The examples below use the user oracle.


# echo oracle >> /etc/cron.allow



Step 3 - Add command to crontab to manage audit files weekly
As the Grid Infrastructure software owner, add an entry to the crontab file.  The following command will start a vi(P) command edit session to edit the existing crontab file or create a new crontab file if one does not already exist.


$ crontab -e


 Add the following to this file as a single line:


0 2 * * sun /usr/bin/find /u01/app/11.2.0/grid/rdbms/audit /u01/app/11.2.0/grid/rdbms/audit /u01/app/oracle/admin/+ASM1/adump -maxdepth 1 -name '*.aud' -mtime +30 -delete

This crontab entry executes the find(1) command at 2AM every Sunday. The find(1) command deletes all audit files in the three ASM audit directories that are older than 30 days.

If you wish to retain audit files for a longer period of time, instead of deleting the audit files with the find(1) command, you can archive audit files to a different directory or storage device using a crontab entry like the following:


0 2 * * sun /usr/bin/find /u01/app/11.2.0/grid/rdbms/audit /u01/app/11.2.0/grid/rdbms/audit /u01/app/oracle/admin/+ASM1/adump -maxdepth 1 -name '*.aud' -mtime +30 -execdir /bin/mv {} /archived_audit_dir \;

This crontab entry executes the find(1) command at 2AM every Sunday. The find(1) command moves all audit files in the three ASM audit directories that are older than 30 days to /archived_audit_dir.


Save and exit the crontab file using vi commands (<ESC> :wq), then verify crontab contents.

$ crontab -l
0 2 * * sun /usr/bin/find /u01/app/11.2.0/grid/rdbms/audit /u01/app/11.2.0/grid/rdbms/audit /u01/app/oracle/admin/+ASM1/adump -maxdepth 1 -name '*.aud' -mtime +30 -delete



Troubleshooting
相关文章
|
人工智能
adobe2023全家桶阿里云
Adobe系列的软件都挺好的,需要做图、设计的工作者,基本都会用到Adobe系列的软件,一张张优秀图片的制作离不开这些软件的综合运用。
852 0
|
消息中间件 设计模式 Java
Java Review - Java进程内部的消息中间件_Event Bus设计模式
Java Review - Java进程内部的消息中间件_Event Bus设计模式
298 0
|
9月前
|
算法 应用服务中间件 网络安全
阿里云WoSign“国密RSA双SSL证书”应用实践
阿里云WoSign品牌SSL证书是阿里云平台热销的国产品牌证书之一,支持签发国密合规的SM2算法SSL证书以及全球信任的RSA算法SSL证书,能够满足平台用户不同的SSL证书应用需求,同时为用户提供国密模块支持,实现“国密/RSA双证书部署”。
916 6
阿里云WoSign“国密RSA双SSL证书”应用实践
|
9月前
|
人工智能 运维 数据可视化
凌晨急诊室诞生的疫苗系统:一个宝妈的AI破局之路
本文分享了一位妈妈在急诊室经历后,将技术与母爱结合的心路历程。从凌晨抱着高烧儿子就医,同时处理工作告警的崩溃时刻,到意识到妈妈和程序员都是“运维工程师”,作者逐步构建了宝宝疫苗管理系统。文章介绍了系统从静态命令行工具升级为动态智能预警系统的全过程,包括环境搭建、核心代码解析及家庭协同功能实现,并总结了碎片时间开发法与防坑指南。最终,作者通过技术赋予母爱温度,为其他妈妈提供了实用资源包,展现了代码背后的人文关怀。
246 5
|
C语言 计算机视觉
从C语言到C++_17(list的模拟实现)list不是原生指针的迭代器(中)
从C语言到C++_17(list的模拟实现)list不是原生指针的迭代器
152 1
|
运维 Python
|
Linux API 开发工具
Windows NT 驱动程序的编译、安装、调试
Windows 驱动分为两类,一类是从 Windows NT 遗留下来的驱动模型称为传统的 Windows NT 驱动程序模型,另一类是 Windows 添加了电源管理后的 KMDF (WDM)驱动程序。本文这里首先以最简单的 Windows NT 驱动模型为例介绍 Windows 驱动的简单编写、编译、安装及调试。
671 0
|
数据采集 XML 数据格式
Python爬虫Xpath库详解#4
XPath详解,涉及获取所有节点,子节点,父节点,属性匹配,文本获取,属性获取,按序选择等。【2月更文挑战第13天】
183 0
|
弹性计算 监控 应用服务中间件
云监控之自定义监控
云监控之自定义监控
|
设计模式 SQL Java
有点狠有点猛,我用责任链模式重构了业务代码
文章开篇,抛出一个老生常谈的问题,学习设计模式有什么作用? 设计模式主要是为了应对代码的复杂性,让其满足开闭原则,提高代码的扩展性 另外,学习的设计模式 一定要在业务代码中落实,只有理论没有真正实施,是无法真正掌握并且灵活运用设计模式的 这篇文章主要说 责任链设计模式,认识此模式是在读 Mybatis 源码时, Interceptor 拦截器主要使用的就是责任链,当时读过后就留下了很深的印象(内心 OS:还能这样玩)

热门文章

最新文章