Thursday, December 1, 2016

Configuration Baseline Collector Script For Linux OS & Oracle Databases

Have you ever performed a change on your OS or DB and later you figured out that you need to revert back to the previous setting but you struggled a lot to do so?

It happened to me before! but the good lesson I've learned was to keep a configuration baseline for each system, in order to save all important settings & configurations somewhere, so when the time come to revert back any change, the configuration baseline will be your friend.

Creating a configuration baseline for each and every OS & database in your environment may become a daunting job, unless you do it through a script. This is why I'm sharing today a Linux shell script to make this task a piece of cake for you.

You can download it from here:
https://www.dropbox.com/s/g36ev2chshklbrs/configuration_baseline.sh?dl=0

The script should run by the Oracle Installation owner (e.g. oracle), and will write one log for the OS configuration baseline and one log for each up and running oracle database. 

The following are the script features:

DATABASE Configuration Baseline: [For each database]
- Gather Instances & Database general info.
- Gather NON-DEFAULT Initialization Parameters.
- Gather DATABASE ENABLED FEATURES.
- Gather DATABASE FEATURES USAGE HISTORY.
- Gather DATABASE SETTINGS [Default tablespaces, Characterset, ...]
- Gather SERVICES details.
- Gather CLUSTERWARE INTERCONNECT details.
- Gather PATCHING history.
- Gather DATABASE LINKS.
- Gather DIRECTORIES info.
- Gather ACLs.
- Gather AUDIT settings.
- Gather USERS AND PROFILES details.
- Gather NUMBER OF OBJECTS in each schema.
- Gather the SIZE of each schema.
- Gather PRIVILEGED USERS details.
- Gather DATABASE PHYSICAL STRUCTURE information:
- CONTROLFILES.
- REDOLOG FILES AND GROUPS.
- TABLESPACES AND DATAFILES [+Utilization].
- ASM DISK GROUPS AND ASM FILES [+Utilization].
- FLASH RECOVERY AREA DETAILS [+Utilization].
- Gather RMAN NON-DEFAULT CONFIGURATIONS.
- Gather ACTIVE INCIDENTS information.
- Gather OUTSTANDING BUILT-IN ALERTS.
- Gather SCHEDULED JOBS details.
- Gather AUTO-TASK MAINTENANCE WINDOW details.
- Gather ADVISORS STATUS.
- Gather HARDWARE STATISTICS details.
- Gather RECYCLEBIN information.
- Gather FLASHBACK RESTORE POINTS details.
- Gather FOREIGN KEY COLUMNS HAVING NO INDEXES information.
- Gather DISABLED CONSTRAINTS details.
- Gather MONITORED INDEXES details.
- Gather COMPRESSED TABLES details.
- Gather PARTITIONED TABLES details.

OPERATING SYSTEM Configuration Baseline:
      - Gather RUNNING DATABASES & LISTENERS names.
      - Gather LISTENERS STATUS details.
      - Gather SERVER NAME AND OS/KERNEL VERSION information.
      - Gather BOOT CONFIGURATION.
      - Gather ORACLE FILES details:
- oratab
- listener.ora
- tnsnames.ora
- sqlnet.ora
      - Gather INSTALLED OPATCH PATCHES details.
      - Gather FILESYSTEM details.
      - Gather FILSYSTEM configurations.
- LOCAL FILESYSTEM.
- NFS SHARES.
- RAW DEVICES.
- MULTIPATH CONFIGURATIONS.
- ORACLE ASM CONFIGURATIONS.
      - Gather USERS AND GROUPS details.
      - Gather ACCOUNTS SETTINGS details.
      - Gather USERS RESOURCES LIMITS details.
      - Gather ORACLE USER CRONTAB JOBS details.
      - Gather ORACLE USER PROFILE.
      - Gather GENERIC/bashrc PROFILE.
      - Gather SECURITY CONFIGURATIONS:
- FIREWALL RULES. [hashed]
- PAM configurations.
- LOGINS default configurations.
- SELINUX configurations.
- INTRO MESSAGE.
      - Gather SERVICES CONFIGURATIONS.
      - Gather KERNEL PARAMETERS SETTINGS.
      - Gather NETWORK CONFIGURATIONS:
- GENERAL NETWORK SETTINGS.
- DNS SETTINGS.
- NICS CONFIGURATIONS.
- NICS BONDING ALIASES.
- LOCAL/ALLOWED/DENIED HOSTS SETTINGS.
      - Gather TIME AND DATE CONFIGURATIONS:
- LOCAL TIME CONFIGURATIONS.
- NTP STATUS & SETTINGS.
      - Gather LOGGING SETTINGS:
- SYSLOG SETTINGS.
- KEEP LOG SETTINGS.
- LOG ROTATE SETTINGS.
      - Gather HARDWARE INFORMATION:
- ALL ATTACHED HARDWARE.
- ATTACHED PCI DEVICES.
- CPU details.
- MEMORY details.
      - Gather INSTALLED PACKAGES information.

Please note that this shell script is tested on Linux Redhat & Oracle distributions, I didn't test it on any other Linux distributions, nevertheless, you need to test it first on a test environment and use it on your own risk.
Even Oracle Support is saying the same statement in their scripts, I'm not that arrogant to claim that I'm smarter than them :-))

Remember, you are most welcome to report bugs and suggestions.