0

I need to connect in sysdba on Oracle from Vbs.

I use this command to connect on my database

set cn = CreateObject("ADODB.Connection")      
set rs = CreateObject("ADODB.Recordset")       
    ConnectionString ="Provider=OraOLEDB.Oracle; Data Source=" & _
    "(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST="&computername&")(PORT=1521)))(CONNECT_DATA=(SID="&SERVICE &")(SERVER=DEDICATED)));" & _
    "User Id=system;Password="&PASSWORD &";"
cn.Open connectionString

but I need to connect witch / as sysdba

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Galene
  • 39
  • 3

2 Answers2

0

Try this one:

ConnectionString ="Provider=OraOLEDB.Oracle; Data Source=" & _
    "(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST="&computername&")(PORT=1521)))(CONNECT_DATA=(SID="&SERVICE &")(SERVER=DEDICATED)));" & _
    "DBA Privilege=SYSDBA;User Id=system;Password="&PASSWORD &";"

btw, when you connect with SYSDBA privileges then it is usually user SYS not SYSTEM - unless you granted privilege like GRANT SYSDBA TO SYSTEM;

Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • it doesn't work, I use user sys when I connect with SYSDBA the error when I try to connect on my database is the number 3704 – Galene May 06 '15 at 07:27
0

it's work! with this method

Set cmd = sh.Exec("cmd /c "& ORACLE_HOME & "\BIN\sqlplus.exe -s /@"&SERVICE &" as sysdba @Z:\Partage\Sonde\essai\test_recordset\requetesql.sql")

@Z:\Partage\Sonde\essai\test_recordset\requetesql.sql

it's a file where we go to execute queries

Galene
  • 39
  • 3