Dbms_scheduler In Unix Shell


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Dbms_scheduler In Unix Shell
# 1  
Old 01-06-2008
Dbms_scheduler In Unix Shell

I trying to call shell scripts through DBMS_SCHEDULER of Oracle. My procedure executed successfully and my shell scripts executed perfect in UNIX. However, the job does not run when i look through in SQL. I dont see any errors. Did any one of you use dbms_scheduler package to call shell scripts ? Do i need to add anything in my shell scripts? Please help

SQL> BEGIN
2 DBMS_SCHEDULER.CREATE_PROGRAM(
3 PROGRAM_NAME =>'CMS_DATABASE_BKUP',
4 PROGRAM_ACTION =>'/u01/j.ksh',
5 PROGRAM_TYPE => 'EXECUTABLE',
6 ENABLED => TRUE);
7
8 DBMS_SCHEDULER.CREATE_SCHEDULE(
9 SCHEDULE_NAME => 'CMS_SCHEDULE',
10 START_DATE => SYSDATE,
11 REPEAT_INTERVAL =>
12 'FREQ=HOURLY; INTERVAL=1',
13 COMMENTS=>'BACKUP');
14
15 DBMS_SCHEDULER.CREATE_JOB(
16 JOB_NAME => 'MSV_FULL',
17 JOB_TYPE => 'EXECUTABLE',
18 JOB_ACTION =>'/u01/j.ksh',
19 ENABLED => TRUE,
20 START_DATE => SYSDATE,
21 REPEAT_INTERVAL =>
22 'FREQ=HOURLY; INTERVAL=1',
23 COMMENTS=>'BACKUP');
24 END;
25 /

Shell scripts- j.ksh
rman target=/ <<EOF
SHUTDOWN IMMEDIATE
STARTUP MOUNT

ALLOCATE CHANNEL C1 DEVICE TYPE DISK
FORMAT '/U01/ORADATA/%U'
BACKUP DATABASE PLUS ARCHIVELOG;
SQL 'ALTER DATABASE OPEN';
>> EXIT;
EOF
# 2  
Old 01-06-2008
Can you guys give me any suggestions
# 3  
Old 01-06-2008
Modify the script like this:

j.ksh

Code:
#! /path/to/your/shell -xv

exec >/tmp/output_$$.log 2>&1

# set the enviroment here
ORACLE_HOME= ...
ORACLE_SID= ...
PATH="$PATH:$ORACLE_HOME/bin"
export ORACLE_HOME ORACLE_SID PATH

rman target=/ <<EOF
SHUTDOWN IMMEDIATE
STARTUP MOUNT

ALLOCATE CHANNEL C1 DEVICE TYPE DISK
FORMAT '/U01/ORADATA/%U'
BACKUP DATABASE PLUS ARCHIVELOG;
SQL 'ALTER DATABASE OPEN';
>> EXIT;
EOF

exit

Post the content of /tmp/output_<pid>.log.
# 4  
Old 01-06-2008
Hi all experts,
Please explain the follwoing lines as i quoted below.
Quote:
Originally Posted by radoulov
Modify the script like this:

j.ksh

Code:
#! /path/to/your/shell -xv

exec >/tmp/output_$$.log 2>&1(What does it mean please explain)

# set the enviroment here
ORACLE_HOME= ...
ORACLE_SID= ...
PATH="$PATH:$ORACLE_HOME/bin"( Is it the path of oracle home?)
export ORACLE_HOME ORACLE_SID PATH( Do i have to specify Path for both
oracle_home and oracle_sid path)rman target=/ <<EOF
SHUTDOWN IMMEDIATE
STARTUP MOUNT

ALLOCATE CHANNEL C1 DEVICE TYPE DISK
FORMAT '/U01/ORADATA/%U'
BACKUP DATABASE PLUS ARCHIVELOG;
SQL 'ALTER DATABASE OPEN';
>> EXIT;
EOF

exit

Post the content of /tmp/output_<pid>.log.
# 5  
Old 01-06-2008
Is it arguments?

>/tmp/output_$$.log 2>&1
# 6  
Old 01-07-2008
Please help
# 7  
Old 01-07-2008
Test the job with the modified shell and post the output, please ...

As far as your request for explanation is concerned, there are many tutorials on Internet that describe/explain the
shell syntax.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Passing variables from UNIX to Ansible to UNIX shell

I m passing a variable stringg from Unix shell which has value 'Good Day' to ansible and from ansible to a second shell script where it print only Good instead of 'Good Day' passing the variable stringg from unix shell script1.sh echo $stringg ansible-playbook install.yml -i... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Shell Programming and Scripting

How can i run sql queries from UNIX shell script and retrieve data into text docs of UNIX?

Please share the doc asap as very urgently required. (1 Reply)
Discussion started by: 24ajay
1 Replies

3. UNIX for Dummies Questions & Answers

Unix Shell Scripting( Calling from Unix to PLSQL)

Hello Experts, I have the following questions to be discussed here at this esteemed discussion forum. I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies

4. Shell Programming and Scripting

FTP from windows to unix server using unix shell script

Hi, Is it possible to ftp a huge zip file from windows to unix server using unix shell scripting? If so what command i need to use. thanks in advance. (1 Reply)
Discussion started by: Shri123
1 Replies

5. Shell Programming and Scripting

Connecting to multiple unix server from unix server using shell script

Hi Gurus, I'm a unix newbie and I would like to connect to multiple unix servers from unix server using shell script i.e from server a to server b,c,d etc. I want to copy the files from unix server a to server b, c, d. I can access staright using ssh without the need to have password and user... (5 Replies)
Discussion started by: sexyTrojan
5 Replies

6. Shell Programming and Scripting

How to connect unix server to unix server through shell scripts

Hi, I would like to connect UNIX server to UNIX server through shell scripts and i have some concepts . But i am totally confused how to connect UNIX server to UNIX server throuth running a script. It will be greatful to me if any buddy will help me. with simple example please. Thanks in... (2 Replies)
Discussion started by: phatan
2 Replies

7. Shell Programming and Scripting

How to connect unix server to unix server through shell scripts

Hi, I would like to connect UNIX server to UNIX server through shell scripts and i have some concepts . But i am totally confused how to connect UNIX server to UNIX server throuth running a script. It will be greatful to me if any buddy will help me. Thanks in advance. Phatan:) (2 Replies)
Discussion started by: phatan
2 Replies

8. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

9. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

10. Shell Programming and Scripting

How to run unix commands in a new shell inside a shell script?

Hi , I am having one situation in which I need to run some simple unix commands after doing "chroot" command in a shell script. Which in turn creates a new shell. So scenario is that - I need to have one shell script which is ran as a part of crontab - in this shell script I need to do a... (2 Replies)
Discussion started by: hkapil
2 Replies
Login or Register to Ask a Question