running sql script and email it


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers running sql script and email it
# 1  
Old 07-07-2008
running sql script and email it

Hi All
I have this sql script lets say abc.sql
How to run this script with this following conditions :
1 - The script will run everyday and mailx to me by using crontab
2 - The output of this script will be saved to someplace and attach with mailx OR can be display as email text and then send to me
# 2  
Old 07-07-2008
Point 1:
You have to edit the crotab using crontab -e to add the entry like:
00 02 * * * sh /tmp/your_script.sh | /usr/bin/mailx "user@domain.com" -s "Subject here"
Point 2:
You can do like:
00 02 * * * sh /tmp/your_script.sh >out_log && uuencode out_log | /usr/bin/mailx "user@domain.com" -s "Subject here"
# 3  
Old 07-07-2008
Mail can be sent to ur mailbox by using .

/usr/bin/mailx -s " subject whatever" usermail id

check it out Smilie
# 4  
Old 07-07-2008
Hi
i managed to attached the file using this command :
uuencode /ek_bkup/alert/tbspace_datafile.log tbspace_datafile.log | mailx -r oraadm@juwpkl.gov.my -s\
"Oracle Tspace and Datafile Update" adzuan@nc.com.my

BUT after i download the file attached to my email, the tbspace_datafile.log is not being recognize. The file cant be read although i'm using context, wordpad or notepad...

Anybody can update this??
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies

2. Shell Programming and Scripting

Running Oracle SQL from shell script

Hi, can anyone help me with this script please. I need the oracle command to go into the unix batch file. #!/bin/sh # A menu driven Shell script which has following options # for acmtoron@> # # # Exit # As per option do the job #---- while : do clear echo " A C M LOG MONITORING... (0 Replies)
Discussion started by: tinaaguilera
0 Replies

3. Shell Programming and Scripting

We need a script that invokes the sql query every 14 days ans send email

HI, We need a script that invokes the sql query every 14 days ans send email (0 Replies)
Discussion started by: bujjisveeru
0 Replies

4. Shell Programming and Scripting

We need a script that invokes the sql query every 14 days ans send email

Hi, We need a script that invokes the sql query every 14 days ans send email (0 Replies)
Discussion started by: bujjisveeru
0 Replies

5. Shell Programming and Scripting

Running script that sends an html formatted email fails when its run as cronjob

Hi Im very new at working with unix and this problem I simply can not understand. I know there are a lot of threads about problems with shell scripts behaving differently when run from a terminal and from a cronjob. I have tried everything(almost) but I still havent cracked this problem. Im... (15 Replies)
Discussion started by: Nightowl
15 Replies

6. Shell Programming and Scripting

Running a shell script in cron...email not sending - help??

I am pretty new to Unix shell scripting, but wondered if anyone could help (in layman's terms if possible!!) :) I have a shell script which ultimately sends an alert to an email address if part of a batch of programs fails. Here's the script that sends the email: Script: 6check.csh... (8 Replies)
Discussion started by: tjhorwood
8 Replies

7. UNIX for Dummies Questions & Answers

problems running a sql loader script

Hi Folks, I have created a number of unix scripts that i can run from the scheduler on a server-side application that we use (Chordiant Marketing Director). All scripts are working except one. This last script is a user load script which first truncates a table and then loads it using a flat... (2 Replies)
Discussion started by: jibbadiah
2 Replies

8. Shell Programming and Scripting

Running SQL Scripts from Shell script - Need insight!

I've a script that fetches various values from the database as below: #! /bin/ksh $conn="user/pwd@service_name" `sqlplus -s << $conn EOF1 @xyz.sql @pqr.sql @abc.sql EOF1` The output of the script should generate txt files containing the results from queries which are further... (6 Replies)
Discussion started by: manthasirisha
6 Replies

9. Shell Programming and Scripting

Running remote shell script containing sql statements

I have a shell script which resides on three SCO machines containing some simple sqlplus statments. I need to run these scripts remotely. Currently, I am trying to use rsh to do so: rsh hostname myscript args The problem is that the arguments to the sqlplus statements in the remote shell... (4 Replies)
Discussion started by: Madbreaks
4 Replies

10. UNIX for Dummies Questions & Answers

running .sh, .sql .etc how to?

hi all yes, I am a beginner in Unix,-sun solorais--V8... what is the command to run files.... single and batch jobs....any help would be great... Cheers ps...i know running files in Sqlplus on Unix prompt, I can use the @' sign...but how does this work.. Cheers E (2 Replies)
Discussion started by: etravels
2 Replies
Login or Register to Ask a Question