RE: Automatng import

From: Paul Boutros (Paul.Boutros_at_utoronto.ca)
Date: 12/27/03

  • Next message: David Manura: "SQL::Interpolate - request for comments"
    To: <sc00170@cc.uoi.gr>,	"dbi-users" <dbi-users@perl.org>
    Date: Fri, 26 Dec 2003 22:19:59 -0500
    
    

    Two ideas:

    1. I'm not sure why can't you just access everything via DBI?

    my $dbh = DBI->connect($connect_string, $user, $password);
    $dbh->do("drop user jim cascade");
    $dbh->commit();
    $dbh->do("create user jim...");

    2. If you really need to use system calls to SQL/PLUS why don't
    you write the calls into a file and then execute the entire file
    with one system command.

    open(OUT, '>', 'commands.txt');
    print OUT "drop user jim cascade;\n",
                    "commit;\n",
                    "create user jim...";
    close(OUT);

    system("sqlplus scott/tiger commands.txt");

    # or if you want to retain output:
    my $val = `sqlplus scott/tiger commands.txt`;
    print $val;

    For all the sql/plus command-line options you'll need to check
    the Oracle documentation.

    Paul

    > -----Original Message-----
    > From: John [mailto:John@cc.uoi.gr]
    > Sent: Friday, December 26, 2003 3:38 PM
    > To: dbi-users
    > Subject: Re: Automatng import
    >
    >
    > Quoting Kevin Moore <kmoore@esntech.com>:
    >
    > > Try "drop user jim cascade"
    > >
    > > John wrote:
    > >
    > > >Hi all
    > > >
    > > >I am planning to make a cronjob so i would like to know if tht can be
    > > achived through a perl script.
    > > >
    > > >To be more specific, i have an Oracle RDBMS and i want to execute some
    > > commands in the shell
    > > >
    > > >.....
    > > >system("sqlplus system/password");
    > > >system("drop jim cascade");
    > > >........
    > > >
    > > >
    > > >can be the above done? To execute internal commands as the
    > sqlplus programs
    > > provides?
    > > >
    > > >
    > >
    > >
    >
    > I am afraid that this trick isn't going to work as far as system() will be
    > waiting until the sqlplus command ends.
    >
    > What do you say?


  • Next message: David Manura: "SQL::Interpolate - request for comments"

    Relevant Pages

    • Re: 10g SQLPLUS connect problem
      ... | Database Home Page ... | Then I try to do the same thing in SQLPLUS. ... do you have more than one Oracle selection under your start--> ... If I go into the command line and say sqlplus / as sydsba, ...
      (comp.databases.oracle.misc)
    • Re: 10g SQLPLUS connect problem
      ... | Database Home Page ... Before starting SQLPLUS, ... do you have more than one Oracle selection under your start--> ... If I go into the command line and say sqlplus / as sydsba, ...
      (comp.databases.oracle.misc)
    • Running SQLPlus from command line
      ... New to SQLPlus so bear with me. ... I tried running Toad from the command line but many threads (and days ... My 5 line batch file runs, but there are four problems I ... After Line 4 executes SQLPlus the batch file hangs. ...
      (comp.databases.oracle.misc)
    • Re: how to spool to C:Documents and SettingsxzengMy Documents?
      ... How do I spool the output to a directory whose name has spaces in ... In sqlplus (command line version) I start it from the command line from ... This also works for sqlplusw (the window version of sqlplus). ...
      (comp.databases.oracle.misc)