#!/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...
insert_pdb() { echo "Running PDB onboarding..." | tee -a "$LOGFILE" TGT_TYPE="Pluggable Database" HOST_NAME=$(hostname -f) for ENV_FILE in /home/oracle/*.env; do source "${ENV_FILE}" if [[ -z "$ORACLE_SID" || -z "$ORACLE_HOME" ]]; then echo "Environment variables not set in $ENV_FILE. Skipping..." | tee -a "$LOGFILE" continue fi # Verify if the CDB is running DB_STATUS=$(ps -ef | grep "[p]mon_${ORACLE_SID}" | wc -l) if [[ "$DB_STATUS" -eq 0 ]]; then echo "CDB $ORACLE_SID is not running. Skipping..." | tee -a "$LOGFILE" continue fi echo "Processing CDB: $ORACLE_SID" | tee -a "$LOGFILE" # Fetch PDBs in NORMAL status PDBS=$(sqlplus -s / as sysdba <<EOF SET HEAD OFF FEEDBACK OFF SELECT pdb_name FROM cdb_pdbs WHERE pdb_name != 'PDB\...
Comments
Post a Comment