Cloninig scripts

#!/bin/ksh
##  Script to auto clone DOYENSYS RMANDuplicate

/bin/mailx -s “RPT:-DOYEN CLONING PROCESS Started at :-`date` ” $NOTIFY_LIST <$LOGFILE
NOTIFY_LIST=”gangai.nathan@doyensys.com
LOGFILE=/export/home/oracle/CLONE/DOYEN/logs/DOYEN_CLONE.txt
LOGFILE1=/export/home/oracle/CLONE/DOYEN/logs/rman_clone.txt
echo “Start of DOYEN CLONE  CREATION  at `date +%D-%T`”>$LOGFILE
echo “Beginning Maintenance Window for OEM DOYEN  at `date +%D-%T`”>>$LOGFILE
. /orahome/env/oracle_Agent12C_env
cd $ORACLE_HOME/bin
./emctl start blackout DOYEN_CLONE DOYEN
echo “Ending Maintenance Window for OEM DOYEN  at `date +%D-%T`”>>$LOGFILE

# ENV file
. /orahome/env/oracle_Atltrg_11g_env

# Stopping Listeners For preparation of Cloning
echo “Stopping LISTENER DOYEN PROCESS  at `date +%D-%T`”>>$LOGFILE
sh -x /export/home/oracle/oraprocs/DOYEN/stop_listener.sh
cat /export/home/oracle/oraprocs/DOYEN/logs/stop_ATLTRG_LISTENER.txt >>$LOGFILE
echo “Stopping LISTENER DOYEN PROCESS  at `date +%D-%T`”>>$LOGFILE

echo “Beginning Dropping Database DOYEN  at `date +%D-%T`”>>$LOGFILE
${ORACLE_HOME}/bin/sqlplus -s “/ as sysdba” <<-EOF >>$LOGFILE
shutdown immediate;
startup nomount;
alter database mount exclusive;
alter system enable restricted session;
drop database;
EOF
echo “Finished Dropping Database  DOYEN at `date +%D-%T`”>>$LOGFILE

echo ” Starting DB in nomount state ” >>$LOGFILE
echo “Beginning Starting Database DOYEN in MOUNT STATE  at `date +%D-%T`”>>$LOGFILE
${ORACLE_HOME}/bin/sqlplus -s “/ as sysdba” <<-EOF >>$LOGFILE
startup nomount pfile=’/orahome/app/oracle/product/11204/DOYEN/dbs/initATLTRG.ora’;
create spfile from pfile=’/orahome/app/oracle/product/11204/DOYEN/dbs/initATLTRG.ora’;
EOF
echo “End of Starting Database ATLLTRG in MOUNT STATE  at `date +%D-%T`”>>$LOGFILE

# Starting CLONE Listeners For preparation of Cloning
echo “Starting LISTENER DOYEN PROCESS  at `date +%D-%T`”>>$LOGFILE
sh -x /u01/home/oracle/CLONE/DOYENSYS/start_listener_CLONE.sh
cat /u01/home/oracle/CLONE/DOYENSYS/logs/start_ATLTRG_LISTENER.txt >>$LOGFILE
echo “Starting LISTENER DOYEN PROCESS  at `date +%D-%T`”>>$LOGFILE

echo ” Starting RMAN CLONE PROCESS at `date +%D-%T`”>>$LOGFILE
$ORACLE_HOME/bin/rman target /@ATLPROD_DD_RESTORE auxiliary / CMDFILE /u01/home/oracle/CLONE/DOYENSYS/SQL/rman_clone.sql LOG $LOGFILE1
echo ” Starting RMAN CLONE PROCESS END at `date +%D-%T`”>>$LOGFILE
echo ” LOGS FOR RMAN CLONE DUMP “
echo “====================================================”
echo “====================================================”
cat /u01/home/oracle/CLONE/DOYENSYS/logs/rman_clone.txt >>$LOGFILE
echo “====================================================”
echo “====================================================”
echo ” LOGS FOR RMAN CLONE DUMP “

