This sounds like a possible job for Oracle::OCI, though I myself am not an OCI user, it sounds intriguing.
Jared On Sunday 12 January 2003 23:53, Georg Botorog wrote: > Of course not. At least, they are not part of SQL. The description in my > mail was a short-cut of what the script is actually doing, and the > startup/shutdown part may be somewhat misleading. > > However, whereas it is necessary to call sqlplus to startup/shutdown a > DB, it is nevertheless useful to be able to login to an instance, even > if it is shut down (e.g., there are V$... views that are interesting to > query, even in this state). And although connect (ora_session_mode = 2) > does a sysdba connect, this only works if the instance is started, > otherwise you still get an ORA-1034. This has obviously to do with > OCISessionBegin(), but I cannot tell at the moment, whether this > function simply cannot do it, whether my test has a flaw, or whether the > function is not called correctly from DBD. Personally, I suspect the > former (this is typical behavior of Oracle, where context independence > is not very appreciated), but I have no time at present to check it. > > Anyway, thanks for the help. > George > > > -----Original Message----- > > From: Jared Still [SMTP:[EMAIL PROTECTED]] > > Sent: Monday, January 13, 2003 5:10 AM > > To: Georg Botorog; Tim Bunce > > Cc: [EMAIL PROTECTED] > > Subject: Re: Problem with login as sysdba in DBI/DBD::Oracle > > > > > > Georg, > > > > I don't think DBD::Oracle knows about the 'shutdown' and > > 'startup' commands. These are database control features > > that were previously available only svrmgrl, and are now > > standard in sqlplus. > > > > It seems that you can't directly startup/shutdown a database > > using DBD::Oracle. I just tried it, it doesn't work for me. > > > > Tim? > > > > Jared > > > > On Monday 06 January 2003 03:45, Georg Botorog wrote: > > > Hello and a Happy New Year, > > > > > > I'm afraid I have not succeeded in making myself understood. The > > > > problem > > > > > is neiher selecting from V$... nor determining my own SID, the > > > > problem > > > > > is that my login is not done "as sysdba". Therefore, in particular, > > > > I > > > > > cannot login if the instance is down to start it up (and vice-versa, > > > > I > > > > > cannot shut it down when it is running). DBD seems to ignore the > > > parameter "ora_session_mode". However, I cannot imagine that > > > "ora_session_mode" is not working, because starting up / shutting > > > > down a > > > > > database is such a common operation, that somebody must have used > > > > this > > > > > parameter before. On the other hand, my example is so trivial, that > > > > I do > > > > > not see what could be wrong in it. My suspicion is that I lack some > > > package belonging to DBD::Oracle or that I have an older version > > > thereof. However, I have downloaded this package recently (the day I > > > wrote the first mail) with ppm. > > > > > > Any suggestion? Thanks. > > > > > > > -----Original Message----- > > > > From: Tim Bunce [SMTP:[EMAIL PROTECTED]] > > > > Sent: Monday, December 30, 2002 1:11 PM > > > > To: Jared Still > > > > Cc: Georg Botorog; [EMAIL PROTECTED] > > > > Subject: Re: Problem with login as sysdba in DBI/DBD::Oracle > > > > > > > > On Tue, Dec 24, 2002 at 07:31:00AM -0800, Jared Still wrote: > > > > > The problem you are having is most likely due to your > > > > > use of v$session_connect_info. Getting your own sessions > > > > > SID and using it to choose the correct row from > > > > > > > > v$session_connect_info > > > > > > > > > is notoriously tricky. > > > > > > > > > > Try doing this instead: > > > > > > > > > > my $sql=q{select sys_context('userenv', 'authentication_type') > > > > > > > > auth_type from > > > > > > > > > dual}; > > > > > my $sth = $dbh->prepare($sql); > > > > > $sth->execute; > > > > > my ($authtype) = $sth->fetchrow; > > > > > print "Authtype: $authtype"; > > > > > $sth->finish; > > > > > > > > Of course that could be reduced to just: > > > > > > > > my $authtype = $dbh->selectrow_array("select > > > > sys_context('userenv', > > > > > > 'authentication_type') auth_type from dual"); > > > > print "Authtype: $authtype\n"; > > > > > > > > Tim. > > > > > > > > > HTH, > > > > > > > > > > Jared > > > > > > > > > > On Thursday 19 December 2002 01:21, Georg Botorog wrote: > > > > > > Hi, > > > > > > > > > > > > I have the following trivial piece of code: > > > > > > > > > > > > use DBI ; > > > > > > use DBD::Oracle ; > > > > > > use strict ; > > > > > > > > > > > > my $db = "..." ; > > > > > > my $usr = "..." ; > > > > > > my $pwd = "..." ; > > > > > > my $mode = 2 ; > > > > > > > > > > > > my $dbh = DBI->connect ("dbi:Oracle:".$db, $usr, $pwd, > > > > > > > > {ora_session_mode > > > > > > > > > > => $mode}) ; > > > > > > ... > > > > > > $dbh->disconnect ; > > > > > > > > > > > > However, the connect is not done "as sysdba", but normally. I > > > > know > > > > > > this, > > > > > > > > > > because: > > > > > > 1. if the DB is shut down, then I get ORA-1034 ("Oracle not > > > > > > > > available") > > > > > > > > > > 2. if the DB is open, then the column AUTHENTICATION_TYPE of > > > > the > > > > > > view > > > > > > > > > > V_$Session_Connect_Info > > > > > > has the value "DATABASE" (as with normal logins) for the > > > > given > > > > > > > > session, instead of "OS" (as with "as > > > > > > sysdba" connects) > > > > > > > > > > > > What am I doing wrong? > > > > > > > > > > > > I use Perl 5.6.1, DBI 11.3, and DBD::Oracle 1.80. > > > > > > > > > > > > Thanks > > > > > > G. Botorog