- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Oracle dbshut and dbstart
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2003 02:11 PM
тАО03-04-2003 02:11 PM
Oracle dbshut and dbstart
I use oraenv to create the user parameters and set oraenv_ask to yes so that when I log into the oracle user I'm prompted for the SID.
How might I create a script that can log into both database and issue the dbshut and dbstart as needed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2003 02:37 PM
тАО03-04-2003 02:37 PM
Re: Oracle dbshut and dbstart
You may have to modify your dbshut and dbstart commands to add something like this.
ORATAB=/etc/oratab
for SID in $(awk '{FS=":";print $1}' $ORATAB)
do
echo "Shutting down the instance $SID"
export ORACLE_SID=$SID
(your_oracle_shutdown|startup commands)
done
Same for startup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2003 09:55 PM
тАО03-04-2003 09:55 PM
Re: Oracle dbshut and dbstart
You can add the following lines to your dbshut and dbstart.
You should have entries in oratab for the two databases with the ORACLE_HOME and the third parameter "Y" defined.
Then add the following to DBSHUT script.
cat $ORATAB | 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
ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
if [ "$ORACLE_SID" = '*' ] ; then
ORACLE_SID=""
fi
# Called programs use same database ID
export ORACLE_SID
ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
# Called scripts use same home directory
export ORACLE_HOME
# Put $ORACLE_HOME/bin into PATH and export.
PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/etc ; export PATH
PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora
echo "Shutting down the instance $SID"
svrmgrl << EOF
connect internal
shutdown immediate
EOF
Add the same lines in your dbstart script except for after server manager login startup.
echo appropriate messages where necessary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2003 12:57 AM
тАО03-05-2003 12:57 AM
Re: Oracle dbshut and dbstart
the main way is to list all your database
show file /etc/oratab
in a Shell script use an order like this
L_BaseLst=`awk -F: '/^[^#*]/{print $1}' /etc/oratab | sort`
after you have to read your list
for L_BaseTmp in ${L_BaseLst}
do
# -- Check the status
ps -ef|grep ora_pmon_${L_BaseTmp}|grep -v grep >/dev/null
if [ $? -gt 0 ]
then
echo "ERR - database ${L_BaseTmp} is closed"
else
echo "\n\n ----> database ${L_BaseTmp}"
su - ${ORA_USR} -c "ORACLE_SID=${L_BaseTmp}; sqlplus system/${SystemPwd} shutdown immediate"
fi
done
This the a way, you have to modify this lines in order to put some logs file, or mail alert.
best regards Thierry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2003 01:02 AM
тАО03-05-2003 01:02 AM
Re: Oracle dbshut and dbstart
su - oracle -c ". [path] SID;dbshut"
and this works fine