Which account to use when connecting to Oracle DB from script?
Posted on 2011-02-27
please can somebody help me with the following?
I'm trying to connect to Oracle from PowerShell script. I believe the only problem is in the incorrect connection string and I don't know, which user account should be used in the string.
The hostname is ORA1 and there I have only the default database called "orcl".
If I use lsnrctl status, it displays the info about runninc instance "orcl", so I think this shouldn't be a problem.
I'm able to connect to database from sqlplus. I know almost nothing about Oracle, but it seems that I can connect successfully if I use the username "sys as sysdba".
I set all the passwords to be "abc" just for simplicity.
I doesn't let me in if I use the account sysdba directly - it works only as "sys as sysdba".
Now regarding the script - it's almost the same. If I have "sys" in the connection string, I get an error message saying "you should use 'sys as sysdba' as logon name".
If I change it in the connection string and use the username "sys as sysdba", then I get an error message about incorrect password/logon denied.
Could you please tell me how to fix it? I read hundred of pages about the connection strings, tried multiple combinations, but no avail so far.
Also I'm not sure what value should be in the connection string in "data source". I have "ora1\orcl", which is the hostname\db_name. Should I use something different?
Thank you very much in advance.