Solaris : 10 .
I have 3 database in single file system i.e. /d01 . whenever I connect to oracle user using the below method
It will prompt for which database environment you want to set(PROD,TEST,UAT) :
whichever i need i will enter required DATABASE and perform my task.
I have an requirement to update one table in the PROD database i create one script for that DATABASE and want to schedule in crontab and execute it every 10 minutes . but when I am executing that script it is asking for which database u want to connect ??
any help how to write PROD in my shell script So that he should not prompt for which DATABASE and finish my sql query task.
*********AccUnlock.sh********
*********************************
Last edited by Scott; 09-19-2011 at 11:26 AM..
Reason: Use code tags, pelase...
Yes, you'll need to connect as someone after connecting with "/ as sysdba" - assuming that the table being updated doesn't belong to the sys user, although I suppose as the sys user you can update pretty much anything you like. Nice and dangerous, like root!. Perhaps using "/nolog" instead of "/ as sysdba", then "connect" is what you need?
If su - oracle is prompting you for a database name (after, of course prompting you for Oracle's password), then it's coming from the Oracle .profile (or something called from it upon login) - either from "oraenv" or other hand-written code.
If the cronjob should run as Oracle, then simply don't source the .profile in the script, and it will likely not ask which DB to connect to when it's run.
You need to correct the script, though as it is missing some bits.
I also prefer using "oraenv" when setting the Oracle environment, than trying to do it manually:
If the job should run as someone other than Oracle, then "su - oracle" won't cut it, and you should look at using sudo.
:wall: Hi,
I have an XML file with 5 tags. I need to pass values to the XML file from a shell script that will replace values in 2 of the tags. I cannot hardcode the tag values in XML and use replace command in script as the values are likely to change.
Please help !!!!!!!!!!! (2 Replies)
Hi,
I need a shell script, which would search the result values from another files.
1)execute " select column1 from table_name" query on the table.
2)Based on the result, need to be grep from .wft files.
could please explain about this.Below is the way i am using.
#!/bin/sh... (4 Replies)
I am writing a script where I need awk to test if two columns are the same and shell to do something if they are or are not.
Here is the code I'm working with:
@ test = 0
...
test = `awk '{if($1!=$2) print 1; else print 0}' time_test.tmp`
#time_test.tmp holds two values separated by a space... (3 Replies)
Greetings all,
If I have a SH script that calls a PERL script in the following way:
perl $HOME/scripts/config.properties
And in the config.properties PERL file, this Perl script only sets a number of environmental parameters in the following way:
#!/usr/bin/perl
$VAR1 = (
... (3 Replies)
Hi there,
I have a wapper script which passes the argument from command prompt to inner script.. It works fine as long as the argument containing single word. But when value contains multiple word with space, not working as expected. I tried my best, couldn't find the reason. Gurus, pls.... (2 Replies)
Hi,
When I invoke a script s1.sh it will call an another script s2.sh by itself. This script s2.sh will call some java files, so while running the script it asks for a file name to be processed. Which we can see in the screen.
The file name to be processed is present in script s1.sh
Now I... (2 Replies)
Hi,
When I invoke a script s1.sh it will call an another script s2.sh by itself. This script s2.sh will call some java files, so while running the script it asks for a file name to be processed. Which we can see in the screen.
The file name to be processed is present in script s1.sh
Now... (1 Reply)
Hi guyz,
Posting a thread after a long time.
I want to pass two variables to unix shell script from sql script.
Note: I am calling sql script from unix script. sql script has 2 variables one is the return code for status of program run and second one email flag. I don't know how to capture... (3 Replies)
Hi all
I want to know how to pass value from one shell script to another
suppose i have script named A.This 'A.sh' calls 'B.sh' .Now some calculations
are done by B.sh ..Say in variable X.
Now i want to pass the value of this X variable to 'A.sh'...
A.sh ----> B.sh ( X variable )
... (6 Replies)
I am having a shell script which has to be called from a C program. I have to pass two parameters to this script. HOw can I do that?
eg:
int main()
{
char st1;
char str2;
// call a shell script
call_sh(str1,str2) where call_sh is the name of the shell script.
then i need to get the return... (5 Replies)