Understand the shared and private connections of oracle
In dedicated connection mode, client connection only supports dedicated connection; in shared connection mode, either dedicated connection mode or shared connection mode can be used;
Dedicated connection mode: a client connection corresponds to a server process, one-to-one;
Shared connection mode: multiple client connections correspond to a server process, and there is a process dispatcher on the server side to manage, many-to-many;
look at the picture
shared connection
dedicated connection
Check whether oracle database server is in shared or private connection mode
The following test is dedicated mode and uses shared mode to connect to the login database with an error
Change the server back to DEDICATED and log in.
So how do I change the database to shared mode?
2 dispatchers are configured, with a maximum of 5 dispatchers;
alter system set dispatchers ='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.168))(DISPATCHERS=2)';--It is recommended to write host here. If you do not write it, you need to add a host name and ip corresponding record to the hosts file on the connected computer, otherwise you will report error ora-12545;
alter system set max_dispatchers=5;
Configure the number of shared server processes
alter system set shared_servers=5;--Sets the current shared server process to 5
alter system set max_shared_servers=15;--Max shared server process is 15
alter system set shared_server_sessions=100;--Set the number of shared connection sessions, which cannot exceed the number of sessions
Change tnsname.ora's connection mode to shared
Connection successful, query v$session dynamic performance view, connection mode is both dedicated and shared
Find all dispatchers
Finally, I will teach you a simple way to connect.
Grammar:
connect username/password @ hostname (or IP address): port number/instance name
For example: sqlplus sys/123456@192.168.3.168:1521/orcl