in reply to Re^2: Connecting 'as sysdba' using DBD::Oracle
in thread Connecting 'as sysdba' using DBD::Oracle

I know that this is an old thread, but I was having the same problem and Google popped it to the top of the list when I searched for 'perl oracle connect as sysdba'. Just in case anyone else starts looking for an answer to this, the solution is to use a dsn of 'dbi:Oracle:' and undef for the username and password. Provided that you are running as oracle (or are a member of the dba group) on the host where the database is running and you have the ORACLE_SID variable set properly and you use the ora_session_mode => ORA_SYSDBA pair in the connection hash you will connect OK. At least that worked for me.
  • Comment on Re^3: Connecting 'as sysdba' using DBD::Oracle

Replies are listed 'Best First'.
Re^4: Connecting 'as sysdba' using DBD::Oracle
by Anonymous Monk on Mar 08, 2017 at 15:09 UTC
    I have some insight into this now. I did an strace of the process and the short answer is that there is conflicting posts online about the right way to do this.

    When installing DBD::Oracle, the advice is to build it against the Oracle Instant Client so that database upgrades don't break DBD::Oracle. When you need DBD::Oracle *and* you need to connect '/ as sysdba', you can't use the instant client because you are requesting an internal connection to the database. This attempts to exec the $ENV{ORACLE_HOME}/bin/oracle binary which does not exist.

    For this to work, you have to build/link against the full database install.

Re^4: Connecting 'as sysdba' using DBD::Oracle
by Anonymous Monk on May 03, 2016 at 10:13 UTC
    Thanks, this suggestion helped me to connect as sysdba..