-1

I'm totaly new in oracle, so sorry for my probably stupid question... I have two instances on oracle server, when I'm connecting to the server via sqlplus in default opens connection to instance X but I need to change instance to Y. How can I do that?

  • 3
    How exactly are you connecting via SQL*Plus? Normally, you'd do something like sqlplus user/password@TNS_alias in which case you'd have one TNS alias for X and one for Y. If you are telnetting to the database server and connecting without a TNS alias, your ORACLE_SID environment variable controls which SID is the default. You could change that every time but it probably makes more sense to specify a TNS alias explicitly. – Justin Cave Oct 29 '19 at 20:05
-1

Assuming that you already went through the steps of connecting to your Oracle DB using SQL*PLUS, here is how to switch from one database to another within your instance:

ALTER SESSION SET CONTAINER = myDB;

The best way (in my opinion) to connect to an specific database would be to specify the DB your are connecting to in the connection string.

CONNECT SYSTEM/PASSWORD@myDB

https://docs.oracle.com/database/121/ADMIN/cdb_admin.htm#ADMIN13606

  • Switching the container is something different than switching the instance – a_horse_with_no_name Nov 12 '19 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.