echo ” Starting DB in nomount state at `date +%D-%T` ” >>$LOGFILE
echo “Beginning Starting Database DOYEN in FOR PFILE CREATION at `date +%D-%T`”>>$LOGFILE
${ORACLE_HOME}/bin/sqlplus -s “/ as sysdba” <<-EOF >>$LOGFILE
shutdown immediate;
startup mount;
alter database noarchivelog;
alter database open;
EOF
echo “End of Starting Database ATLLTRG in OPEN STATE  at `date +%D-%T`”>>$LOGFILE

# Starting Listeners After Cloning
echo “Starting LISTENER DOYEN PROCESS  at `date +%D-%T`”>>$LOGFILE
sh -x /u01/home/oracle/CLONE/DOYENSYS/start_listener.sh
cat /u01/home/oracle/CLONE/DOYENSYS/logs/start_ATLTRG_LISTENER.txt >>$LOGFILE
echo “Starting LISTENER DOYEN PROCESS Ended at `date +%D-%T`”>>$LOGFILE

echo “Starting of POST CLONE Database ACTIVITY at `date +%D-%T`”>>$LOGFILE
${ORACLE_HOME}/bin/sqlplus -s “/ as sysdba” <<-EOF >>$LOGFILE
PROMPT DROPPING THE PUBLIC SYNONYNMS
@/u01/home/oracle/CLONE/DOYENSYS/SQL/post_clone.sql
@/u01/home/oracle/CLONE/DOYENSYS/SQL/list.sql
EOF

echo ” Starting of POST CLONE Database ACTIVITY :- Dropping Private DB Links at `date +%D-%T`”>>$LOGFILE
sh -x /u01/home/oracle/CLONE/DOYENSYS/drop_dblink.sh /u01/home/oracle/CLONE/DOYENSYS/SQL/list.log
cat /u01/home/oracle/CLONE/DOYENSYS/logs/drop_dblink_unixscript.txt >> $LOGFILE
echo ” Starting of POST CLONE Database ACTIVITY Finished :- Dropping Private DB Links at `date +%D-%T`”>>$LOGFILE

echo “Starting of POST CLONE1 Database ACTIVITY at `date +%D-%T`”>>$LOGFILE
${ORACLE_HOME}/bin/sqlplus -s “/ as sysdba” <<-EOF >>$LOGFILE
PROMPT DROPPING THE PUBLIC SYNONYNMS
@/export/home/oracle/CLONE/DOYEN/SQL/post_clone1.sql
EOF

echo “LOGS for POST CLONE Database ACTIVITY at `date +%D-%T`”>>$LOGFILE
cat /u01/home/oracle/CLONE/DOYENSYS/logs/drop_dblink.txt >>$LOGFILE
cat /u01/home/oracle/CLONE/DOYENSYS/logs/post_clone.txt >>$LOGFILE
echo “LOGS for POST CLONE Database ACTIVITY Ended at `date +%D-%T`”>>$LOGFILE

# Stopping CLONE Listeners For preparation of Cloning
echo “Stopping LISTENER DOYEN PROCESS  at `date +%D-%T`”>>$LOGFILE
sh -x /u01/home/oracle/CLONE/DOYENSYS/stop_listener_CLONE.sh
cat /u01/home/oracle/CLONE/DOYENSYS/logs/stop_ATLTRG_LISTENER.txt >>$LOGFILE
echo “Stopping LISTENER DOYEN PROCESS Ended at `date +%D-%T`”>>$LOGFILE
echo “End of ATLLTRG CREATION  at `date +%D-%T`”>>$LOGFILE

echo “Beginning Stopping Maintenance Window for OEM DOYEN  at `date +%D-%T`”>>$LOGFILE
. /orahome/env/oracle_Agent12C_env
cd $ORACLE_HOME/bin
./emctl stop blackout DOYEN_CLONE
echo “Ending Maintenance Window for OEM DOYEN  at `date +%D-%T`”>>$LOGFILE

/bin/mailx -s “RPT:-DOYEN CLONING PROCESS Ended at :-`date` ” $NOTIFY_LIST <$LOGFILE

set `date`
cp $LOGFILE $LOGFILE.$2$3$4

  • January 1, 2018 | 27 views
  • Comments