Marcel
Marcel

Reputation: 464

How to change default Oracle 11g to 19c in cli Windows 10?

How to change default Oracle 11g to 19c in cli Windows 10?

I have 2 Oracle db releases on my Windows 10: 11g & 19c. When I enter cmd line (or any shell), type sqlplus I am by defalut connected to 11g release.

I would like to change default db in cmd to 19c. How can I do that?

Upvotes: 1

Views: 743

Answers (3)

Timothy Odhiambo
Timothy Odhiambo

Reputation: 45

Go to Start and type Environment Variables, click Edit Environment Variables then click Environment Variables in the dialogue box. Under System Variables scroll to Path then click Edit. Move the database path you need to be picked by default on top of the other using the Move Up and Move Down button. I have highlighted the two database in use in yellow. For me 11g is picked by default, I'll move the path to 19c to be above the one for 11g when I need it to be default. snip of two oracle database servers

Upvotes: 0

Connor McDonald
Connor McDonald

Reputation: 11616

We will follow the PATH variable in the absence of anything else, eg

c:\>set PATH=C:\oracle\product\19\bin;%PATH%

c:\>sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Feb 16 18:32:44 2021
Version 19.8.0.0.0

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

c:\>set PATH=C:\oracle\product\18\bin;%PATH%

c:\>sqlplus /nolog

SQL*Plus: Release 18.0.0.0.0 - Production on Tue Feb 16 18:33:08 2021
Version 18.6.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Then set your ORACLE_SID or connect via a service as already mentioned

Upvotes: 1

Littlefoot
Littlefoot

Reputation: 143083

Usually we use TNSNAMES.ORA file which contains "aliases" to databases we access. Then, while connecting to a desired database, we specify its alias:

sqlplus scott/tiger@ora11g

or

sqlplus mike/lion@ora19c

Although you may have access to only 2 databases, my TNSNAMES.ORA contains entries for 55 of them. What I'm trying to say is that you may consider "one" database "default", but as the time goes by, that "default" will either change or will be mostly useless as you'll connect to different databases on a daily bases. Therefore, check your TNSNAMES.ORA, specify its alias along with username/password and ... that's it.

Upvotes: 0

Related Questions