Galene Posted May 7, 2015 Share Posted May 7, 2015 (edited) hello I need to connect in sysdba on Oracle from Vbs. For retrieve the state of the database (Open mount ...) because the user system can not connect when the database is on mount. I use this command to connect on my database when she is open Set env = WshShell.Environment("PROCESS" ) computername = env("COMPUTERNAME" ) 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 can you help me please ? thanks Galene Edited May 7, 2015 by Galene Link to comment Share on other sites More sharing options...
justsomeguy Posted May 11, 2015 Share Posted May 11, 2015 What happens if the database is mounted? Do you get an error when connecting? Link to comment Share on other sites More sharing options...
Galene Posted May 12, 2015 Author Share Posted May 12, 2015 When my database is mount and I run my script I have a connection error err.number 3704, because you can log in sysdba when in state mount. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 12, 2015 Share Posted May 12, 2015 VBScript doesn't have very good error handling, it looks like the best you can do is tell it to continue on fatal errors, but then you need to check yourself to see if an error happened. That might be your only option. I doubt you will be able to tell the status of the database without connecting to the server, and if you get an error on connection then you'll need to handle that yourself.http://stackoverflow.com/questions/157747/vbscript-using-error-handling Link to comment Share on other sites More sharing options...
Galene Posted May 13, 2015 Author Share Posted May 13, 2015 in fact I created a nagios probe for check the status of my databse that's why I need to connect in sysdba with my script but nothing works... Link to comment Share on other sites More sharing options...
Galene Posted May 15, 2015 Author Share Posted May 15, 2015 (edited) two weeks of research and no solution I need help please Edited May 15, 2015 by Galene Link to comment Share on other sites More sharing options...
justsomeguy Posted May 15, 2015 Share Posted May 15, 2015 Are you sure there's a way to check the state before connecting? Link to comment Share on other sites More sharing options...
Galene Posted May 18, 2015 Author Share Posted May 18, 2015 yes we can check the state before connecting, I have a probe that allows Linux to do, you just connect with the privilege " as sysdba" and I have to do the same but in vbscript. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 18, 2015 Share Posted May 18, 2015 VBScript is very limited. Maybe you just need to find a connection string that works for you though. You could start here:http://www.connectionstrings.com/oracle/ Link to comment Share on other sites More sharing options...
Galene Posted May 19, 2015 Author Share Posted May 19, 2015 I have watched this site and tried different connectionstringBut unable to connect with sysdba privilege Link to comment Share on other sites More sharing options...
justsomeguy Posted May 19, 2015 Share Posted May 19, 2015 Have you done any searching for it?https://www.google.com/search?client=opera&q=vbscript+connect+oracle+sysdba&sourceid=opera&ie=UTF-8&oe=UTF-8 Link to comment Share on other sites More sharing options...
Galene Posted June 1, 2015 Author Share Posted June 1, 2015 it's work! with this method Set cmd = sh.Exec("cmd /c "& ORACLE_HOME & "BINsqlplus.exe -s /@"&SERVICE &" as sysdba @Z:PartageSondeessaitest_recordsetrequetesql.sql") @Z:PartageSondeessaitest_recordsetrequetesql.sql it's a file where we go to execute queries Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now