Results 1 to 6 of 6

Thread: unix sqlplus

  1. #1
    Join Date
    Nov 2007
    Posts
    6

    Red face Unanswered: unix sqlplus

    Hello ,
    I'm looking for a way to connect to a database using :
    sqlplus username/password@dom from a unix box. But the problem here is i want the sqlplus to terminate once successful logon to the database. The reason i want this is, I've got a list of database that i need to check for successful logons e.g
    sqlplus username/password@dom
    sqlplus username/password@abc
    sqlplus username/password@ert
    sqlplus username/password@qwe
    I've put all this in a script and just type the name when i need to check for them. The problem is i have to type exit at the sqlplus prompt each time for the script to check the next details. Please help. thanks very much for any contribution.

  2. #2
    Join Date
    Dec 2007
    Posts
    253
    Put Exit at the end of each connnection:

    SQLPLUS HR/HR@ORCL EXIT

  3. #3
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    I hope it works on UNIX, as OpenVMS as well as MS Windows complain about it (i.e. invalid syntax).

  4. #4
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    Code:
    $
    $ cat testconn.ksh
    #!/usr/bin/ksh
    
    sqlplus << EOF
    scott/tiger
    EOF
    
    sqlplus << EOF
    scott/tiger
    EOF
    
    sqlplus << EOF
    scott/tiger
    EOF
    $
    $ testconn.ksh
    
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Feb 21 09:27:52 2008
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Enter user-name:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Feb 21 09:27:53 2008
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Enter user-name:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Feb 21 09:27:53 2008
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Enter user-name:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    $
    HOWEVER, I would just use ONE sqlplus path and multiple CONNECT statements within it.

  5. #5
    Join Date
    Dec 2007
    Posts
    253
    My profuse apologies. Aliens took over my brain and forced me to write that blithering nonsense.
    The actual answer is of course, to create a sql script file that contains the exit command and call it thus:
    sqlplus usr/psswrd@dbname @sqlfile
    Time for the Tinfoil hat again

  6. #6
    Join Date
    Nov 2007
    Posts
    6
    Thx pablolee, Jmartinez. Help very much appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •