-
Has anybody connected to oracle as sysdba through the Perl DBI? If it can be done, I can't figure out the syntax...
Jeff Hunter
-
I guess you have connecting to Oracle with a valid user working.
#################################################
# Connect to Oracle as username/oldpassword ##
#################################################
use DBI;
print "connect string: $username/\"$oldpassword\"\@$database \n";
$dbh = DBI->connect("dbi:Oracle:$database","$username",$oldpassword, {PrintError => 1} );
if ($DBI::errstr =~ /ORA-28002/) {
# this is the 'expire in 3 days' message
print "***User/oldpassword/database valid: connection okay ***\n";
} elsif ($DBI::errstr =~ /ORA-/) {
print "***User/oldpassword/database invalid: connecting failed - check authentication and db name (tns) \n $DBI::errstr \n";
exit 1;
} else {
print "*** connecting as user with old password: connection okay ***\n";
$dummy = 1;
}
-
I hit the submit button when I meant to hit the preview button (more code than you asked for).
Can you use a valid user with sysdba privs?
-
Yeah, that part is no problem. The "as sysdba" is where I'm having the problem...
Jeff Hunter
-
Originally posted by gopi
Can you use a valid user with sysdba privs?
Unfortunately, you can connect with a userid/password of a sysdba user, but still not able to perform sysdba functions unless you specify "as sysdba". In PRO*C, you would have to:
Code:
EXEC SQL
CONNECT :sys IDENTIFIED BY :SYS-PASSWD IN SYSDBA MODE
END-EXEC.
but I can't figure out how to do it in Perl...
Jeff Hunter
-
The fine folks at dbi-users@perl.org (Michael A Chase) pointed me to the perldoc DBD::Oracle where I need to specify DBI->connect($DSN,$USER,$PASSWD,{ora_session_mode=>2});
Jeff Hunter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|