Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

svrmgrl won't run sql command

SOLVED
Go to solution
Rizal Sharif
Occasional Visitor

svrmgrl won't run sql command

Hi all,

I have created a backup.cmd file and put it in crontab to stop & start Oracle database for backup purposes.
However, the script that I put in the crontab would not stop & start the database. So all the backup data cannot be used because the database is still open when the cp command work.

Attached, is the backup.cmd. stop.sql and start.sql that I used.

This is the entry in crontab:

* 2 * * 2,3,4,5,6 (. .profile; /uo3/oracle/script/backup.cmd) > cronerr 2>&1


The error message in the cronerr.
---------------------------------------
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter

^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2 ^2
Oracle Server Manager Release 3.1.6.0.0 - Production
Message 4505 not found; No message file for product=SVRMGR, facility=MGR
Error while trying to retrieve text for error ORA-12547
SVRMGR>
Message 37 not found; No message file for product=SVRMGR, facility=MGR
Oracle Server Manager Release 3.1.6.0.0 - Production
Message 4505 not found; No message file for product=SVRMGR, facility=MGR
Error while trying to retrieve text for error ORA-12547
SVRMGR>
Message 37 not found; No message file for product=SVRMGR, facility=MGR
-----------------------------------------------
From oracle website, ORA-12547 means that ORACLE_SID is not set and exported. However, I had inserted export ORACLE_SID=PROD command in my backup.cmd file.

I can still stop & start the database manually without any error. I'm using HP-UX 11.0 and Oracle 8.1.6 database.

Thank you for your help

Rizal Sharif

10 REPLIES
Steve Steel
Honored Contributor

Re: svrmgrl won't run sql command

Hi

Seems to be with the oracle

ora 12547
12547, 00000, "TNS:lost contact"
// *Cause: Partner has unexpectedly gone away, usually during process
// startup.
// *Action: Investigate partner application for abnormal termination. On an
// Interchange, this can happen if the machine is overloaded.


would suggest you log a parallel call with oracle


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
John Palmer
Honored Contributor

Re: svrmgrl won't run sql command

The error messages:
Oracle Server Manager Release 3.1.6.0.0 - Production
Message 4505 not found; No message file for product=SVRMGR

are consistent with $ORACLE_HOME/bin not being set in the PATH variable.

You need to ensure that the whole set of environment variables are being set in your script before calling any Oracle commands. You need (at least):
ORACLE_HOME
ORACLE_SID
PATH


Regards,
John
Duncan Edmonstone
Honored Contributor

Re: svrmgrl won't run sql command

Rizal,

Can you get into server manager from a standard shell prompt....

i.e. type:

# su - oracle

(login info is displayed....)

the type:

$ svrmgrl

which should bring you to a SVRMGR> prompt

If this works, the problem is in how you are calling this from your script... I assume this is the oracle users crontab, not the root crontab, as by default root isn't allowed to do a 'connect internal'

HTH

Duncan

HTH

Duncan
Duncan Edmonstone
Honored Contributor
Solution

Re: svrmgrl won't run sql command

Try the following:

export ORACLE_SID=PROD
export ORACLE_HOME=/uo1/oracle/product/8.1.6
export PATH=$PATH:$ORACLE_HOME/bin
su oracle -c svrmgrl << EOD
connect internal ;
shutdown immediate ;
exit;
EOD
rm /uo3/oradbuo3bak/prod/*
rm /uo4/oradbuo4bak/prod/*
cp /uo3/oradb/prod/*.* /uo3/oradbuo3bak/prod
cp /uo4/oradb/prod/*.* /uo4/oradbuo4bak/prod
su oracle -c svrmgrl << EOD
connect internal ;
startup pfile=/uo3/oradb/prod/initprod.ora ;
exit;
EOD
fbackup -f /dev/rmt/0m ii /uo3/oradbuo3bak/prod -i /uo4/oradbuo4bak/prod 2>> /tmp/back.err

With a root crontab entry like this:

* 2 * * 2,3,4,5,6 /uo3/oracle/script/backup.cmd > cronerr 2>&1

HTH

Duncan

HTH

Duncan
Rizal Sharif
Occasional Visitor

Re: svrmgrl won't run sql command

Yes, I can get into server manager from standard shell prompt and stop the database.

svrmgr> connect internal
svrmgr> shutdown immediate

.. and do the backup.

This is what I done when I do manual backup.
In this case, I've informed the all users not to use the system from 2.00 a.m till 3.00 a.m. and run the backup script.

The crontab is for oracle user.

Rizal Sharif
Rizal Sharif
Occasional Visitor

Re: svrmgrl won't run sql command

Thanks Duncan ,

I will try what you have suggested and post the results & assigned points later.

Regards

Rizal Sharif

Rizal Sharif
Occasional Visitor

Re: svrmgrl won't run sql command

For your info, when I login as a root, su - oracle and type svrmgrl the same error message appeared as in cronerr.
But, when I login as oracle, there is no error message when I type svrmgrl.

Regards

Rizal Sharif






Jeanine Kone
Trusted Contributor

Re: svrmgrl won't run sql command

I have to agree with John Palmer. It looks to me like the problme is your path (and any other env variables that Oracle might need) are not being set correctly. What I usually do is call a standard program (oraenv, but modified a bit) to set all of the oracle required variables from within each shell script that I call. The variables I set are:
ORACLE_SID, ORACLE_HOME, ORACLE_BASE, ORACLE_TERM, LD_LIBRARY_PATH, ORA_NLS33, ORA_NLS, PATH.
Brian Crabtree
Honored Contributor

Re: svrmgrl won't run sql command

You have gotten the correct information in what is wrong, but I will elaborate on what is happening.

In this case, svrmgrl (sqlplus, exp, imp, rman, etc) are looking for message and error files under your enviroment variable ORACLE_HOME, or in your current path. When it cant find it, you will get the error messages that you stated.

Why you are getting this when you do an "su - oracle", I'm not sure, as it should be loading your enviroment, and it sounds like you are using a .profile on your oracle account.

With cron however, your enviroment is not loaded when commands are run, but are run 'as-is' from a shell with your user's rights.

Hope this clears up any confusion you have.

Brian
Rizal Sharif
Occasional Visitor

Re: svrmgrl won't run sql command

Thank you to all of you & especially to Duncan, for pointing me the right track on how to make the script works.

After I put all the necessary Oracle variables in the .profile, the error message disappeared.

Thanks again.

Rizal Sharif