BEAUTY!! Thanks a lot, Steve. To complete this solution, ORACLE_SID must
be set, but it works like a charm. I'm a happy man. Thanks for the
persistence.
For everybody else, here's what to do:
use strict;
use DBI;
use DBD::Oracle qw(:ora_session_modes);
my ($dbh, $mode);
$ENV{'ORACLE_SID'} = <your sid>;
$mode = ORA_SYSDBA; # or ORA_SYSOPER
$dbh = DBI->connect("dbi::Oracle:", '', '', {ora_session_mode => $mode}) ||
die $DBI::errstr;
The rest is downhill.
Have a great day,
Gal
-----Original Message-----
From: Steve Baldwin [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 9 September 2003 8:39 AM
To: 'Baras, Gal'
Subject: RE: ORA-01031 when trying to connect as sysdba. sqlplus works
As far as I know, just make sure your username/password doesn't contain
'@xxx', and there is nothing after the last ':' in the DBI connect
(dbi:Oracle: rather than dbi:Oracle:XXX). I haven't actually tried
connecting as sysdba from a Perl script, so can't confirm this.
-----Original Message-----
From: Baras, Gal [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 9 September 2003 8:22 AM
To: 'Steve Baldwin'; Baras, Gal
Cc: [EMAIL PROTECTED]
Subject: RE: ORA-01031 when trying to connect as sysdba. sqlplus works
Is there a way to tell perl to use IPC?
-----Original Message-----
From: Steve Baldwin [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 9 September 2003 8:31 AM
To: 'Baras, Gal'
Cc: [EMAIL PROTECTED]
Subject: RE: ORA-01031 when trying to connect as sysdba. sqlplus works
We have a setup here where you cannot connect as sysdba via SQL*Net.
Maybe that's your problem.
-----Original Message-----
From: Baras, Gal [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 9 September 2003 7:44 AM
To: 'Gold, Samuel (Contractor)'
Cc: '[EMAIL PROTECTED]'
Subject: RE: ORA-01031 when trying to connect as sysdba. sqlplus works
Thanks for the quick response, but this was not the solution.
In my subject line and body of message I mentioned that sqlplus works
for me with the same UNIX user.
Just to prove the point, I've added the following line to my code:
$opt_d && print `id`;
Here's what perl prints:
uid=105(psoft) gid=101(dba) groups=1004(cobol)
Thanks,
Gal
-----Original Message-----
From: Gold, Samuel (Contractor) [mailto:[EMAIL PROTECTED]
Sent: Monday, 8 September 2003 9:07 PM
To: 'Baras, Gal'; '[EMAIL PROTECTED]'
Subject: RE: ORA-01031 when trying to connect as sysdba. sqlplus works
This is caused by the user executing the script not being part of the
dba group. ORA-01031 is insufficient privileges. Who ever is executing
the script needs to be part of the dba group or osdba group. HTH.
Thanks,
Sam Gold
-----Original Message-----
From: Baras, Gal [mailto:[EMAIL PROTECTED]
Sent: Monday, September 08, 2003 3:59 AM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: ORA-01031 when trying to connect as sysdba. sqlplus works
Hello,
I'm getting an ORA-01031 error when trying to use the ORA_SYSDBA or
ORA_SYSOPER modes.
When using sqlplus, I can use '/ as sysdba' and '/ as sysoper' as the
same UNIX user(s).
This is on HP-UX 11i, Oracle 9.20, perl 5.8.0, DBI 1.37 and DBD::Oracle
1.14.
Thanks,
Gal