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...
#!/bin/bash export ORACLE_SID=<your_cdb_sid> export ORAENV_ASK=NO . oraenv > /dev/null 2>&1 LOG_DIR=/tmp/post_migration_check mkdir -p "$LOG_DIR" LOGFILE="$LOG_DIR/post_migration_check_$(date +%Y%m%d_%H%M%S).log" exec_sql() { sqlplus -s "/ as sysdba" <<EOF set pages 100 lines 200 feedback off heading on echo off col name for a20 col open_mode for a20 col restricted for a15 col object_type for a20 col object_name for a40 col owner for a20 col comp_name for a35 col status for a15 col wallet_status for a20 col tablespace_name for a30 col encrypted for a10 col activating_pdbname for a25 $1 exit EOF } check_flag() { if grep -iq "$2" <<< "$1"; then echo "$3 : PASSED" | tee -a $LOGFILE else echo "$3 : NOT PASSED" | tee -a $LOGFILE fi } echo "=== Post Migration Certification Checks ===" | tee -a $LOGFILE # ASM SID detection ASM_SID=$(ps -ef | grep pmon | grep ASM | grep...
Comments
Post a Comment