Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
Showing results for 
Search instead for 
Did you mean: 

Oracle instance won't shut down

Maarten van Maanen
Regular Advisor

Oracle instance won't shut down

I have a problem with the full backup of our Oracle production database on our HP9000 K370 under HP-UX 11.00
From root-crontab a fbackup job is scheduled in a script. In this script a shutdown script is invoked with su - oracle -c.
The default oracle account is tied to our test-database (ORACLE_SID=C2K) so it has to be switched to the production database, which is C2P. The guys who installed our Oracle (and who wrote the script) use the export command. However, the Oracle-account uses de csh-shell which does not support the export command. Therefore, the command svrmgrl and shutdown will only shut down the test-database, not the production database. As far as I can see, the script as given below therefore has never worked. What can I do to solve this problem. I'm not a Oracle-DBA so I have to be a bit careful here..

export ORACLE_HOME=/disk01/app/oracle/product/8.0.5

svrmgrl <connect internal
shutdown abort
shutdown immediate

lsnrctl <stop
John Palmer
Honored Contributor

Re: Oracle instance won't shut down

Hi Maarten,

As you have started your script with '#!...' I suggest that you change su - oracle -c '...' to su oracle -c '...'

This will not invoke the C shell at all.

Within the script itself, you need to add $ORACLE_HOME/bin to PATH. A tip that I would suggest here is to have some sort of 'ora_env' script that sets the Oracle environment according to /etc/oratab. This makes it much easier to upgrade a database, rather than check and change lots of scripts that have ORACLE_HOME etc coded in them you simply have to edit /etc/oratab. Oracle supply one which normally gets put in /usr/local/bin but I prefer to write my own : 'ora_env':-

export ORACLE_SID=${1:-XXXX}
ORAINFO=$(grep "^${ORACLE_SID}:" /etc/oratab 2>/dev/null)
if [[ -n ${ORAINFO} ]];
then ORAINFO=${ORAINFO%%\#*}
set ${ORAINFO}
unset IFS

export ORACLE_HOME=${2}
export PATH=${PATH}:${ORACLE_HOME}/bin

else print "No info in /etc/oratab for SID ${ORACLE_SID}"

Code the following into your script to call it:

. /ora_env

If you omit then it will default to XXXX, change that to whatever default you require.

I code the shutdown sequence as follows:-

shutdown immediate

monitor the svrmgrl process and if it hasn't completed in 5 minutes, kill it then

shutdown abort
startup restrict

Honored Contributor

Re: Oracle instance won't shut down

Hi Maarten,
The script seems correct, so I wonder if there isnt something wrong with your ORACLE_HOME

Just thoughts

Best regards
Dieter Degrendele_1
Frequent Advisor

Re: Oracle instance won't shut down


I saw the script these guys wrote. I hope you have good backups because they shoot down the database (shutdown abort). This is quite dangerous. Replace the shutdown abort by shutdown immediate, which does the same but is less dangerous.

Dieter Degrendele
The possible we did, the unpossible we're doing but for a miracle you have to wait some time.