Skip to content
November 9, 2016 / doganay

nid.sh

Mustafa DOGANAY's Blog

#!/usr/bin/ksh ##################################################### ## nid.sh v1.3 ###################################### ## Mustafa DOGANAY - 2016 ## doganay.wordpress.com ## ##################################################### ######audit_file_dest 'i mkdir yapacaz if [ $# -ne 2 ];then echo "Usage: nid.sh " exit fi #DIRNAME=$(dirname $0) echo $0 export LOGFILE=nid.log cd $DIRNAME export DBOLD=$1 export DBNEW=$2 echo "Stopping OLD LISTENER.." lsnrctl stop LISTENER_$DBOLD echo "Backup spfile of OLD DB as pfile.." echo "Shutting Down OLD DB.." echo "Mounting OLD DB.." export ORACLE_SID=$DBOLD sqlplus / as sysdba << EOF > $LOGFILE create pfile='?/dbs/init$DBOLD.ora' from spfile; shutdown immediate; startup mount; exit; EOF export OLD_PATH=$(dirname $(grep control_files $ORACLE_HOME/dbs/init$DBOLD.ora |awk -F"=" '{print $2}' | awk -F"," '{print $1}' | sed "s/'//g")) export NEW_PATH=$(echo $OLD_PATH | sed "s/$DBOLD/$DBNEW/g") echo "YES" | nid TARGET=/ DBNAME=$DBNEW SETNAME=YES if [ $? -ne 0 ];then echo "TARGET=/ can not be used. Apply one-off patch:13366202" exit 1 fi echo "NID finished successfully." echo "Running alter file sql on new DB:" cd $OLD_PATH;ls -ltr…

View original post 28 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: