housekeeping.{ksh|cmd }

dbi services offers an intelligent housekeeping script to perform several types of operations on log files which are valid and identical for Microsoft Windows and Linux/Unix systems.

  • Archive continuously written files such as the Alert*.log or the dr*.log (Dataguard broker) log file or a third party file such as the Apache access_log or errog_log. The last nnn lines are kept In the original file.

  • Truncate files older than the threshold

  • Delete files older than the threshold

  • Compres (gzip) files older than the threshold

  • Oracle ADRCI (Automatic Diagnostic Repository Command Interpreter) purge.

    This function is available for any installed oracle products which have a Diagnostic repository.

    • By default the adrci policies are disabled and the purge Is done with purge -age <days>

    • If the adrci policies are enabled, first the adrci policies are set then purge Is run.

The implementation consist of

  • Copy the conf. template

cp ${DMK_HOME}/templates/etc/housekeeping.conf.<unix|win> \\
   ${DMK_HOME}/etc/housekeeping.conf
  • Adapt the configuration file This configuration file is composed of three sections:

- The Definition section, set default values for all operation types

DEF::DELET::100::# delete files older than 100 days
DEF::TRUNC::1000::# keep the 1000 last lines
DEF::ARCHI::1000::# backup the file and keep the 1000 last lines
DEF::COMPR::100::# compress files only if older than 100 days
# adrci control parameters (value 0 = switched off)
DEF::ADRCI_SHORTP_POLICY::0::# short time purge policy in hours
DEF::ADRCI_LONGP_POLICY::0::# long time purge policy in hours
DEF::ADRCI_SIZEP_POLICY::0::# size purge policy in bytes; ONLY IN ORACLE >= 12.2

- The Standard section, which is composed as follows

STD::ALERT_LOG::ARCHI::::
STD::DRC_LOG::ARCHI::::
STD::ADRCI::/u01/app/oracle::DELET::::
# Grid Infrastructure
STD::ADRCI::/u01/app/19.11.0/grid_1_0/log::DELET::::

You can add your own policy for other ORACLE adrci compatible products.

- The Custom section

CST::/u01/app/oracle/network/log/*::TRUNC::::
CST::/u01/app/oracle/admin/*/hist/*::DELET::100:: # customized aging
CST::/u01/app/oracle/admin/*/log/*::DELET::::

- The last feature is the customization of each line by adding digits between the double colons at the end of the line, like the 100 days from above example

- The static environment variables $ORACLE_BASE, $DMK_HOME are allowed and resolved.

- The text-based listener.log should only be added In oracle < 19c. In oracle >= 19c use the listener parameters LOG_FILE_NUM_LISTENER=<n>, LOG_FILE_SIZE_LISTENER=<n> Instead.

Syntax

housekeeping.{ksh|cmd} [-c configuration file|none]
  • Housekeeping with grid infra (ex ODA)

Review, adapt if needed, and use both housekeeping.oracle.conf (for Oracle) and housekeeping.grid.conf (for Grid) templates. The housekeeping for Oracle needs to be executed with oracle user and the housekeeping for Grid needs to be executed with grid user, albeit the installation was done without user seggregation. In this case, if no user seggregation was used during the installation, both housekeepings will be run with oracle user. Reminder that dbi Best Practises is to seggregate the role, having 2 linux users, oracle and grid.

Schedule the housekeeping in the appropriate oracle and grid crontab. The schedules should not be executed at the same time, as the housekeeping script is putting some locks. Recommendation is to give at least 3 hours before the 2 daily run.

Last updated