Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shutting down db's for backups 1

Status
Not open for further replies.

joeythelips

IS-IT--Management
Aug 1, 2001
305
IE
Hi,

i have 4 oracle instances on my hp-ux 11.0 server.

every night crontab runs a script called backup.sh which shuts down the databases, checks for oracle processes running on the server and if there are none, backs up the software, os, and db files.

However, our backup log produces the following:

IS-INFO: Backup started : Wed Mar 31 00:05:00 BST 2004
ORACLE instance shut down.
Database "testdb" shut down.
ORACLE instance shut down.
Database "nitestdb" shut down.
SVRMGR> ORACLE instance started.
Database "testdb" warm started.
SVRMGR> ORACLE instance started.
Database "nitestdb" warm started.
ORACLE instance shut down.
Database "testdb" shut down.
ORACLE instance shut down.
Database "nitestdb" shut down.
IS-ERROR: Wed Mar 31 00:05:41 BST 2004
IS-ERROR: Oracle background processes are still up and running!
IS-ERROR: Backup aborted!
IS-ERROR: Wed Mar 31 00:05:41 BST 2004
IS-ERROR: Backup ended with errors
IS-ERROR: For more details refer to the backup log

As we have 4 databases, i don't know why only 2 of them are shutdown: this is obviously the reason the backup is failing. Below is the start of the backup script.

How do i ensure that all four databases are shutdown?


DIR=/usr/backup
WEEKDAY=`date +%a`
LOG=$DIR/backup.$WEEKDAY.log
HEADER=$DIR/header.$WEEKDAY
ERROR=false

cd /

echo "IS-INFO: Backup started : `date`" > $LOG
su - oracle -c "dbshut immediate" >> $LOG 2>&1
su - oracle -c "dbstart" >> $LOG 2>&1
su - oracle -c "dbshut" >> $LOG 2>&1

if [ "`ps -ef | grep ora_ | grep -v grep | wc -l`" != "0" ]; then
echo "IS-ERROR: `date`" >> $LOG
echo "IS-ERROR: Oracle background processes are still up and running!" >> $LOG
echo "IS-ERROR: Backup aborted!"
 
Can you post the contents of your oratab file? This is used to control which databases are shut and opened by dbshut and dbstart. It's usually somewhere like /var/opt/oracle.
 
Hi Ken,

here is oratab. Obviously i need to add the 2 othe db names here. Does this file only get updated if you create a database using the Database Configuration Assistant?



# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
testdb:/u03/oracle/product/8.1.7:Y
nitestdb:/u03/oracle/product/8.1.7:Y
 
It looks that way, yes. You can manually edit it to include your other databases, though. Hope this has helped.
 
Hi Ken,

i still had a problem with the backup script last night.

The backup log said there were still background processes up and running.

i checked for oracle processes running on the server this morning and got the following:

istest) /u02/oracle/export testdb $ ps -ef|grep ora_
oracle 2241 1 0 Mar 18 ? 0:26 ora_snp0_SETTMTDB
istest 12942 1 0 10:08:43 ? 0:00 ora_snp2_testdb
oracle 2247 1 0 Mar 18 ? 0:20 ora_snp3_SETTMTDB
oracle 2249 1 0 Mar 18 ? 0:02 ora_s000_SETTMTDB
oracle 2229 1 0 Mar 18 ? 0:44 ora_pmon_SETTMTDB
istest 12936 1 0 10:08:43 ? 0:00 ora_reco_testdb
oracle 2245 1 0 Mar 18 ? 0:20 ora_snp2_SETTMTDB
istest 12944 1 0 10:08:43 ? 0:00 ora_snp3_testdb
oracle 2237 1 0 Mar 18 ? 0:05 ora_smon_SETTMTDB
oracle 2233 1 0 Mar 18 ? 0:34 ora_lgwr_SETTMTDB
oracle 2243 1 0 Mar 18 ? 0:20 ora_snp1_SETTMTDB
oracle 2231 1 0 Mar 18 ? 0:38 ora_dbw0_SETTMTDB
oracle 2239 1 0 Mar 18 ? 0:00 ora_reco_SETTMTDB
oracle 2251 1 0 Mar 18 ? 0:01 ora_d000_SETTMTDB
oracle 2235 1 0 Mar 18 ? 2:12 ora_ckpt_SETTMTDB
istest 12928 1 0 10:08:43 ? 0:00 ora_dbw0_testdb
istest 12926 1 0 10:08:43 ? 0:00 ora_pmon_testdb
istest 12934 1 0 10:08:43 ? 0:00 ora_smon_testdb
istest 12946 1 0 10:08:43 ? 0:00 ora_s000_testdb
istest 12938 1 0 10:08:43 ? 0:00 ora_snp0_testdb
istest 12940 1 0 10:08:43 ? 0:00 ora_snp1_testdb
istest 12948 1 0 10:08:43 ? 0:00 ora_d000_testdb
istest 12932 1 0 10:08:43 ? 0:00 ora_ckpt_testdb
istest 12930 1 0 10:08:43 ? 0:00 ora_lgwr_testdb

Could it be a caps lock issue? in the oratab file i have listed my settlement db as settmtdb but it appears here as SETTMTDB?

jOE
 
Joe - it's probable that it's a case issue. When you try to set oraenv (type . oraenv as user Oracle) to settmtdb or SETTMTDB, you probably don't get the environment set up correctly unless it matches the case (in this instance upper) required. This is probably also required in the oratab file. HTH.
 
Was there anything in the backup log relating to settmtdb last night?
 
IS-INFO: Backup started : Thu Apr 1 00:05:00 BST 2004
ORACLE instance shut down.
Database "testdb" shut down.
ORACLE instance shut down.
Database "nitestdb" shut down.
ORACLE instance shut down.
Database "jigsawdb" shut down.
ORACLE instance shut down.
Database "settmtdb" shut down.
SVRMGR> ORACLE instance started.
Database "testdb" warm started.
SVRMGR> ORACLE instance started.
Database "nitestdb" warm started.
SVRMGR> ORACLE instance started.
Database "jigsawdb" warm started.
SVRMGR> ORACLE instance started.
Database "settmtdb" warm started.
ORACLE instance shut down.
Database "testdb" shut down.
ORACLE instance shut down.
Database "nitestdb" shut down.
ORACLE instance shut down.
Database "jigsawdb" shut down.
ORACLE instance shut down.
Database "settmtdb" shut down.
IS-ERROR: Thu Apr 1 00:06:07 BST 2004
IS-ERROR: Oracle background processes are still up and running!
IS-ERROR: Backup aborted!
IS-ERROR: Thu Apr 1 00:06:07 BST 2004
IS-ERROR: Backup ended with errors
IS-ERROR: For more details refer to the backup log /usr/backup/backup.Thu.log
 
Hmm. It may be that the shutdown of settmtdb is reported, but is spurious. I think it's still worth adding the upper case version to oratab. You might also wish to consider adding a line:

ps -ef | grep ora_ | grep -v grep > running_procs

to your backup script, before the test condition, so that if there are still problems, running_procs will tell you the exact processes which were still running. HTH.
 
ok. thanks. i'll try that and report back on monday

Joe
 
have a look in the oracle alert log - it should identify the Oracle process not shuting down.
 
hi,

the changes to /etc/oratab did the trick.

thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top