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
相关文章
|
Oracle 关系型数据库 分布式数据库
PolarDB常见问题之PolarDB(Oracle兼容版) 执行命令报错如何解决
PolarDB是阿里云推出的下一代关系型数据库,具有高性能、高可用性和弹性伸缩能力,适用于大规模数据处理场景。本汇总囊括了PolarDB使用中用户可能遭遇的一系列常见问题及解答,旨在为数据库管理员和开发者提供全面的问题指导,确保数据库平稳运行和优化使用体验。
|
Ubuntu 虚拟化
VMWare Tools没有正确安装或者版本过低导致的
VMWare Tools没有正确安装或者版本过低导致的
1626 2
|
测试技术 虚拟化 数据安全/隐私保护
【FusionCompute】使用VMware Workstaion安装部署VRM(三)
【FusionCompute】使用VMware Workstaion安装部署VRM(三)
2373 0
【FusionCompute】使用VMware Workstaion安装部署VRM(三)
|
5月前
|
存储 关系型数据库 API
|
5月前
|
SQL 安全 关系型数据库
阿里云数据管理DMS对接使用全流程:从零搭建企业级数据管控平台
本文系统阐述阿里云数据管理DMS(Data Management)的完整对接与使用流程。DMS作为一款支撑数据全生命周期的一站式数据管理平台,提供全域数据资产管理、数据库设计开发、数据集成与开发、数据消费以及内置数据灾备等核心能力。文章从产品定位与核心价值切入,详细拆解身份认证准备、实例录入、权限配置、SQL开发、数据导入导出、任务编排调度等全链路操作步骤,深入讲解数据库网关DG接入本地及第三方云数据库的方案,以及通过RAM进行精细化权限管控的最佳实践。同时提供Python SDK调用DMS OpenAPI的代码示例,帮助开发者实现自动化运维。最后归纳企业级数据管控的最佳实践与常见问题,助力读
|
关系型数据库 MySQL 数据库
【MySQL】手把手教你MySQL数据同步
【MySQL】手把手教你MySQL数据同步
|
Ubuntu Linux
查看Ubuntu版本的方法:
无论您是系统管理员还是普通用户,以上几种方法都可以很快地提供您所需的系统版本信息,并可以帮助您在需要进行系统升级或是向技术专家报告问题时,快速准确地提供系统详情。
2634 7
|
Ubuntu 关系型数据库 MySQL
MySQL二进制包安装
本文详细介绍了在多种Linux系统上通过二进制包安装MySQL 8.0和8.4版本的完整过程,涵盖用户创建、glibc版本匹配、程序解压、环境变量配置、初始化数据库及服务启动等步骤,并提供支持多发行版的一键安装脚本,助力高效部署MySQL环境。
2340 4
MySQL二进制包安装
|
弹性计算 关系型数据库 数据库
快速体验Cloudberry和APCC
通过Docker快速体验Cloudberry和APCC
1093 6

热门文章

最新文章