Oracle using perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Oracle using perl
# 1  
Old 07-30-2008
Oracle using perl

Hello All,

I need to now how can I establish connection with oracle database then shutdown abort and then startup, In other words need to implement the following lines to perl script:

export ORACLE_SID=<some user>
${ORACLE_HOME}/bin/sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown abort
SQL> startup
SQL> connect user/user@user
SQL> update TABLE set MAX=50 where NODE='node.node1'
and some more updates.

I know that there is some moudle that handle oracle DB, DBI and DBI::ORACLE , try to dig but got dizzy Smilie, and didn't find any info that describe how to "shutdown abort" and "startup" ,
Is that implementable at all ?

Your help will Appreciated.
Thanks,
Ronen
# 2  
Old 07-30-2008
I'm pretty sure you can't shutdown the database from inside SQL plus, and you certainly couldn't start it up! These commands are executed from the operating system, not sqlplus. You can certainly do that from perl or any shell script just like you execute any other OS command -- provided you've got the authority in the first place...
# 3  
Old 08-01-2008
Hi,
in your script do this :
Code:
export ORACLE_SID=<Name of DB>

${ORACLE_HOME}/binsqlplus /nolog << EOF | tail -4 | head -1  2>/dev/null      
 connect / as sysdba
 shutdown abort
        exit ;
EOF `

Feed back for result.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Oracle connection error

I've a Centralized Server which can connect to all Oracle Databases. When I was trying the below code it doesn't work, But tnsping was working fine. #!D:/perl5/bin/perl.exe use DBI; my $dbh = DBI->connect('dbi:Oracle:QBDIWCE', 'IDUSER', 'SECRET123#' ) || die( $DBI::errstr . "\n" ) ; ... (1 Reply)
Discussion started by: ilugopal
1 Replies

2. Shell Programming and Scripting

perl- oracle sql query

Hi, I am new to perl.How to query oracle database with perl??? Thanks (1 Reply)
Discussion started by: tdev457
1 Replies

3. Shell Programming and Scripting

PERL and Oracle 11.2 question

Hi, we have PERL 64-bit build with Oracle 10g DBD . PERL database connection are working fine. Database upgraded to 11.2 and in PERL documents it says still use 10g DBD to connect to 11.2. when I try some test connections, I am getting this error . Did anyone see this error before . I set the... (2 Replies)
Discussion started by: talashil
2 Replies

4. Shell Programming and Scripting

Need help in perl script for oracle

Hi, #!/usr/bin/perl my @sid=`cat /etc/oratab|grep -v "^#"|grep -v "*"|grep -v "#"|cut -d: -f1 -s`; my $log; my $body=""; my $oraclesid=""; chomp($hostname); foreach my $oraclesid (@SID){ $body=""; chomp($oraclesid); $dbname=print ($oraclesid); print... (2 Replies)
Discussion started by: rocky1954
2 Replies

5. Shell Programming and Scripting

Perl connect to remote oracle db without local oracle installation

I want to use Perl to connect to a remote Oracle DB I have no oracle installation on my server (and dont plan on installing one) I am using solaris 9 on x86 server. Is this possible? I basically want to run some basic sql queries on the remote oracle db which I have access to using perl on my... (0 Replies)
Discussion started by: frustrated1
0 Replies

6. Shell Programming and Scripting

Perl + Oracle + bind_param_inout()

Hi. I'm attempting to assign a variable via a field that is using an autoincrement sequence. I'm trying to use the Oracle bind_param_inout() procedure to pass the value by reference. The code goes a bit like this: ************* my $sql=q(INSERT INTO MESSAGES (message_id, message_text,... (4 Replies)
Discussion started by: mirage4d
4 Replies

7. Shell Programming and Scripting

How to connect ORACLE using PERL

Hi Friends, I am having Perl 5 and Oracle 9i. I just wanna to connect Oracle DB & to perform some select query statement. Could anyone pls let me know. I've tried below command which i found in some website, But it throws some error.:confused: Executed: perl -e 'use DBI; print... (1 Reply)
Discussion started by: Vijayakumarpc
1 Replies

8. Programming

perl dbi to oracle getting disconnect_all for oracle dbi help

hi i am trying to connect to an oracle database using dbi and i get this :: Driver has not implemented the disconnect_all method. at /opt/perl/lib/site_perl/5.8.0/sun4-solaris/DBI.pm line 575 END failed--call queue aborted. for all i know, the script was working earlier, but has... (1 Reply)
Discussion started by: poggendroff
1 Replies

9. UNIX for Dummies Questions & Answers

PERL - Oracle

Hi friends, I am new to Perl programming. I have a requirement, using perl I need to connect to Oracle DB and get some records ( on unix environment). I googled and found that we need to use DBD (Database Drivers), DBI (DataBase Interface) to connect to oracle. I tried using " sqlplus... (1 Reply)
Discussion started by: satguyz
1 Replies

10. UNIX for Advanced & Expert Users

perl-DBD-Oracle

I am trying to install perl-DBD-Oracle-1.16-1.2.rpm on Suse (SLE 9), like rpm -Uvh perl-DBD-Oracle-1.16-1.2.rpm but I keep getting the following error message error: Failed dependencies: libclntsh.so.10.1 is needed by perl-DBD-Oracle-1.16-1.2.el4 libnnz10.so is needed by... (1 Reply)
Discussion started by: hassan1
1 Replies
Login or Register to Ask a Question