How to start Oracle database automatically | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

How to start Oracle database automatically

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-24-2005
greg0320 greg0320 is offline
Registered User
 
Join Date: Jun 2004
Last Activity: 1 June 2005, 9:56 AM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
How to start Oracle database automatically

How to start Oracle database automatically when after SunSolaris is being re-booted?
TIA,
Greg
Sponsored Links
    #2  
Old 03-24-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
Registered User
 
Join Date: Apr 2002
Last Activity: 3 April 2014, 2:50 PM EDT
Location: On my motorcycle
Posts: 3,092
Thanks: 1
Thanked 29 Times in 9 Posts
This works on one of the servers running Oracle - you may have to change it to suit your needs.


Code:
#!/bin/sh
ORA_HOME=/u01/app/oracle/product/8.0.5
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "Oracle startup: annot start"
exit
fi
case "$1" in
  'start')
# start Oracle databases
su - oracle -c $ORA_HOME/bin/dbstart
su - oracle -c "$ORA_HOME/bin/lsnrctl start "
;;
'stop')
# stop Oracle databases
su - oracle -c "$ORA_HOME/bin/lsnrctl stop "
su - oracle -c $ORA_HOME/bin/dbshut
;;
esac

Sponsored Links
    #3  
Old 03-24-2005
tmarikle tmarikle is offline Forum Advisor  
Registered User
 
Join Date: Jan 2005
Last Activity: 27 September 2011, 12:36 PM EDT
Posts: 683
Thanks: 0
Thanked 4 Times in 4 Posts
And if you want to start and stop the other services such as the SNMP agent, OEM, and the web services:


Code:
# Start the Intelligent Agent
if [ -f $ORA_HOME/bin/agentctl ]; then           
    su - $ORA_OWNER -c "$ORA_HOME/bin/agentctl start"
else
    su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl dbsnmp_start"
fi

# Start Management Server
if [ -f $ORA_HOME/bin/oemctl ]; then
    su - $ORA_OWNER -c "$ORA_HOME/bin/oemctl start oms"
fi

# Start HTTP Server
if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then
    su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl start"
fi

# Stop HTTP Server
if [ -f $ORA_HOME/Apache/Apache/bin/apachectl ]; then
    su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl stop"
fi
# Stop Management Server
if [ -f $ORA_HOME/bin/oemctl ]; then
    su - $ORA_OWNER -c "$ORA_HOME/bin/oemctl stop oms sysman/<password>"
fi
# Stop the Intelligent Agent
if [ -f $ORA_HOME/bin/agentctl ]; then
    su - $ORA_OWNER -c "$ORA_HOME/bin/agentctl stop"
else
    su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl dbsnmp_stop"
fi

    #4  
Old 03-30-2005
encrypted's Avatar
encrypted encrypted is offline Forum Advisor  
Registered User
 
Join Date: Feb 2004
Last Activity: 30 November 2011, 9:36 AM EST
Location: Oslo, Norway
Posts: 220
Thanks: 0
Thanked 1 Time in 1 Post
Tested on Sun Solaris:

Code:
#!/bin/sh

  if [ -d /export/home/oracle/OracleStartScripts ] ; then
        :
  else
        mkdir /export/home/oracle/OracleStartScripts
        chown oracle:oinstall /export/home/oracle/OracleStartScripts
  fi

  echo "\
        ORACLE_BASE=/u01/app/oracle
        ORACLE_HOME=\$ORACLE_BASE/product/8.1.7
        ORACLE_SID=test
        ORA_NLS33=\$ORACLE_HOME/ocommon/nls/admin/data
        PATH=.:\$ORACLE_HOME/bin:opt/bin:/bin:/usr/bin:/usr/ccs/bin:/usr/ucb:/etc/usr/sbin

        export ORACLE_BASE
        export ORACLE_HOME
        export ORACLE_SID
        export NLS_LANG
        export ORA_NLS33
        export PATH

        svrmgrl /nolog <<EOF
        connect internal
        startup
        EOF

        echo starting listner...
        lsnrctl start
        " > /export/home/oracle/OracleStartScripts/StartOra.sh

# 
  echo "\
        ORACLE_BASE=/u01/app/oracle
        ORACLE_HOME=\$ORACLE_BASE/product/8.1.7
        ORACLE_SID=test
        ORA_NLS33=\$ORACLE_HOME/ocommon/nls/admin/data
        PATH=.:\$ORACLE_HOME/bin:opt/bin:/bin:/usr/bin:/usr/ccs/bin:/usr/ucb:/etc/usr/sbin

        export ORACLE_BASE
        export ORACLE_HOME
        export ORACLE_SID
        export NLS_LANG
        export ORA_NLS33
        export PATH

        svrmgrl /nolog <<EOF
        connect internal
        shutdown immediate
        EOF

        echo starting listner...
        lsnrctl stop
        " > /export/home/oracle/OracleStartScripts/StopOra.sh
	
	chown oracle:oinstall /export/home/oracle/OracleStartScripts/StopOra.sh
	chown oracle:oinstall /export/home/oracle/OracleStartScripts/StartOra.sh
	
	chmod +x /export/home/oracle/OracleStartScripts/StopOra.sh
	chmod +x /export/home/oracle/OracleStartScripts/StartOra.sh 

 echo "\
   #!/bin/sh
   # start/Stop oracle Database
   
  case \"\$1\" in
   	'start')
   	# start the database
   	if [ -f /export/home/oracle/OracleStartScripts/StartOra.sh ] ; then
   		echo \"Start Oracle database.\"
   		su -l oracle -c /export/home/oracle/OracleStartScripts/StartOra.sh
   	else
   		echo \"Error! Can't find: /export/home/oracle/OracleStartScripts/StartOra.sh\"
   		echo \"          Oracle could not be Started!\"
   	fi
   	;;
   
  	'stop')
          # Stop the database
          if [ -f /export/home/oracle/OracleStartScripts/StopOra.sh ] ; then
                    echo \"stopping oracle Database.\"
                    su -l oracle -c /export/home/oracle/OracleStartScripts/StopOra.sh
           else
                        echo \"Error! Can't find:/export/home/oracle/OracleStartScripts/StopOra.sh\"
                        echo \"          Oracle could not be Stopped!\"
           fi
           ;;
   esac
                " > /etc/init.d/MYoracle

        chmod +x /etc/init.d/MYoracle

        ln -s /etc/init.d/MYoracle /etc/rc3.d/S99oracle
        ln -s /etc/init.d/MYoracle /etc/rc2.d/K99oracle
        ln -s /etc/init.d/MYoracle /etc/rc1.d/K99oracle
        ln -s /etc/init.d/MYoracle /etc/rc0.d/K99oracle
        ln -s /etc/init.d/MYoracle /etc/rcS.d/K99oracle

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Running script automatically when threshold limit met in one of the field in oracle database Agupte Shell Programming and Scripting 0 03-29-2012 12:47 AM
start some services automatically bernard12 UNIX for Advanced & Expert Users 6 12-22-2010 01:10 PM
Database can't start automatically on solaris Sachin Vaidya Solaris 2 02-27-2008 10:12 PM
Howto capture data from rs232port andpull data into oracle database-9i automatically boss UNIX for Dummies Questions & Answers 1 09-23-2007 02:35 AM
getting postfix tyo start automatically kmgrady01 UNIX for Dummies Questions & Answers 2 05-21-2002 02:18 AM



All times are GMT -4. The time now is 04:37 AM.