In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Use cron to manage growth of Oracle ASM audit file directories
If the audit file directory of an Oracle ASM instance is not regularly maintained, it will contain a large number of audit files. The presence of Dali audit files may cause the file system to run out of disk space or indos, or Oracle to run slowly due to file system expansion limits, or may cause Oracle ASM instances to hang at startup. This article describes how to use the cron tool for Linux to manage the number of files in the Oracle ASM audit file directory.
The specific actions are described below and must be performed for each node in the RAC environment.
1. Identify Oracle ASM Audit Catalog
There are three directories where Oracle ASM audit files may exist. All three directories must be controlled so that they do not grow excessively. The two default directories are based on the setting of environment variables at startup of the Oracle ASM instance. To determine the default directory on the right side of the system, log in to the system as the user (grid) who installed the Grid Infrastructure software, set the environment variables so you can connect to the Oracle ASM instance, and run the echo command.
[grid@cs1 ~]$ . /usr/local/bin/oraenvORACLE_SID = [+ASM1] ? +ASM1The Oracle base remains unchanged with value /u01/app/grid[grid@cs1 ~]$ echo $ORACLE_HOME/rdbms/audit/u01/app/product/12.2.0/crs/rdbms/audit[grid@cs1 ~]$ echo $ORACLE_BASE/admin/$ORACLE_SID/adump/u01/app/grid/admin/+ASM1/adump[grid@cs2 ~]$ . /usr/local/bin/oraenvORACLE_SID = [+ASM2] ? The Oracle base remains unchanged with value /u01/app/grid[grid@cs2 ~]$ echo $ORACLE_HOME/rdbms/audit/u01/app/product/12.2.0/crs/rdbms/audit[grid@cs2 ~]$ echo $ORACLE_BASE/admin/$ORACLE_SID/adump/u01/app/grid/admin/+ASM2/adump
The third Oracle ASM audit directory can be queried after logging into Oracle ASM instances using SQL*Plus
grid@cs1 ~]$ sqlplus / as sysasmSQL*Plus: Release 12.2.0.1.0 Production on Wed Aug 1 14:13:47 2018Copyright (c) 1982, 2016, Oracle. All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionSQL> select value from v$parameter where name = 'audit_file_dest';VALUE--------------------------------------------------------------------------------/u01/app/product/12.2.0/crs/rdbms/audit
Here the third directory is the same as the first directory
2. Give Grid Infrastructure users cron privileges
Oracle ASM audit files are created by users of Grid Infrastructure software, usually oracle or grid. Commands to move or delete audit files must be executed by Grid Infrastructure software users. In Oracle Linux, if the/etc/cron.allow file exists, only users whose login names appear in the file can use the crontab command. The root user's login name must appear in the cron.allow file, and if the/etc/cron.deny file exists and the user's login name is in it, these users will not be able to execute crontab commands. If only the/etc/cron.deny file exists, users whose names do not appear in this file can use crontab. In Oracle Linux 7.1, there was only the file/etc/cron.deny, and no user existed to access the file, meaning that all users could execute crontab commands.
[root@cs1 etc]# cat cron.deny[root@cs1 etc]# ls -lrt crontab-rw-r--r--. 1 root root 451 Apr 29 2014 crontab[root@cs1 etc]# chmod 777 crontab[root@cs1 etc]# ls -lrt crontab-rwxrwxrwx. 1 root root 451 Apr 29 2014 crontab
3. Add commands to crontab to manage audit files
Add commands to crontab files as Grid Infrastructure software users
[grid@cs1 ~]$ crontab -e0 6 * * sun /usr/bin/find /u01/app/product/12.2.0/crs/rdbms/audit /u01/app/grid/admin/+ASM1/adump /u01/app/product/12.2.0/crs/rdbms/audit -maxdepth 1 -name '*.aud' -mtime +30 -delete
This crontab entry executes the find command every Sunday at 6 a.m. The find command will find and delete all audit files older than 30 days from the three audit directories. If you want to save the audit file for a longer time, then after executing the find command, move the relevant audit file to the backup directory, for example:
0 6 * * sun /usr/bin/find /u01/app/product/12.2.0/crs/rdbms/audit /u01/app/grid/admin/+ASM1/adump /u01/app/product/12.2.0/crs/rdbms/audit -maxdepth 1 -name '*.aud' -mtime +30 -execdir /bin/mv {} /archived_audit_dir \;
Check crontab
[grid@cs1 ~]$ crontab -l0 6 * * sun /usr/bin/find /u01/app/product/12.2.0/crs/rdbms/audit /u01/app/grid/admin/+ASM1/adump /u01/app/product/12.2.0/crs/rdbms/audit -maxdepth 1 -name '*.aud' -mtime +30 -delete
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.