How does crontab handle Oracle operation problems?

Source: Internet
Author: User

[Root @ localhost home] # vi test. sh
#! /Bin/sh
Oracle_HOME =/oracle/ora10/product
Export ORACLE_HOME
Userpwd = test/test@10.11.0.235: 1521/ora10g
$ ORACLE_HOME/bin/sqlplus-S $ userpwd <EOF
Alter session set nls_date_format = 'yyyy-mm-dd hh24: mi: ss ';
Insert into test values (1, 'test ');
COMMIT;
EOF
Exit;
 
The ORACLE_HOME environment variable must be set in the above test. sh file; otherwise, it cannot be executed normally when added to crontab (for example, comment out the environment variable: # ORACLE_HOME =/oracle/ora10/product
# Export ORACLE_HOME
), Even if the absolute path/oracle/ora10/product/bin is added before sqlplus, the crontab file is as follows: test1_crond. For the logs, see/var/log/cron.

[Root @ localhost cron. d] # vi test1_crond
* *** Root sh/home/test. sh>/home/test. log
~
~
SQL> conn test/test
Connected.
SQL> select * from test;
ID NAME
------------------------------
1 test
1 test
1 test
SQL>

[Root @ localhost cron. d] # tail-f/var/log/cron
Aug 17 14:03:01 localhost crond[ 10718]: (root) CMD (sh/home/x. sh)
Aug 17 14:03:01 localhost crond [10720]: (root) CMD (sh/home/test. sh>/home/test. log)
Aug 17 14:04:01 localhost crond[ 11102]: (root) CMD (sh/home/x. sh)
Aug 17 14:04:01 localhost crond [11103]: (root) CMD (sh/home/test. sh>/home/test. log)
Aug 17 14:05:01 localhost crond[ 11449]: (root) CMD (sh/home/x. sh)
Aug 17 14:05:01 localhost crond [11452]: (root) CMD (sh/home/test. sh>/home/test. log)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.