#!/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...
#!/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