How execute the shutdown immediate on oracle using perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vijay@77
    New Member
    • Aug 2006
    • 2

    How execute the shutdown immediate on oracle using perl

    hai guys..
    I have a problem..I need to shutdown the database from perl script. I was trying through connect(), execute(), prepare()..But some how I am getting error as Invalid sql statement..
    I will give my code..help me..
    use DBI;

    $ENV{ORACLE_SID } = "orcl"; # set ORACLE_SID as needed
    $sid = "pacs";
    $host = "192.188.136.30 "; #<hostname>
    $user ="sys";
    $password = "production ";

    $dbh = DBI->connect("dbi:O racle:host=$hos t;sid=$sid", $user, $password,{ ora_session_mod e => SYSDBA });
    print "connect db";
    $query = "shutdown immediate";
    $sth = $dbh->prepare($query );
    $sth->execute();
    ..
    thanks in advance..
    regards & thanks..
    vijay :confused:
  • mikek
    New Member
    • Oct 2006
    • 2

    #2
    Vijay,
    I would think:

    $query->finish;
    ## Ends the execute
    and
    $dbh->disconnect;
    ## disconnects the DB

    SHOULD handle it.
    Is that what you mean ??

    Regards,
    MikeK




    Originally posted by vijay@77
    hai guys..
    I have a problem..I need to shutdown the database from perl script. I was trying through connect(), execute(), prepare()..But some how I am getting error as Invalid sql statement..
    I will give my code..help me..
    use DBI;

    $ENV{ORACLE_SID } = "orcl"; # set ORACLE_SID as needed
    $sid = "pacs";
    $host = "192.188.136.30 "; #<hostname>
    $user ="sys";
    $password = "production ";

    $dbh = DBI->connect("dbi:O racle:host=$hos t;sid=$sid", $user, $password,{ ora_session_mod e => SYSDBA });
    print "connect db";
    $query = "shutdown immediate";
    $sth = $dbh->prepare($query );
    $sth->execute();
    ..
    thanks in advance..
    regards & thanks..
    vijay :confused:

    Comment

    Working...