I have created two database on a Win2000 machine. Oracle_sid = DB1 or DB2.
How can I access the different databases from Sqlplus on my machine without having to go into the environment variables on the database machine and change the Oracle_SID to the target database? The TNSnames.ora file on my machine list both databases on the target machine. The target machine has two entries for the listener.ora. One for each database.
Any help would be appreciated.
simple let's say you are connected already then,
SQL> connect your_id@instance
SQL> connect scott@DB2
You can also spcify your password on one line but this is a bad practice in my opinion.
SQL> connect scott/tiger@DB2
I try that and I get the following error message:
ORA-24327: need explicit attach before authenticating a user
I've tried signing on using the connect scott/tiger@db2, connect scott/tiger@machine name. Nothing seems to work. Something has to be set up incorrectly, but I can't figure out what.
The only other thing I can think of is that when I use "connect"
here at work I have to specify the entire HOST name as it is listed in the tnsnames.ora file.
SQL> connect steve@D123.oracledb.mycompany.com
Check the tnsnames file and look at the host listing, also make sure you updated the correct tns file, there are usually a few.
I figured it out. The listeners were crossed (for lack of a better explanation). When the second database was created, a second listener was also created (listener2). Somehow the first listener (listener) was also listening for the second database, but not on the correct port. I stopped both listeners and then restarted then individually and now the first listener listens for the first DB and the second listener listens for the second DB. And my connections work.
Thanks for you assistance.