2.7 Tracking File Attribute Changes and Comparing Snapshots
Use the Oracle ORAchk and Oracle EXAchk -fileattr
option and command flags to record and track file attribute settings, and compare snapshots.
Changes to the attributes of files such as owner, group, or permissions can cause unexpected consequences. Proactively monitor and mitigate the issues before your business gets impacted.
- Using the File Attribute Check With the Daemon
You must have Oracle Grid Infrastructure installed and running before you use-fileattr
. - Taking File Attribute Snapshots
By default, Oracle Grid Infrastructure homes and all the installed Oracle Database homes are included in the snapshots. - Including Directories to Check
Include directories in the file attribute changes check. - Excluding Directories from Checks
Exclude directories from file attribute changes checks. - Rechecking Changes
Compare the new snapshot with the previous one to track changes. - Designating a Snapshot As a Baseline
Designate a snapshot as a baseline to compare with other snapshots. - Restricting System Checks
Restrict Oracle ORAchk and Oracle EXAchk to perform only file attribute changes checks. - Removing Snapshots
Remove the snapshots diligently.
2.7.1 Using the File Attribute Check With the Daemon
You must have Oracle Grid Infrastructure installed and running before you use -fileattr
.
To use file attribute check with the daemon:
2.7.2 Taking File Attribute Snapshots
By default, Oracle Grid Infrastructure homes and all the installed Oracle Database homes are included in the snapshots.
To take file attribute snapshots:
$ ./orachk -fileattr start
CRS stack is running and CRS_HOME is not set. Do you want to set CRS_HOME to /u01/app/11.2.0.4/grid?[y/n][y]
Checking ssh user equivalency settings on all nodes in cluster
Node mysrv22 is configured for ssh user equivalency for oradb user
Node mysrv23 is configured for ssh user equivalency for oradb user
List of directories(recursive) for checking file attributes:
/u01/app/oradb/product/11.2.0/dbhome_11202
/u01/app/oradb/product/11.2.0/dbhome_11203
/u01/app/oradb/product/11.2.0/dbhome_11204
orachk has taken snapshot of file attributes for above directories at: /orahome/oradb/orachk/orachk_mysrv21_20160504_041214
2.7.3 Including Directories to Check
Include directories in the file attribute changes check.
To include directories to check:
$ ./orachk -fileattr start -includedir "/root/myapp/config/"
CRS stack is running and CRS_HOME is not set. Do you want to set CRS_HOME to /u01/app/12.2.0/grid?[y/n][y]
Checking for prompts on myserver18 for oragrid user...
Checking ssh user equivalency settings on all nodes in cluster
Node myserver17 is configured for ssh user equivalency for root user
List of directories(recursive) for checking file attributes:
/u01/app/12.2.0/grid
/u01/app/oradb/product/12.2.0/dbhome_1
/u01/app/oradb2/product/12.2.0/dbhome_1
/root/myapp/config/
orachk has taken snapshot of file attributes for above directories at: /root/orachk/orachk_ myserver18_20160511_032034
2.7.4 Excluding Directories from Checks
Exclude directories from file attribute changes checks.
To exclude directories from checks:
- Run the file attribute changes check command to exclude directories that you do not list in the
-includedir
discover list by using the-excludediscovery
option.
$ ./orachk -fileattr start -includedir "/root/myapp/config/" -excludediscovery
CRS stack is running and CRS_HOME is not set. Do you want to set CRS_HOME to /u01/app/12.2.0/grid?[y/n][y]
Checking for prompts on myserver18 for oragrid user...
Checking ssh user equivalency settings on all nodes in cluster
Node myserver17 is configured for ssh user equivalency for root user
List of directories(recursive) for checking file attributes:
/root/myapp/config/
orachk has taken snapshot of file attributes for above directories at: /root/orachk/orachk_myserver18_20160511_032209
2.7.5 Rechecking Changes
Compare the new snapshot with the previous one to track changes.
To recheck changes:
$ ./orachk -fileattr check -includedir "/root/myapp/config" -excludediscovery
CRS stack is running and CRS_HOME is not set. Do you want to set CRS_HOME to /u01/app/12.2.0/grid?[y/n][y]
Checking for prompts on myserver18 for oragrid user...
Checking ssh user equivalency settings on all nodes in cluster
Node myserver17 is configured for ssh user equivalency for root user
List of directories(recursive) for checking file attributes:
/root/myapp/config
Checking file attribute changes...
.
"/root/myapp/config/myappconfig.xml" is different:
Baseline : 0644 oracle root /root/myapp/config/myappconfig.xml
Current : 0644 root root /root/myapp/config/myappconfig.xml
...
Results of the file attribute changes are reflected in the File Attribute Changes section of the HTML output report.
2.7.6 Designating a Snapshot As a Baseline
Designate a snapshot as a baseline to compare with other snapshots.
To designate a snapshot as a baseline: