How to connect to remote Oracle through shell script server.

Hi, I'm new to Shell scripting. I try to connect to remote oracle system, but I think Sqlplus not found error. I have sqlplus executable inside bin under oracle home, but still, I get the same error. can someone guide me to get this thing done.

export ORACLE_HOME=/opt/oracle/oracle11g/product/11.2.0
export NLS_LANG = American_America.US7ASCII
export LD_LIBRARY_PATH = $ORACLE_HOME/lib: $LD_LIBRARY_PATH
Export ORACLE_PATH = $ORACLE_HOME/bin
export PATH = $ORACLE_HOME/bin: $PATH

sqlplus-s/nolog < < EOF
connect wcadmin / [email protected]:1521 / wctest98
Select * twice;
output
EXPRESSIONS OF FOLKLORE

Please describe in more detail what you are doing. You run scripts 2 or is it in a script? If you set the variables of Oracle in a separate script, you need to run the script.

Source to run a script, the commands in the script are executed as if you type to the current command prompt. A script that is not executed source will lose the variables that you define in the script when the script stops. You can source run a script using the '. '. " script" or "source" (bash). The export command adds variables to the environment of the executed orders later.

See the following examples:

cat > shelltest <
Test1:
$ a=a
$ ./shelltest

$ echo $a
a

Test2:
$ export a=a
$ ./shelltest
a
$ echo $a
a

Test3:
$ . ./shelltest
a
$ echo $a
b

Tags: Database

Similar Questions

  • How to connect to remote oracle (10g and 11g) db Unix and window

    Hi all
    Hopefully an easy one.

    I have two Linux RH configured oracle databases.
    I use spfiles not ora.init files
    I want to maintain the cleanliness of my db and so restrict access remote ones with nicknames known so that if something goes wrong, I can follow who/what/how the newspaper.

    I want to enable users to connect both via call remote sqlplus to Unix and Windows.

    Users must be able to emit a sqlplus user/pwd@host command and be taken to a connection on the server.

    Q is:
    Do I need on my server of the client/Oracle/Oraclelite/or access point what?

    Q2. Should what command I similar to what I mentioned above?

    Q3. Should I tnsnames.ora on each host in the customer?

    Any help would be good on this.

    Hi user633084!

    the minimum requirement is that you have installed Oracle Clienttools about all your customers. After that, you need to configure a tnsnames.ora on each client with the descriptors for each DB connection. The command to connect to the DB from the client is sqlplus username/password@sid.

    hope that helps

    your sincerely

  • Database remote stop using shell script

    Hi all

    I need to close a remote database through shell script. I won't know SYS password and so cannot connect directly.
    I need to SSH to the remote database will define ORACLE_SID and then stop the database.

    Note Please I want to achieve this without calling any other SQL or shell script I have ssh.

    Pointers or help is much appreciated.

    Kind regards
    Nagendra Chillale

    Hi Nagendra,

    following works for me...

    SSH otherhost ".» \$home/.bash_profile
    export ORACLE_SID = MYSID
    echo \"shutdown abort\ | sqlplus------' / as sysdba\.
    "

    SSH otherhost ".» \$home/.bash_profile
    export ORACLE_SID = MYSID
    sqlplus------' / as sysdba\.<>
    startup
    EXPRESSIONS OF FOLKLORE
    "

    HTH Mathias

    Published by: mzarick on August 13, 2009 11:27

  • sqlplus to connect to remote oracle database server

    Hello

    I have the server database oracle 10g on solaris 10 and I usually connect using my account to solaris and run sqlplus on the server itself. This works!

    I downloaded and installed the client instant oracle for solaris 64 and I can launch sqlplus command but I'm confused on what should be the syntax of the command to connect to remote oracle and solaris 10 database server where I have the system account.

    I tried sqlplus help but still I could not correct syntax that may be used to authenticate to the oracle server.

    I tried

    sqlplus user@hostname:1512/SID

    then he asked for password, but when I typed the password and you press on enter, it gave some error

    but he still asked as username so I type user@SID and then prompt password - typed password and it works!

    so I do not understand what should be the correct syntax for that in the first attempt, I'm able to connect.

    If possible, please give the exact command with realworld examples, (I tried with sqlplus - help already)

    Thanks in advance.

    wonder what if I didn't tnsnames.ora on the client machine, how will be the syntax?

    You generally need (or at least strongly want) a file tnsnames.ora on the client machine.

    -You could configure Oracle Internet Directory and allow this product provide TNS alias resolution for the Organization (similar to the DNS configuration for a LAN).
    -Many tools (I have not personally tried SQL * more and it can be dependent on version) allow you to specify the whole TNS alias in the tnsnames.ora file (i.e. everything that follows the abcd.domain.com = entry) but which is extremely heavy for type
    -According to the version of the Oracle file sqlnet.ora, the complexity of your configuration client (that is, if you try to use the more advanced features such as failover), you may be able to use the syntax EZConnect

    sqlplus username/password@host:port:SID/service_name
    

    Where host is the server that the database is running, the port is the port the listener (i.e. 1521 default) listening and SID/service_name is the SID or service name, you are trying to connect to.

    Justin

  • Error connecting to DB2 Oracle, through database links

    Hello
    I'm working on an application of VB in which I use the ORAOLEDB. Driver Oracle to connect to my Oracle 10 g R2 server. My Oracle database connect in turn to a DB2 database via a database link. When I try to run stored procedures that contain simple PL/SQL queries, the connection works very well and recovers all data. However, when I try to run a CEP stored containing a reference cursor in it, I start to meet the following in the application error message:

    ORA-01002: Fetch out of sequence.
    Line before the < < DB DB2 link > >

    Please do advice.

    Thanks in advance.

    Hello

    I can miss the obvious here, but could you please post the code that creates a local transaction suggests? I'm not very familiar with the use of interop with VB ADO, but I guess there should be a con. BeginTrans in there somewhere as there is in VB6.

    Try something like this (can not compile, just coding top-of-my-head here)

    mcnnOBBT.BeginTrans
    Set rstTBK = cmdStoredProc.Execute
    
    If rstTBK.Fields("Book_Num").Value <= 1 Then
    MsgBox ("u are set")
    End If
    
    mcnnOBBT.CommitTrans
    cmdStoredProc.Properties("PLSQLRSet") = False
    Set rstTBK = Nothing
    
  • run a package through shell script

    Hi trying to run a package through shell script.
    But it is failling. Some may point out why?

    Here is the code im with


    ==================

    sqlplus user/pwd s < < EOF
    coil file.log

    START the user. PKG_Name.RUN_job;
    commit; END;
    spool off

    output
    EXPRESSIONS OF FOLKLORE

    ===========================


    I am able to run using the code below Toad.

    'BEGIN user. PKG_Name.RUN_job;
    commit; END; »

    What error do you get? Use
    sqlplus user/pwd s<>
    coil file.log
    START the user. PKG_Name.RUN_job;
    commit; END;
    /
    spool off
    output
    EXPRESSIONS OF FOLKLORE

    Kind regards.

  • Unable to connect to remote oracle database!  Help, please!

    Hi all-

    I am a new user Oracle and you are allowed to access a remote Oracle database, however I have problems with the installation/configuration program! I downloaded the driver Oracle and the Instant Client (11.2.0.2.0) because I need to use Microsoft Access for the data access (the Access database is already configured to the correct Oracle database). I'm under the impression that, to do this, I need to be able to use the ODBC Administrator to get all set up. Note: Im working on Windows XP.

    I have questions:

    -I don't seem to have installed Netca (which seems to be the recommended method to configure a connection). I have manually adjusted the TNSNAMES file. ORA file so it matches the database, but I'm not sure what would be my next step.

    -When I open SqlPlus it wants a username and password, and I tried the default settings and got an error each time. I must first use SqlPlus, or establish a connection via ODBC first?

    -Also: ODBC requires a TNS Service name, and I'm not sure, where this is established; something that would give the database manager?

    I really just do not know how to configure this remote connection! I continue to run with obstacles and really want a reference "step by step" on the way to do it, if there is such a thing. Any help or additional reference material would be appreciated! I ran by the content of the forum, but have not been able to decode the jargon! Thank you very much in advance.

    Marilyn

    MsMonroe wrote:
    Hi Ed-

    I use the Oracle's ODBC driver. I think there may be a problem with the TNSnames file because I tried to add this file as a"Data Source", and he also said that a connection could not be established. What do you mean by the MS implemented? A configuration of Data Source?

    By MS implemented, I was referring to the MS ODBC for Oracle driver, against the Oracle ODBC for Oracle driver.

    The "source of data file' has nothing to do with the tnsnames file. The ODBC Manager retains its DSN definitions in one of three places. "User DSN" is stored in the HKEY_LOCAL_USER registry, the "System DSN" definitions are stored in the HKEY_LOCAL_MACHINE registry and 'FILE DSN"definitions is stored in a file... I don't remember exactly where or what it's name is as I have (when he is forced to deal with odbc) just keep things simple and use "system dsn". But these aren't all the definitions of ODBC, Oracle tnsnames file.

    The link between the ODBC DSN and the tnsnames.ora presents itself as a property of the ODBC definition. Suppose you have this for a tnsnames.ora entry:

    houston =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = vmlnx01)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = orcl)
        )
      )
    

    Then
    -When you set up your odbc dsn, if you use the MS for Oracle driver, you must specify 'houston' as the 'server '.
    -When you set up your odbc dsn, if you use the Oracle odbc driver, you must specify "houston" as "the TNS Service name".

    >

    Im going to try to post a modified version of the content of my TNSnames.ora file (for some reason any the "content is not allowed ' by the forum), but I would like to get some comments on whether the structure of the content may be the problem.

  • How to connect to an Oracle database using acrobat form field java script actions

    I have a PDF template with buttons and form fields. One requirement is that when a key is pressed, I want to connect to an Oracle database to change the data of the table inside the DB.

    I wrote "Mouse Up" event and set a Java script to run on this event. Java script I am trying to connect to the DB and Transact on the DB.

    Any ideas how to achieve this.

    Thank you.

    Assuming you are using Acrobat (or reader) XI or newer, it is no longer possible.

    There used to be a way to connect to a PDF file using a script and ADBC, a DB defined locally, but Adobe removed in favour of this option progressively and now it is completely obsolete.

    The only type of PDF files that can still do are those created using LiveCycle Designer.

  • Component sql through shell script

    How to call a sql through UNIX shell script file?

    Rahul India wrote:

    export ORACLE_HOME=$ORACLE_BASE/product/10g
    
    cd $ORACLE_HOME
    set `sqlplus -s / <
    

    THIS SCRIPT IS OK?

    You will also need to set ORACLE_SID

    And I don't know why everyone puts the reference to sqlplus context of a 'set' assessment, nor why they put the reference to Scripture in a redirected input stream. What you need is

    sqlplus -s user/password  @r_100.sql
    

    And to make sure the environment is set correctly:

    export ORACLE_SID=whatever
    export ORAENV_ASK=NO
    . oraenv
    unset ORAENV_ASK=NO
    sqlplus -s user/password  @r_100.sql
    
  • How to use select into command in shell script?

    I need to get the total number of rows in a table using select count (*) table and must assign a shell script variable. I used the following script, it returns the number of lines, but also with oracle headers, please help me to remove the headers.

    Shell script
    #! / bin/sh
    Count = "sqlplus $username/$password@$tnsname < < EOF"
    NEWPAGE 0 VALUE
    SET SPACE 0
    SET LINESIZE 80
    SET PAGESIZE 0
    SET ECHO OFF
    SET FEEDBACK OFF
    SET THE POSITION
    Select count (*) in the table.
    "exit";
    EXPRESSIONS OF FOLKLORE"
    echo "the value is"$count"


    O/P:

    SQL * more: Release 10.2.0.4.0 - Production on game Dec 22 05:01:33 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64 bit Production with the partitioning, options Real Application Clusters, OLAP, Data Mining and Real Application Testing
    SQL > SQL > SQL > SQL > SQL > SQL > SQL > SQL 525935 SQL > >
    Disconnected from the database to Oracle 10 g Enterprise Edition Release 10.2.0.5.0 - 64-bit options of Production with the partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing

    Use SQL * Plus silent mode. Change:

    Count = "sqlplus $username/$password@$tnsname<>

    TO

    Count ='sqlplus- s $username/$password@$tnsname<>

    SY.

  • How to connect to the Oracle on VM1 VM2 of database with 11gClient

    Hi all

    I have a virtual machine running Windows7 x64bit, I loaded x64bit oracle server and created a database.  The thin database functions and the listener is running for the database.  I created a different VM running Windows7 x64bit, I loaded x64bit oracle client. I want to connect to the server (VM1) using pl/sql developer VM2.  I thought I could just use the tnsname connection string and connect, but not yet!

    Can someone point me to get instructions on how best to achieve this.  Thanks in advance!

    D.

    Could the firewall Windows on dbserver block 1521 maybe? If it's on, it might be useful to turn it off at least rule out it.

  • Unable to connect to remote oracle database

    Hello

    I am trying to connect to the database on a remote server oracle in visual studio 2005 by using instant client for windows.

    In visual studio 2005 Server Explorer, I clicked on add a connection
    Server name: I entered the server ip:1521@my instance name
    then user and password.

    It gives me the error: ORA-12546 TNS permission denied.

    I tried searching for lsnrctl status on the remote server, it works fine, and I can connect using sqlplus.

    I also disabled the firewall to avoid the risk of blocking, however tried my windows box: telnet ip 1521, it just does not respond and seems to timeout.

    should I set in the remote server first to accept connecting from outside?

    To connect via .NET with Instant Client, you will need the version 11 ODAC, see
    http://www.Oracle.com/technology/software/tech/Windows/odpnet/utilsoft.html

    The regular customer Instant download from http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
    does not contain the provider .NET.

    If telnet hangs without error message, this is of course no evidence that you can successfully connect to the database.
    It only means that you have reached the listening process, which is the best you can do with telnet.

    Yours,
    Laurenz Albe

  • BlackBerry Smartphones how I connect to my Yahoo through the STORM?

    I have a My Yahoo page, which I am able to enter my ID and password on my 'old' keyboard Blackberry (not a large display further but enough of what I want. I'm unable to "click in" the fields id and password of the user when using the storm to access my yahoo yahoo. By thus unable to see my Yahoo in any form on the STORM. New York tips on what I can do wrong?

    Thank you.

    Go to this link: http://us.m.yahoo.com/ and you will get My Yahoo mobile page.

    Gary

  • How can I connect to the internet through the dial upward through the computer another internet connection?

    If you want to tell me that MS will not support Windows 2000, please do not post. The computer on which internet Wi - Fi Connection has Windows Vista Home Basic on it. The computer that has WiFi but I want to test its dial-up access windows 2000 top. It has WiFi with utility that is necessary. It includes 12 Opera browser. As a resort last, if it is not possible at all means, ultimately, let me know how to connect to the internet through another computer via the telephone line through Internet connection sharing or network connection. Any help will be greatly appreciated. Remember, this is on the internet. Not on whether or not Microsoft does not support Windows 2000. If you tell me how it is not supported, please do not post. Internet connection will be between the two modems and two computer on Windows 2000, it has a LT Win modem and the Vista Home Basic has a CX110 in generation something like this modem. I ask this question is because my land line will not dial a number. I would like to test a dial, and if you tell me how it's slow, I use DC Unlocker to a broadband speed, so it won't be slow. Any help will be greatly appreciated. Windows 2000 has an Ethernet port.

    Hello

    1. are you referring to Windows Server 2000 or Windows ME?

    If you are referring to Windows Server 2000, please help the professional community of COMPUTING in the TechNet forum below:

    http://social.technet.Microsoft.com/forums/en-us/winservergen/threads

    http://support.Microsoft.com/ph/1131

    If you use Windows ME, visit the below mentioned link.

    http://support.Microsoft.com/kb/234815

  • Check the connection to a remote Oracle database


    Hello

    I have an application that runs on a server that connects to an Oracle database on another server.  The application uses Java and JNDI to connect, there is no Oracle client installed on the server hosting the application.  The application seems to have been to connect to the database on the other server.  How can I check that the connection to the database still work from the server hosting the application?  Is there a software tool that I use does not require Oracle client must be installed.

    Thanks in advance

    Alanjo

    the connection request is saved in the file listener.log on the DB server

Maybe you are looking for