vi aoratab #!/bin/ksh # To view / change current Oracle SID and ORALCE_HOME, PATH # # Biju Thomas - 10/15/97 # Modified - 13/02/98 - Add PATH feature! # echo ' ' echo '********************************************************************************' echo ' The current ORACLE_SID value is ' $ORACLE_SID echo '********************************************************************************' echo ' The following are valid instance names along with the ORACLE_HOME value:' echo ' ' wcntr=0 while read LINE do case $LINE in \#*) ;; #comment-line in oratab *) # Proceed only if third field is 'Y'. #if [ "`echo $LINE | awk -F: '{print $3}' -`" = "Y" ] ; then wcntr=`expr $wcntr + 1` OSID=`echo $LINE | awk -F: '{print $1}' -` if [ "$ORACLE_SID" = '*' ] ; then echo ' *** Unknown Value ***' fi OHOME=`echo $LINE | awk -F: '{print $2}' -` echo ' Slno:' $wcntr ' SID Name:' $OSID ' Oracle Home:' $OHOME #fi esac done < /etc/oratab echo ' ' echo '********************************************************************************' echo ' ' echo ' Do you want to change ORACLE_SID [Y/N]? \c' read choice case $choice in Y|y) continue;; *) return 0;; esac echo ' Enter Slno of the SID from above list : \c' read choice if test $choice -lt 0 || test $choice -gt $wcntr then echo ' Invalid choice.... Sorry!!!' return 1 fi wcntr=0 while read LINE do case $LINE in \#*) ;; #comment-line in oratab *) # Proceed only if third field is 'Y'. #if [ "`echo $LINE | awk -F: '{print $3}' -`" = "Y" ] ; then wcntr=`expr $wcntr + 1` if test $wcntr -eq $choice then ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -` if [ "$ORACLE_SID" = '*' ] ; then ORACLE_SID='' fi ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -` export ORACLE_HOME ORACLE_SID break; fi #fi esac done < /etc/oratab # # Change PATH with new oracle home # path=`echo $PATH | sed "s/:/ /g"` NEWPATH=$ORACLE_HOME/bin for dirname in $path do if [ `echo $dirname | grep oracle | grep bin | wc -l` -eq 0 ] then NEWPATH=`echo ${NEWPATH}:${dirname}` fi done export PATH=$NEWPATH export ORA_NLS= # echo ' ' echo '********************************************************************************' echo ' New value of ORACLE_SID is ' $ORACLE_SID echo ' New value of ORACLE_HOME is ' $ORACLE_HOME echo ' New value of PATH is ' $PATH echo '********************************************************************************' echo ' ' # ==== [root@rac01 ~]# . aoratab ******************************************************************************** The current ORACLE_SID value is ******************************************************************************** The following are valid instance names along with the ORACLE_HOME value: Slno: 1 SID Name: Oracle Home: Slno: 2 SID Name: Oracle Home: Slno: 3 SID Name: Oracle Home: Slno: 4 SID Name: Oracle Home: Slno: 5 SID Name: ora11g Oracle Home: /u01/app/oracle/product/11.2.0/dbhome_1 Slno: 6 SID Name: ibrac1 Oracle Home: /u01/app/oracle/product/12.2.0/dbhome_1 Slno: 7 SID Name: -MGMTDB Oracle Home: /u01/app/18.0.0/grid Slno: 8 SID Name: LRS Oracle Home: /u01/app/oracle/product/12.2.0/dbhome_1 Slno: 9 SID Name: ugarb Oracle Home: /u01/app/oracle/product/12.1.0/dbhome_1 Slno: 10 SID Name: ugarbx Oracle Home: /u01/app/oracle/product/12.1.0/dbhome_1 Slno: 11 SID Name: ugary Oracle Home: /u01/app/oracle/product/12.1.0/dbhome_1 Slno: 12 SID Name: ugarx Oracle Home: /u01/app/oracle/product/12.1.0/dbhome_1 Slno: 13 SID Name: -MGMTDB Oracle Home: /u01/app/19.0.0/grid Slno: 14 SID Name: ugari Oracle Home: /u01/app/oracle/product/12.1.0/dbhome_1 Slno: 15 SID Name: +ASM1 Oracle Home: /u01/app/19.0.0/grid Slno: 16 SID Name: garbage Oracle Home: /u01/app/oracle/product/12.1.0/dbhome_1 Slno: 17 SID Name: ugaryd Oracle Home: /u01/app/oracle/product/12.1.0/dbhome_1 Slno: 18 SID Name: Oracle Home: ******************************************************************************** Do you want to change ORACLE_SID [Y/N]? \c Y -bash: continue: only meaningful in a `for', `while', or `until' loop Enter Slno of the SID from above list : \c 5 ******************************************************************************** New value of ORACLE_SID is ora11g New value of ORACLE_HOME is /u01/app/oracle/product/11.2.0/dbhome_1 New value of PATH is /u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin ********************************************************************************
Search This Blog
Total Pageviews
Saturday, 22 June 2024
Oracle new oratab --
From web
Subscribe to:
Posts (Atom)
Oracle DBA
anuj blog Archive
- ► 2011 (362)