Results 1 to 7 of 7

Thread: login script

  1. #1
    Join Date
    Sep 2003
    Posts
    156

    Unanswered: login script

    Ola,

    i require a script for sql plus that i can call to connect me to a chosen instance, so i can script the instance name, username and password -

    does anyone have such a script?

    Ciao
    rgs,

    Ghostman

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    To answer knowing the flavor of Operating System matters!

    Just click on the correct/desired icon.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    yeah, what Anacedent said

    Windows command line: create a .bat file that calls a cmd file to call sqlplus

    Unix: shell script (easy peasy)

    Windows sql/plus GUI: create a shortcut with the connect string after the .exe
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  4. #4
    Join Date
    Sep 2003
    Posts
    156
    Originally posted by The_Duck
    yeah, what Anacedent said

    Windows command line: create a .bat file that calls a cmd file to call sqlplus

    Unix: shell script (easy peasy)

    Windows sql/plus GUI: create a shortcut with the connect string after the .exe
    Hi guys,

    Win NT, Ora8i

    I didnt make myself clear, forgive me...

    what i meant was, from within SQL*plus ie. i have 9 instances i monitor, well, there are tables that i have to monitor, mapping tables etc etc, and i have to make sure certain columns are there before i run certain scripts ...

    i would like to write a script for sql*plus where i can give myself the option, from within SQL*plus to connect to the other instances, i have tried using the syntax connect username/pword@instance but it throws an error explaining the syntax...

    example forgive the sloppy explanation...


    accept p_1 prompt 'select instance 1 through 9'

    declare
    {variables}

    begin

    if &p_1 = 1 then
    connect username/pword@instance1;
    elsif &p_1 = 2 then
    connect username/pword@instance1;
    and so on...

    i can then keep this script in my bin dir, and call from another menu type thingy i have going,

    forgive me guys, im not a dba, or developer, im just a guy who works with apps that sit ontop of oradb, datawarehousing...

    any input appreciated.
    rgs,

    Ghostman

  5. #5
    Join Date
    Jul 2003
    Posts
    2,296
    like this?
    PHP Code:
    15:25:02 platform@kod1spool c:\integration.con
    15
    :25:31 platform@kod1select 'connect integration/integration@kod1' from dual;

    'CONNECTINTEGRATION/INTEGRATION@KOD1
    ------------------------------------
    connect integration/integration@kod1

    Elapsed: 00:00:00.00
    15:25:39 platform@kod1> spool off;
    15:25:46 platform@kod1> @c:\integration.con

    Connected.

    15:25:56 platform@kod1> show user
    USER is "INTEGRATION"
    15:26:05 platform@kod1> 
    obviously you don't need to spool anything, just create the files with the connect strings you want.
    then you just call them when you want to connect somewhere else.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You don't really need to "log onto" a remote DB to access objects in it.
    One "trick" I use (where needed) is to create a database link called "REMOTE".
    Next I create SQL or PL/SQL which uses this DB link; such as
    SELECT * FROM MY_TABLE@REMOTE;
    =========================
    By dropping & recreating REMOTE to point to a different DB,
    I can have and use the same code base to operate against
    multiple DBs (one at a time).

    HTH & YMMV

    HAND!

  7. #7
    Join Date
    Sep 2003
    Posts
    156
    Thanks guys, i'll check this out.

    Yes, wonderful, got it, ta.
    Last edited by GhostMan; 01-23-04 at 04:47.
    rgs,

    Ghostman

Posting Permissions

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