Unix Script for calling oracle packges.
Hi All,
I would like to know how to call packages(pro,fun) with parametrs from unix script.
Can anybody provide me the sample code.
thanks in advance.
Dinesh
This topic has been covered a few times in the past.
Here are two threads that a quick search found:
Execute stored procedure from script
how to call shell script from pl/sql procedure.
There are several other threads that may be of interest.
HTH -- Mark D Powell --
Similar Messages
-
Dynamic Scripting for Call Center Surveys
Hi All,
I need to create dynamic scripting for Call Centres. Any idea how dynamic scripting can be done.
Thanks a lot.
AmigaHi Raja,
Basically, there should be a provision to create/modify a transaction and questions based on the response provided. So if a question is asked in a survey and the response is "Yes", the next question should be different to the one for a "No" answer. Similarly there should be a provision to create actions based on responses.
Hope this makes it a bit clearer.
Thanks
Amiga -
Calling Unix-Script from within Oracle and store stdout/stderr in table
Hi,
What I want to do is:
1. Calling a UNIX script (e.g. hello.sh) (from inside the Database)
hello.sh
echo Hello World!
2. and get the stdout/stderr output back in my Database in a table (e.g. temp_back)
table temp_back
ID stdout stderr
1 Hello World!
I think Number 1 isnt a big problem, but how to get stdout back in DB?
Any solution?
I searched a bit in this Forum and found this Post.
re:Calling Host Command Through Database Procedures or Triggers
This may be what I am searching for, but cant access the Link
Since I am not really fit with UNIX and packages/procedures in Oracle it would be nice if you could post a very detailed answer.
(Please no java)
-What packages do I need? (heard DBMS_OUTPUT would be useful)
-example PL/SQL script
Thanks a lot!
Marcus
Environment:
Oracle 9.2.0 DBMarcus, if you opened the Java sandbox to access any o/s file, you can call any Unix command, shell script, or program, that the Oracle o/s user has exec privs on.
Just remember that there's a very basic Unix environment when you make the call - the settings in the .profile does not apply. Thus PATH for example is not set. When making the call make sure that the complete path is given. As for the environment, that is a problem as you cannot set that and make the call at the same time.
In that case it is much simpler to rather write a Unix shell script that does all for you. Set the environment. Run the command(s). Format output. Etc.
Then you call that Unix script, via Java, from SQL or PL/SQL. Treat the Unix scripts like the Unix-version of stored procedures for your Oracle application.
Some technical details. When you connect to Oracle, a Unix process services you. This can be either a dedicated server process (servicing only your Oracle session) or a shared server process (from the shared service pool of processes).
In either case, it is a Unix process running as a background process (thus detached from any tty device). PL/SQL and SQL are executed by this process. The Oracle JVM created by your session also lives in this process. When you therefore make o/s calls, these calls are made by this process.
Therefore you are limited to what this process can and can't do. E.g. it runs as the oracle o/s user and will fail on accessing paths and commands does the oracle user does not have privs on. Etc. -
Unix script for checking the user account status
Hi All,
i have created one unix script to check the status of the user in diff databases.
#!/bin/ksh
useracctreport.txt if [ ! -f hh ];
then
echo "Database file does not exist"
fi
echo "Enter Username"
read USER
echo "Enter the password"
stty -echo
read PASS
stty echo
for j in `cat users`
do
j="`echo $j| tr '[a-z]' '[A-Z]'`"
for i in `cat hh`
do
sqlplus -s $USER/$PASS\@$i <<EOF >> useracctreport.txt
column USERNAME format a8
column ACCOUNT_STATUS format a5
!echo "*****User $j Status in $i DB*****"
select USERNAME,ACCOUNT_STATUS from dba_users where username=('$j');
select OBJECT_TYPE,count(*) from dba_objects where owner='$j' group by object_type;
EOF
done
done
In log file ,i get the below error when its unable to connect to the DB.
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
where <logon> ::= <username>[<password>][@<connect_string>] | /
SP2-0306: Invalid option.
Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
where <logon> ::= <username>[<password>][@<connect_string>] | /
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
ERROR:
ORA-01017: invalid username/password; logon denied
Is there any way i can supress this error?
and is there any other way i can make this script faster.Thanks a lot for your helpHi,
The failing line is
sqlplus -s $USER/$PASS\@$i <<EOF >> useracctreport.txtYou should test the connect statement you provide to sqlplus. For example:
CONSTRING=$USER/$PASS\@$i
echo Connect string used: $CONSTRING
sqlplus -s $CONSTRING <<EOF >> useracctreport.txtCheck the echoed value. It's malformed. Correct it appropriately.
Yoann. -
Automated Unix Script For Registering Artifacts In OER
Hi,
i want to create automated unix script which will register the artifacts automatically in Oracle Enterprise Repository (OER)
is it possible to automatically harvest the artifacts in OER.
please help
regards,
yshintreSome of what you want is possible. Take a look at the Count Tool in CS3/4. It may only be available in the Extended versions. That provides a
reasonable interface for marking items in a image like you are wanting to do with cells. Take a look at that and see what kind of manual process
you can get worked out.
However, to get the workflow you want (or anything close to it) would require more than a little code. -
Error message for calling oracle support
Hi,
We are getting the following error codes:
ORA-27302
Ora-27303
Ora-2000
ora-1013
can anyone please help out.The error message is for contacting Oracle support
Thanks a heap
regards,
vinayakVery limited info has been given.
Be more cleared. Like hwat is your Oracle version, what is your OS and its version?
Have you applied any new patches recently?
When does this problem started?
Is this problem coming when querying anything or while database startup?
Also, check your alert.log and paste the complete error message.
Jaffar
Message was edited by:
The Human Fly -
Help needed in Unix script for oracle 9i
Hi gurus,
I'm working on oracle 9i in solaris, i would like to calculate the amount of archived logs generate per day. Can anyone please help me to find that.
ThanksPut the following lines in a script and it should work for you.
SET feedback off
SET line 200
COL NAME FOR a100
-- counts the no of archives generated today
select count(*) "No. of Logs for today" from v$archived_log where to_char(completion_time,'DD-MON-YY')=to_char(sysdate,'DD-MON-YY');
-- lists all archive generated for the day
select name,blocks*block_size as "Size in KB" from v$archived_log
where to_char(completion_time,'DD-MON-YY')=to_char(sysdate,'DD-MON-YY');
-- shows total size in KB
select sum(blocks*block_size) "Total Log Size for day in KB" from v$archived_log
where to_char(completion_time,'DD-MON-YY')=to_char(sysdate,'DD-MON-YY');
Hope this helps.
Thanks
Siba -
Need Info Regarding Unix Scripts for DBA's
Hi,
I'm a oracle DBA with little knowledge of Unix.
I wanted to write some shell scripts which will be helpful for DBA's regular activity.
As i'm a new to oracle with unix can any plese tell me what are all the activities can be done throgh Unix Shell Scripts also suggest me how to learn unix shell scripts quickly.
Thanks in Advance
GobinathanMaybe it is about time you leave your ideal world, and take a reality check.
You don't take into account, I would say all over the globe, with the likely exception of the University of Washington, companies unwilling to upgrade to a supported version of Oracle. Then there are companies who can't upgrade to a supported version of Oracle, as the third party sw doesn't support a supported version of Oracle.
Then there are companies who are unwilling to pay for OEM and/or database control.
My company can't afford to use OEM to manage all our customers.
Daniel, I think I know your answers. They are, and always have been highly unrealistic. You need to leave your paradise, and stop making people frustrated, because they have to stick with the (you so often use that word) paleolithic version of Oracle that has been presented to them.
They simply have no choice.
In the Netherlands 50 percent of the customers use 10g, 25 percent 8i and 25 percent 9i. You can climb your hobbyhorse every day, many of them won't upgrade, simply because management doesn't want to upgrade, as it doesn't buy them anything, apart from support, which is considered unimportant, as the application 'works'.
Apart from that, your assertion scripts aren't portable across platform is not necessarily true when you start using Perl (comes with Oracle).
There are many tasks for which shell scripts are still mandatory.
In fact Rman is one of them. As Rman doesn't support variables, you can't use OEM to set up a script which uses a proper tag in the backup command.
You need scripting to reset an alert.
You need scripting to rotate the log file of a listener.
Etc, etc, etc.
Sybrand Bakker
Senior Oracle DBA -
Query or script for calls with federated users
Hi all,
Is there a query or script that can be run in SQL or Lync that gives us a report on calls between our Lync users and federated users?Hi,
There is not native report to achieve this.
If you want to write a query, the following table is helpful to you:
http://technet.microsoft.com/en-us/library/gg398589.aspx
http://technet.microsoft.com/en-us/library/gg412791.aspx
http://technet.microsoft.com/en-us/library/gg412950.aspx
Best Regards,
Lisa Zheng
Lisa Zheng
TechNet Community Support -
Shell script for calling an sql file
Hello, I would need your help in creating a ksh file. We have two ksh files. One for deletion the eim table and the other one is for running the eim job.
Ksh file for running the eim job is okay. But the ksh file running the delete sql is not. We were thinking that we may have some sort of mistake in the syntax could have caused the problem we experiencing now. Need your expertise to check it. Please?
Here’s the syntax we have.
#!/bin/sh
sqlplus -s <user>/<pwd>@dbname << EOF
@<folder-path>/sqlrun.sql
EXIT
ENDSQL
EXIT
When we run it against putty, nothing seems to happen as in no error message appears at all. It prove that the sql file did not execute in TOAD.
We tried the other way around, by putting the /dev/nu// as show below.
sqlplus -s <user>/<password>@DBNAME > /dev/null <<ENDOFSQL
still nothing happen.
Regardsuser10070712 wrote:
Hello, I would need your help in creating a ksh file. We have two ksh files. One for deletion the eim table and the other one is for running the eim job.
Ksh file for running the eim job is okay. But the ksh file running the delete sql is not. We were thinking that we may have some sort of mistake in the syntax could have caused the problem we experiencing now. Need your expertise to check it. Please?What does this have to do with APEX, which is the topic of this forum?
What is "eim"? Why have you chosen to post this here? -
Calling unix script using oracle forms
we have to call unix script using oracle forms , a trigger in form calls stored procedure on database
that stored procedure on database calls a oracle shared library
but since the only listener account for oracle on our unix server is oralist , whenever a call is made to the unix script from the oracle form , the unix script is executed by oralist user
but issue that we are having now is since oralist is specific for listening connections from orale we dont want to use this user to establish SFTP on it to avoid any issues with oralist
we want the sftp to be established on soem other useraccount , so is it possible to do something so that the script is executed by an account other that oralist.I'm not a Linux/Unix specialist, but I think this may work: let your database call a shell script that does a su command before running the actual script:
su - other_account
your_script.sh -
Hide oracle password on Unix command line call?
Does anyone know whether you can hide the password for a command line call to rwrun60 under Unix? For other Oracle products like sqlplus you can hide the password by supplying it using the redirection operator. i.e. sqlplus userid @script <<EOD and then put the password or password@sid on the next line and then EOD on the 3rd line to end the redirection. This virtually hides the password from anyone able to look at processes on the system. Can this also be done for rwrun60? If you just put the userid after userid= will reports prompt you for a password?
Take a look at http://java.sun.com/features/2002/09/pword_mask.html.
Hope this helps, -
Need Help in creating Unix Shell Script for database
Would be appreciable if some one can help in creating unix shell script for the Oracle DB 10,11g.
Here is the condition which i want to implement.
1. Create shell script to create the database with 10GB TB SPACE and 3 groups of redo log file(Each 300MB).
2. Increase size of redolog file.
3. Load sample schema.
4. dump the schema.
5. Create empty db (Script should check if db already exists and drop it in this case).
6. Create backup using rman.
7. restore backup which you have backed up.This isn't much of a "code-sharing" site but a "knowledge-sharing" site. Code posted me may be from a questioner who has a problem / issue / error with his code. But we don't generally see people writing entire scripts as responses to such questions as yours. There may be other sites where you can get coding done "for free".
What you could do is to write some of the code and test it and, if and when it fails / errors, post it for members to make suggestions.
But the expectation here is for you to write your own code.
Hemant K Chitale -
Hi all,
I'm having unix scripts for file validation.How and where to call this Unix scripts in ODI?Please be in steps.
Advance thanks
SureshHi Suresh,
Its very straight forward in ODI.
For your package, click Tools, under Utilities you will find, OSCommand, type the exact path of your script file and make sure your agent should have all access rights to invoke the script.
http://img19.imageshack.us/img19/5584/screenshot030z.jpg
Thanks,
G -
Test Scripts for Oracle Account Recievable app using QTP tool
Hi
Please send me some QTP sample Script for testing Oracle AR application
ThanksYou will need to create separate scripts for Load testing. The functional scripts cannot be used in OLT. The exceptions to this would be the "General" items (Java Code Script & Web Services) which can also be used in OLT.
e.g. Instead of selecting "Functional Testing - Oracle EBS/Forms"
select "Load Testing (Protocol Automation) - Oracle EBS/Forms"
Once you get into load testing you'll realise that you want to create very specific scripts and won't want to try re-using functional scripts. I know a lot of such tools are 'sold' on the fact that functional scripts can be re-used for load, but when it comes down to it you'll want to design your load scripts seperately anyway!
Maybe you are looking for
-
Can I add my own methods to a transformation?
I need to fill an internal table with content from a DSO before the transformation starts. Since data is loaded in parallell in several packages I have declared the table as a static (class-data). The loading and sorting of the itab takes some minute
-
Aperture 3 tethered with Nikon D300 trouble
I've been having trouble shooting tethered with Aperture 3 and the Nikon D300. It works for a few shots then it jams with the spinning wheel until i have to force quit. Also the inspector column gets messed up with type over type. I'm assuming apple
-
How do you save a movie as in imovie10 and save it as high definition
I don't see any save as tab. It looks as if the only way I can save a project is to use the share tab and share in a file but there's no options that let you save it as a HD video. In 9 there were various formats you could use that would save your vi
-
Recover database when losing all the controlfile
I read theBackup and Recovery Advanced User's Guide of 10g R2. I can't quit understand a scene in Restore Control File from Backup After Loss of All Current Control Files Table 18–1 Scenarios When Control Files Are Lost When the status of onlin log i
-
Organizer name comes in the Recipients list in outlook form region
Hi, I have created a custom form region for a meeting in outlook 2010 and VSTO with the message class IPM.Appointment.MyCompanyName. 1) When we either create a new meeting based on that form region or open the existing meeting created based on that f