Posts

Showing posts from August, 2024

Temp and diff table

 #!/bin/bash source /auto/home/oracledb_ci.cfg log "Starting Day 1: Daily Operations." # Step 1: Truncate CMDB_DB_CI_TEMP sqlplus -s $username/$password@$database <<EOF TRUNCATE TABLE CMDB_DB_CI_TEMP; exit EOF if [ $? -ne 0 ]; then     log "Failed to truncate CMDB_DB_CI_TEMP."     exit 1 fi log "CMDB_DB_CI_TEMP truncated successfully." # Step 2: Load CMDB_DB_CI_TEMP with current data control_file="/auto/home/oracledb_ci_temp.ctl" cat <<EOF > $control_file LOAD DATA INFILE '$csv_file' INTO TABLE CMDB_DB_CI_TEMP FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ( support_group, install_status, oracle_home, u_cmdb_ci_used_for, u_cmdb_owner_group, name, correlation_id, version ) EOF sqlldr $username/$password@$database control=$control_file log="$log_location/temp_loader_oracledb_ci.log" if [ $? -ne 0 ]; then     log "Failed to load data into CMDB_DB_CI_TEMP."     exit 1 fi log "D...

Decommission pre check

 #!/bin/bash # Function to log messages with timestamp LOG_FILE="decommission_precheck_${ORACLE_SID}.log" log() {     local message=$1     echo "$(date +'%Y-%m-%d %H:%M:%S') $message" | tee -a $LOG_FILE } # Check if correct arguments are provided if [ $# -ne 2 ]; then     echo "Usage: $0 <ORACLE_SID> <frame>"     exit 1 fi # Export environment variables export ORAENV_ASK=NO export ORACLE_SID=$1 export frame=$2 db_name=${ORACLE_SID%?} # Load Oracle environment . oraenv # Start logging log "Precheck gather information process started for ORACLE_SID: $ORACLE_SID" # Generate report file report_file="pre_check_report_$(date +%F).log" # Execute SQL script log "Executing queries.sql to gather database information." sqlplus -s / as sysdba <<EOF >> $report_file @queries.sql exit; EOF # Retrieve DB unique name log "Retrieving DB unique name from the database." db_unique_name=$(sqlplus -s / as sy...