I have the following 2 sql statements
Now, here are the challenge's
1. I need to create a shell wrapper so that the above two sql create table commands run successfully by connecting to the correct database.
2. Run this everyday at 11 PM so that the next day this is done.
Any and all help is sincerely appreciated !
Thanks,
Lee
Last edited by Scott; 11-15-2010 at 07:46 PM..
Reason: Code tags
You might want to throw in a "drop table" somewhere before the "create table"
Assuming Oracle:
In your script source your .profile, set ORAENV_ASK to NO, set your ORACLE_SID to that of the database you're planning to connect, and then source "oraenv".
As for the "11 PM" part, set up a cronjob.
Last edited by Scott; 11-15-2010 at 08:27 PM..
Reason: Changed 11 to 23 on cronjob -- oops :)
Thanks a bunch on your responses and Im thankful for those.
Scottn, You are right in that this is oracle that we are talkin about bu you lost me there on the following and Im not sure as what you mean here.
In your script source your .profile, set ORAENV_ASK to NO, set your ORACLE_SID to that of the database you're planning to connect, and then source "oraenv".
I mean that when you run something from cron your environment is not set up as when you normally "log in".
You need to "set it up" yourself.
Sourcing (loading) your .profile is normally a good place to start
If that doesn't give you all you need, then:
(or wherever your Oracle software "lives")
If you want to use SQL*Plus, then you need to set your Oracle environment. oraenv does this for you:
or:
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)
Hello,
I'm attempting to open multiple xterms and run a command as an SAP user via sudo using PSSH. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in to the servers in the file list, and SUDO to the SAP(ADM) user, but it won't do anything else... (11 Replies)
Dear All,
I am trying to write a Unix Script which fires a sql query. The output of the sql query gives multiple rows. Each row should be saved in a separate Unix File.
The number of rows of sql output can be variable. I am able save all the rows in one file but in separate files.
Any... (14 Replies)
Hi,
I have a directory /home/datasets/ which contains a bunch (720) of subdirectories called hour_1/ hour_2/ etc..etc.. in each of these there is a single text file called (hour_1.txt in hour_1/ , hour_2.txt for hour_2/ etc..etc..) and i would like to do some text processing in them.
Each of... (20 Replies)
Hi!
I would like to do a single connection to sqlplus and execute some querys.
Actually I do for every query one connection to database
i.e
echo 'select STATUS from v$instance;
exit' > $SQL_FILE
sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT
echo 'select VERSION from v$instance;... (6 Replies)
Hi ,
Daily I sneding report to client about the status of State 2 jobs in Control M .
I would like to schedule it via cron . I am using teh following command :
sudo su - <control M server Name>
then reach to the control M server
then run
#isql
<It ask for the password >
... (1 Reply)
Hi gurus,
Being a newbie not sure whether iam asking the right question?
can we use oracle commands in unix for ex: to read a count on a table.
if so, what needs to be configured and etc..
any kind of help is appreciated.
Thanks
sish (6 Replies)