Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When I run the script manually, the script will invoke RMAN and do the job well but when I leave it for crontab to run it, it is not invoking RMAN itself.
The same script is working fine in another linux server.
I think this is the usual crontab issue:
1. use full path in your script to invoke rman (and others)
2. save stderr somewhere to see what's happened, otherwise we can only guess.
Cron run its jobs in so called "sanitized" environment. You can read about this in it's manual.
You should source your .bashrc (or .profile or what suits) at beginning of script.
The script finds all of the binaries. Look closely at the error message in the log you posted -
ORA-12162: TNS:net service name is incorrectly specified
That means your tnsnames.ora file is missing, does not contain the SID connection string, is in the wrong directory, is not readable by the user running the crontab.
Thanks for the replies. I was out of town for some days.
When I run the script, it finishes normal but when I let the crontab run the script it goes error.
RMAN>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-12162: TNS:net service name is incorrectly specified
When I run the script, it finishes normal but when I let the crontab run the script it goes error.
Checking that you are aware there are environment differences between an interactive command and a command run by crontab. Not all of the setup in .bash_profile gets run. Plus anything you typo interactively, like setting your oracle environment, don't happen. Find those differences and add them to your script.
Quote:
ORA-12162: TNS:net service name is incorrectly specified
Error messages matter. Error messages have meaning. Read them carefully. This says your Oracle environment variables aren't set. Which is expected for a crontab run.
Let's see the lines of your script that set ORACLE_SID, ORACLE_BASE, ORACLE_HOME. Because those variables do need to be set in your script as it's not being run interactively.
Hi guys,
Thanks for the replies. I was out of town for some days. When I run the script, it finishes normal but when I let the crontab run the script it goes error.
RMAN>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-12162: TNS:net service name is incorrectly specified
You've been working with Oracle for some time now...have you contacted them for assistance with your scripts??? Have you looked at any of the MANY examples you can find by putting "how to run an rman script through cron on linux" into Google?? Things such as: https://oracle-base.com/articles/mis...hell-scripting
As you were told before, you need to specify these variables in your script. Are you???
Posting a script is useless. You need to explain if you have tried it, what's happened, what was expected ... The script itself is not enough to go further.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.