04 March 2022

RMAN Backup Script

 #!/bin/bash

# Source the Oracle environment
if [ -f ~/.bash_profile ]; then
  source ~/.bash_profile
fi

LOG_FILE="/home/oraprod/backup_PRODCDB_${DATE}.log"
BACKUP_DIR="/backup/"

# Create the backup directory if it doesn't exist
mkdir -p ${BACKUP_DIR}

# Run RMAN commands directly
${ORACLE_HOME}/bin/rman target / log=${LOG_FILE} <<EOF
run {
  allocate channel d1 type disk;
  allocate channel d2 type disk;
  allocate channel d3 type disk;
  
  # Database backup
  backup AS COMPRESSED BACKUPSET format '${BACKUP_DIR}/PRODCDB_bu_db_%d_t%t_s%s_p%p' database;
  
  # Archive logs
  sql 'alter system archive log current';
  sql 'alter system archive log current';
  sql 'alter system archive log current';
  sql 'alter system archive log current';
  sql 'alter system archive log current';
  
  backup AS COMPRESSED BACKUPSET format '${BACKUP_DIR}/PRODCDB_bu_al_t%t_s%s_p%p' archivelog all skip inaccessible delete input;
  
  # Controlfile backup
  backup format '${BACKUP_DIR}/PRODCDB_control%U' current controlfile;
  
  # Release channels
  release channel d1;
  release channel d2;
  release channel d3;
  
  # Crosscheck backup
  allocate channel d1 type disk;
  crosscheck backup;
  release channel d1;
}
EOF

# Check if the backup succeeded
if [ $? -eq 0 ]; then
  echo "RMAN backup completed successfully. Backup files are stored in ${BACKUP_DIR}."
else
  echo "RMAN backup failed. Check the log file: ${LOG_FILE}" >&2
  exit 1
fi

Oracle E-Business Suite R12.2.14 Clone with Oracle 19c Database

Oracle E-Business Suite R12.2.14 Clone with Oracle 19c Database Oracle E-Business Suite R12.2.14 Clone with Oracle 1...