Script to Complete, Recover and Start Replica Oracle Database
#!/bin/ksh
#
# script: startdb.sh <list_of_database_volumes>
#
# Sample script to complete, recover and start replica Oracle database.
#
# It is assumed that you have already performed the following
# steps:
# 1. Create the local volumes, file systems, and mount points for the
# redo and archived logs, and then mount them.
# 2. Based on the text control file for the production database,
# write a SQL script that creates a control file for the replica
# database.
# 3. Create an initialization file for the replica database and place
# this in the replica database's $ORACLE_HOME/dbs directory.
# 4. Copy the Oracle password file for the production database to the
# replica database's $ORACLE_HOME/dbs directory.
export ORACLE_SID=REP1
export ORACLE_HOME=/rep/oracle/816
export PATH=$ORACLE_HOME/bin:$PATH
snapvoldg=snapdbdg
rep_mnt_point=/rep
# Import the snapshot volume disk group.
vxdg import $snapvoldg
# Mount the snapshot volumes (the mount points must already exist).
for i in $*
do
fsck -F vxfs /dev/vx/rdsk/$snapvoldg/snap_$i
mount -F vxfs /dev/vx/dsk/$snapvoldg/snap_$i ${rep_mnt_point}/$i
done
# Fix any symbolic links required by the database.
cd ${rep_mnt_point}/dbase_vol
for i in 1 2 3 4 5 6 # adjust as required
do
rm -f ./log$i
ln -s ${rep_mnt_point}/dbase_logs/log$i ./log$i
done
# Remove the existing control file.
rm -f ${rep_mnt_point}/dbase_vol/cntrl1
# Create a new control file, recover and start the replica database.
svrmgrl <<!
connect internal
@c_file_create.sql
set autorecovery on
recover database until cancel using backup controlfile;
alter database open resetlogs;
quit
!
|