#!/bin/bash LOGFILE="/home/oracle/pdb_output.log" : > $LOGFILE # Clear the log file get_pdb_details() { echo "CDB_UNIQUE_NAME|PDB_NAME|CPU|SGA_MAX_SIZE_GB|SGA_TARGET_GB|PGA_GB|DB_SIZE_GB" > $LOGFILE # Iterate over each CDB for ENV_FILE in /home/oracle/*.env; do source "${ENV_FILE}" # Validate environment variables if [[ -z "$ORACLE_SID" || -z "$ORACLE_HOME" ]]; then continue fi # Check if CDB is running INSTANCE_STATUS=$(timeout 5 sqlplus -s / as sysdba <<EOF SET HEAD OFF FEEDBACK OFF SELECT instance_name FROM v\$instance WHERE status = 'OPEN'; EXIT; EOF ) if [[ -z "$INSTANCE_STATUS" ]]; then continue fi # Fetch CDB unique name CDB_UNIQUE_NAME=$(sqlplus -s / as sysdba <<EOF SET HEAD OFF FEEDBACK OFF SELECT value FROM v\$parameter WHERE name = 'db_unique_name'; EXIT; EO...
Standard Operating Procedure (SOP) for Database Read-Only Mode Validation Automation --- 1. Purpose This SOP outlines the automated process for validating the OPEN_MODE of multiple Oracle databases using a predefined list. The script identifies databases that are not in READ ONLY mode and sends an email notification for further review. --- 2. Scope Applies to Oracle databases running across multiple hosts. Uses a common tnsnames.ora file for connectivity. Executes SQL queries to check the database mode and uptime in that mode. Notifies the DBA team if any database is not in READ ONLY mode. --- 3. Prerequisites Ensure the Oracle environment variables are set correctly: export TNS_ADMIN=/auto/your/tns/location export ORACLE_HOME=/auto/your/oracle/home export PATH=$ORACLE_HOME/bin:$PATH A valid tnsnames.ora file containing the TNS entries for all databases. A list of target databases stored in a file (db_list.txt). A static username and password for database authentication. --- 4. Sc...
Comments
Post a Comment