Help regarding issue connecting to DB through shell script

Hi,
I have a Oracle 8.1.7 Database running on a AIX box. I am trying to truncate one table from within the shell script using here documents.
Code section of my script -
succ=`sqlplus -s ${USR} << EOF
whenever sqlerror exit sql.sqlcode
set feedback on
Truncate table abc.xyz;
exit;
EOF`
USR has been set as /. We have ops$ users in the database. So when I run this script using my id it runs fine. The problem seems to be coming when this runs as part of the batch job which runs under a different osuser. The error is -
+ + sqlplus -s /
+ 0< /tmp/sh164108.8
succ=ERROR:
ORA-01017: invalid username/password; logon denied
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
I am not sure what is going wrong. I have tried and googled for the issue and it seems that the issue is coming because the osuser under which the job runs may not be setup to use "sqlplus -s /" ? Any help appreciated.
Regards,
Saurabh

This is the forum for Oracle's SQL Developer tool, not for general SQL and PL/SQL questions.Questions like this will get a better response in the PL/SQL forum.
Having said that, it looks likely that the other user doesn't have an ops$ account.

Similar Messages

  • Reading contents of asm through shell script

    How to read contents of asm through shell script?
    Please paste one small example also.
    Thanks
    Bala

    Hello Bala,
    The ASM contents is not visible from the operating system or its utilities. Only visible to database instances, RMAN, and other Oracle-supplied tools.
    Please see http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/glossary.htm#sthref4105
    Regards,
    Rodrigo Mufalani
    http://mufalani.blogspot.com

  • How to execute sql-queries through shell scripting in linux?

    How to execute sql-queries through shell scripting in linux?

    http://www.oracle.com/technology/pub/articles/saternos_scripting.html
    Two simple examples:
    #!/usr/bin/env bash
    set_orafra () {
       orafra=`echo 'set heading off
       select name from v$recovery_file_dest;
       exit' | sqlplus -s / as sysdba`
    set_orafra
    echo $orafra
    #!/usr/bin/env bash
    export ORACLE_SID=instance_name
    export ORACLE_HOME=/path_to_oracle_home_directory
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export PATH=/$ORACLE_HOME/bin/$PATH
    $ORACLE_HOME/bin/sqlplus -s <<EOF
    connect scott/tiger@my_instance_name
    INSERT INTO table VALUES (sysdate);
    exit
    EOFEdited by: Markus Waldorf on Sep 17, 2010 12:19 AM

  • Creating user account and setting password in Solaris9 through shell script

    I need to create and set password of user through shell scripts.
    User can be added successfully through "useradd" command but password cant be set through "passwd" command in script.
    Is there any other alternative for the same.

    Hi,
    Did you get the answere for this ? I have the same problem as urs , like I want to creat the users by using useradd and want to hardcode there password in one script.
    But I cant use expect utility which would have made my work easier

  • Calling sql through shell script

    How do i call a sql file through shell script in unix ?

    Rahul India wrote:
    export ORACLE_HOME=$ORACLE_BASE/product/10g
    cd $ORACLE_HOME
    set `sqlplus -s <SCHEMA_NAME>/<SCHEMA_PASSWORD> <<EOF
    @r_100.sql
    exit;   
    EOF`THIS SCRIPT IS OK?You'll also need to set ORACLE_SID
    And I don't know why everyone is putting the reference to sqlplus inside a "set" valuation, nor why they are putting the reference to the script in a redirected input stream. All you need is
    sqlplus -s user/password  @r_100.sqlAnd to insure the invironment is correctly set:
    export ORACLE_SID=whatever
    export ORAENV_ASK=NO
    . oraenv
    unset ORAENV_ASK=NO
    sqlplus -s user/password  @r_100.sql

  • Random SP2 error when starting oracle process through SHELL script

    Hi All,
    I am trying to process data in n-Number of tables through a package. The package is called through a shell script to create start data processing. All calls to the package are in a sql script which is basically exec calls-
    exec package.process ('T1','some param');
    exec package.process ('T1','some param');
    exec package.process ('T..n','some param');
    I have a shell script which I use to execute commands from the sql script. There is a reason behind using shell script. For some strange reason, I keep on getting -
    ERROR: logon denied - check for valid user with valid privileges
    SP2-0640: Not connected
    SP2-0641: "EXECUTE" requires connection to server
    SP2-0640: Not connected
    for some EXEC calls. Problem is, errors are generated at random. So in one run, I get error for T10,T11 and then in next run I might get for some other tables.
    However, when I am running the sql script from the sql prompt, all calls to the package are executed without any problem.
    This makes me think, it is something to do with the way database connection being initiated through UNIX.
    Has anyone faced similar issue? Your help/gudence is much appreciated.
    DB: Oracle 10.2.0.5
    OS: SUN Solaris 10
    Thanks in advance.

    Login credentials are provided inside the shell script.
    I did put a sleep(10) after EOF but no help. As mentioned if I run script file from sql promt, it runs without any hiccup. So it is the connection through the UNIX that is causing issue.
    As pointed out by Sybrand, I agree that it does not make a sense to connect and commit after every sql statement. So decided to change the shell script and so far, the result from my initial tests on a sample data is quite encouraging. Hopefully I will have a solution.
    But it will be nice to know why SHELL is doing what it is doing!!
    Legacy prog are sometime big time eye-openers..;)

  • Import through Shell Scripts

    Hi Friends ,
         I have run shell scripts for importing from my local system through TELNET It was running fine on the server.But now I need to import the same dump file into my local database.The ORACLE_SID refering to the database in the server is same as the database in my local system.
    So how to tell through the scripts that I need to connect to my local system.
    If anyone could explain this it could be of great help.
    Regards
    Marlon.

    Hi
    It depends on how your script is taken care on syntax of import/export. I can tell you exaxtly if you can past me your import/export shell script. However for your knowlege, you can specify ORACLE_SID with export/import with following ways
    1) exp user/pass@ORACLE_SID file=<file_name> log=<logfile>
    imp user/password@ORACLE_SID file=<dumpfile> fromuser=<username> touser=username
    if you are at same box where oracle server is intalled then you need not to mention oracle_SID but make sure that ORACLES_SID is configured in environment variable.
    All the best
    Alok

  • Rel 12 - How to create a new APPS connection from custom Java/Shell Script

    Hi,
    I am looking to write a custom JAVA code / Shell Script which needs to establish a connection to execute a PL/SQL API on Rel 12 db.
    The challenge is to be able to connect without specifying APPS Password anywhere (just like Oracle Apps does it).
    This Shell script / Java code is not called from within Apps hence I need to establish a brand new connection along the lines of using ....
    WebAppsContext ctx = new WebAppsContext(System.getProperty("JTFDBCFILE"));
    OracleConnection conn = (OracleConnection)ctx.getJDBCConnection();
    like in 11i world or possibly using APPLSYSPUB username
    I need help / direction in how to do this in a Rel 12 env. I understnad there are lot of architecture changes and if someone can provide a generic code snipped it will be great.
    I need to keep this as closely aligned to Rel 12 coding and security standards as possible.
    This code will reside in $XXCUSTOM_TOP/bin file or under XXCUSTOM.oracle.apps.java....... if its Java.
    Pls help.
    Cheers
    -- VK.

    Hi,
    Have you looked at Oracle produced dbc file and its contents? That might help. It is under $FND_TOP/secure. It uses GWYUID=APPLSYSPUB/PUB. I am hoping that the APPS_JDBC_URL would help too.
    Regards,

  • Please help me remove the last elements of shell script from my applescript

    I read somewhere that running a shell script in an applescript was inefficient and created extra overhead, fine, so I am trying to take all of my shell script out of my applescript (this should fix issues with forward slashes in names as well...)
    however I am stuck on these last two lines (I know they are probably trivial but I've been up waaaay too long now) so I was wondering if anyone would be awesome enough to show me how to convert the bash to applescript.
    --does a recursive copy and rename
    do shell script "cp -R " & (thePath as text) & " " & (theOtherPathWithFile as text)
    --does a copy and rename, then a simple move
    do shell script "cp " & (quoted form of (POSIX path of this_item as text)) & " " & (theNewPath as text) & "&& mv " & (theOtherPathWithFile as text) & " ~/Desktop"
    Any and all help will be appreciated.

    There isn't anything wrong with using shell scripts, especially since AppleScript is designed to do this very thing. There is some overhead when using do shell script, just as there is some overhead when using an application tell statement, so it just depends on what you are doing.
    The performance of any particular script would also be up to whatever is acceptable to you (or your customers), and sometimes a shell script is the most efficient way to do something. Many of the system utilities are just GUI front-ends to a shell script, so they can't be all bad.
    To do your file copy or move with the Finder, you will need to tell it to duplicate or move the item(s) (there is that pesky overhead again). Shell scripts use POSIX paths while the Finder uses colons as its path delimiter, so you will need to use the correct file path references - there is a decent article about that at Satimage. Once your file paths have been defined (or using something like choose file or choose folder)), your script would be something like:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    tell application "Finder"
    duplicate source to destination
    -- move source to destination
    end tell
    </pre>
    See the Finder and *System Events* scripting dictionaries for more information about the ways they deal with files.

  • Calling sql script through shell script

    Hi All
    I am trying to run one shell script it will execute the sql file which is in UNIX box. Problem here i am facing is
    when i submit the program through front end it taking time to execute and the status in running even for hours and hours. Manually i am terminating the concurrent program.
    But when same shell script when i tried to execute in putty it generating the output with in seconds
    Can you help what may be the error? I used the syntax like this
    Can you help what may be the error? need to change any syntax
    Thanks
    Prem Raj Dasari
    Edited by: Sravprem on Sep 20, 2012 12:43 AM

    Pl post details of OS, database and EBS versions. In your shell script, insert this line as the first line
    set -xthen run the concurrent program and paste the contents of the log of the concurrent program here
    HTH
    Srini

  • How to Call Multiple Sessions through Shell scripting

    Dear Members,
    I have a scenario where I load data into target table from 20 different source tables.
    For this I have written three procedures where there exists an bulk insert executed on a same table in every procedure. Now I have to call these procedures simultaneously so that
    all three bulk loads are executed at once in different sessions.
    For this I have to write a shell script which opens 3 different sessions and execute all these packages at once.
    Can you guide me through.

    When you call sqlplus in your shell script, put a & at the end so that it runs the SQL scripts in the background. For instance:
    #!/bin/bash
    ...oracle home stuff
    $ORACLE_HOME/bin/sqlplus user/pass @script.sql &
    $ORACLE_HOME/bin/sqlplus user/pass @script2.sql &
    $ORACLE_HOME/bin/sqlplus user/pass @script3.sql &

  • Arguments in function passed through shell script

    HI all,
    I have a shell script test.sh
    it contains the following
    A=$1
    B=$2
    C=$3
    D=$4
    sqlplus usr/pwd<<eof
    a varchar2(10);
    b varchar2(10);
    c date;
    d date;
    a:='$A';
    b:='$B';
    c:='$C';
    d:='$D';
    func(a,b,c,d(;
    eof
    func() defbn
    func(name varchar2,trc varchar2,dt1 date,dt2 date)
    end;
    When icall test.sh as
    ./test.sh xyz 0100 01-NOV-09 06-NOV-09
    It appneds dt1 with 06-NOV-09 and dt2 remains null.
    It should be like:
    dt1=01-NOV-09
    dt2=06-NOV-09
    inside function
    Thanks

    Are you sure there is no problem in SQL function *"func"* that you are calling?
    You haven't pasted the function code so can't really comment on that.
    Below test shows that it works really fine:
    kallo:DZHLHFC1> cat 1.ksh
    A=$1
    B=$2
    C=$3
    D=$4
    echo "Shell vars = $A,$B,$C,$D"
    sqlplus -s username/pass<<eof
    alter session set nls_date_format='DD-MON-YY';
    set serverout on size 10000
    declare
    a varchar2(10);
    b varchar2(10);
    c date;
    d date;
    begin
    a:='$A';
    b:='$B';
    c:='$C';
    d:='$D';
    dbms_output.put_line('');
    dbms_output.put_line('SQL vars =' ||a||',' ||b||',' ||c||',' ||d);
    end;
    eof
    kallo:DZHLHFC1> ./1.ksh xyz 0100 01-NOV-09 06-NOV-09
    Shell vars = xyz,0100,01-NOV-09,06-NOV-09
    Session altered.
    SQL vars =xyz,0100,01-NOV-09,06-NOV-09
    PL/SQL procedure successfully completed.

  • [Help] Regarding database connection!

    Hi , i am new to dreamweaver, I have started working on a website, the designing part is completed. I am now trying to connect database through dreamweaver to mysql. As i said I am new to this, I have created four pages, all of which are in .html format. When i  try to connect to a database, it needs me o choose from .php or dotnet.
    So, here is my question do I need to shift my work to dotnet or php? As i dont know php so i am taking dotnet
    2ndly how can I connect to a database? All schemas are defined! Which files do i need to change if i want a registration page to connect to database??
    Please Help!

    If you want to connect your website to a database, it's advisable to change the filename extension of all pages from .html to the server-side technology of your choice. Before making your choice, you might find the following article helpful: Which server-side technology should I choose?
    If you decide on .NET, you should be aware that Dreamweaver has no support for it.
    Dreamweaver has extensive support for PHP, but I wouldn't recommend using Dreamweaver's built-in server behaviors to connect to a database. They rely on outdated code, and are not recommended for use in a live website.
    If you want to set up Dreamweaver to work with PHP, instructions for doing so are in the following article: http://www.adobe.com/devnet/dreamweaver/articles/setup_php.html.

  • Regarding issues connecting to EJB 2 from OSB

    Hi,
    I am trying to connect from OSB 11g to EJB 2 which is deployed on weblogic 7.1.
    I am getting this error.
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
    <soapenv:Fault>
    <faultcode>soapenv:Server</faultcode>
    <faultstring>BEA-380002: Error accessing the JNDI context for the EJB call: java.net.ConnectException: Bootstrap to failed. It is likely that the remote side declared peer gone on this JVM</faultstring>
    <detail>
    <con:fault xmlns:con="http://www.bea.com/wli/sb/context">
    <con:errorCode>BEA-380002</con:errorCode>
    <con:reason>Error accessing the JNDI context for the EJB call: java.net.ConnectException:: Bootstrap to failed. It is likely that the remote side declared peer gone on this JVM</con:reason>
    <con:location>
    <con:node>GTX</con:node>
    <con:path>request-pipeline</con:path>
    </con:location>
    </con:fault>
    </detail>
    </soapenv:Fault>
    </soapenv:Body>
    </soapenv:Envelope>
    Can any one please help me in resolving this issue.
    Thanks,

    Hi,
    Thank you for posting in Windows Server Forum.
    As per your comment, they have Remote Desktop client v5.2 and I suspect that due to this reason they can’t connect the remote session as the version if very old. We need to use latest RDP version to connect successfully. Also please check the certificate which
    is used by server, please check below article for information. 
    Remote Desktop disconnected or can’t connect to remote computer or to Remote Desktop server (Terminal Server) that is running Windows Server 2008 R2
    http://support.microsoft.com/default.aspx?scid=kb;en-US;2477176
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    TechNet Community Support

  • Need help regarding Issues while use T=0/T=1 Protocol

    Hi Friends..
    I developed an Simple Applet to be Personalized by Datacard Machine..
    This Applet is downloaded and installed in 2 difference protocol, (T=0 and T=1)..
    This is a little description of my Applet :
    CLA used is (byte) 0x80, otherwise SW 6E00 returned
    INS (byte) 0x20 : is used for Ingoing Command (To Send Data to Applet)
    INS (byte) 0x30 : is used for Outgoing Command (To Get Data From Applet)
    P1 = (byte) 0x00 : is used to Send Data and Get Data for field Employee code
    Case T=0 :*
    I tried to send this APDU through Datacard Machine :
    80 20 00 00 05 01 02 03 04 05 00
    the SW resulted is 90 00
    After that i tried to send this APDU through Datacard Machine :
    80 30 00 00 00
    There's no Response Data, and the SW resulted is 61 08
    But, if i try to Get Data using SmartCardIO, i can get Data as i want, and the SW is 90 00
    What is the meaning of SW 61 08?
    I think this SW tells me that there's 8 bytes remaining data (but i don't know whether this is correct)..
    But in the Case T=1 Protocol :*
    I did the same thing, and there's no error returned..
    i can Read an Write without any error..
    Please correct me if i'm wrong..
    Any help would be appreciated..
    Thanks
    Edited by: Leonardo Carreira on Oct 27, 2010 7:49 PM
    Edited by: Leonardo Carreira on Oct 28, 2010 6:22 PM
    Change the title

    Leonardo Carreira wrote:
    After that i tried to send this APDU through Datacard Machine :
    80 30 00 00 00
    There's no Response Data, and the SW resulted is 61 08
    But, if i try to Get Data using SmartCardIO, i can get Data as i want, and the SW is 90 00 The datacard machine may not handle the GET RESPONSE apdu for you. SmartcardIO does this transparently.
    What is the meaning of SW 61 08?SW '61XX' = SW2 encodes the number of data bytes still available. This is because you are using T=0.
    I think this SW tells me that there's 8 bytes remaining data (but i don't know whether this is correct)..That is correct
    But in the Case T=1 Protocol :*
    I did the same thing, and there's no error returned..
    i can Read an Write without any error..This is due to the differences between T=0 and T=1 protocols. T=1 will send you a response containing the data, T=0 will send you the numbder of bytes it expects to return and waits for a GET RESPONSE before sending you the data. As mentioned above, SmartcardIO handles this for you transparently while other libraries mat not (RAW PC/SC does not). You can read more about this in ISO7816-3
    Cheers,
    Shane

Maybe you are looking for

  • Valuation grouping code in fi-mm integration

    hi, i have doubt in valuation grouping code, as for as my knowledge one type of raw material used by number of company codes (if same chart of accounts) for above all company codes used same raw material assaign to one variable (for ex "x" ) this var

  • Syntax for insert query

    I want to insert like insert into families(id, name) values(1,'Ram's car'); but due to 's in Ram's car error is occurring. Plz suggest any solution.....

  • Could not create SSL/TLS secure channel.

    I have an application thats uses a third party service (so i have no control over it). In order to authenticate i have a pfx cert with a private key. I click the URL to access the service and IE tells me the page is not found. I import the pfx cert u

  • Editing a Modified Applet

    Hi all! I have modified an Applet using the HTML converter and have then tried to add a javascript function to the HTML code. However, when I try and load the applet in the web browser, I get an error message stating that the program has performed an

  • Making PDF Files Viewable In Other Languages

    I have a fairly large PDF file, about 150 pages written in English that I'l like to make available in Spanish, Italian, German, etc.  Is there an easy way to do this? Thanks!