Home » RDBMS Server » Server Administration » Starting and Stopping Database using a script (Oracle 9i Database,SUSE Ent 9, SP 4)
Starting and Stopping Database using a script [message #312674] Wed, 09 April 2008 10:34 Go to next message
gpolelo
Messages: 6
Registered: April 2008
Location: Botswana
Junior Member

I wrote two scripts for Starting and stopping Application Server. And they work very well except that sometimes stopping opmn takes time. Anyway thats not my big worry.
And this how my script looks like, for starting AS.

#Running the script: . ./pstartAS.sh password
# 1. Starting Infrastructure

echo -----------------------
echo Starting Infrastructure
echo -----------------------

. ./10ginfra.env
lsnrctl start #Starting the listner

sqlplus -SILENT sys/$1 as sysdba @startsql.sql

emctl start dbconsole

opmnctl startall
emctl start iasconsole

echo ----------------------
echo Infrastructure Started
echo ----------------------

# 2. Statrting the Apllication Server(Middle Tier)
echo ---------------------------
echo Starting Application Server
echo ---------------------------

. ./10gmt.env
opmnctl startall
emctl start iasconsole

echo --------------------------
echo Application Server Started
echo --------------------------

But now i wrote another scripts for starting and stopping the DB and it seems like there is a problem with the way I am starting my SQL.But i did exact as i did for starting the AS.
The script looks like this:

#Running the script: . ./pstartDB.sh password DB_name
#1. Starting the Database

echo --------------------
echo Starting $2 Database
echo --------------------

. ./10ginfra.env
lsnrctl start

. ./9idb.env

ORACLE_SID=$2
export ORACLE_SID

sqlplus -S sys/$1 as sysdba @startsql.sql

echo -------------------
echo $2 Database started
echo -------------------


You will notice that i am calling another file which i wrote my SQL Commands in; which are : startup/shutdown immediate
exit
Please Help me Sad
  • Attachment: pstartDB.txt
    (Size: 0.39KB, Downloaded 121 times)
Re: Starting and Stopping Database using a script [message #313671 is a reply to message #312674] Mon, 14 April 2008 02:26 Go to previous messageGo to next message
halfydba
Messages: 20
Registered: November 2007
Location: Australia
Junior Member
try debugging your script using -x.

to the top of your script add
#!/bin/bash -x


( /bin/bash can be any shell you are using) then you will be able to see what is going on when you run the script
Re: Starting and Stopping Database using a script [message #314113 is a reply to message #312674] Tue, 15 April 2008 15:51 Go to previous message
rucknrun
Messages: 26
Registered: April 2005
Location: Edgewood, MD
Junior Member

The script we use in solaris 9 has section like below to start the infrastructure database.

echo "******** This script starts the necessary 10g Infrastructure Components ********"
echo
echo
echo
echo "***** Startup Infrastructure database, login as 'sys as sysdba'...*****"
sqlplus /nolog <<EOF
connect / as sysdba
startup
EOF
echo
echo
echo
Previous Topic: Invalid Packages After Restarting Instance
Next Topic: Need Steps to install oracle 9i in RHEL 4
Goto Forum:
  


Current Time: Wed Dec 07 10:39:51 CST 2016

Total time taken to generate the page: 0.11521 seconds