In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail the difference between session and process in Oracle. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Corresponding metadata table
V$resource_limit .
interrelation
Sessions=1.1 * processes + 5, as for how many processes are open, it is related to the number of concurrency of your users.
If you want to modify the database initialization parameters, processes and session
The difference between session and process in Oracle
Q: what is the difference between session and process in Oracle?
Answer: 1. A process can have 0, 1 or more session, and a session can also exist in several process. Parallelism is also a session corresponding to a process, the main session is coordinator session, and each parallel process also corresponds to a separate session in the database. You can verify this from v$px_session and v$session.
Second, the relationship between connection connects, session sessions and process pocesses
Each sql login is called a connection, and each connection can produce one or more sessions if the database is running on a dedicated server.
A session corresponds to a server process (process). If the database is running in a shared server mode, a server process can serve multiple sessions.
III. A session is a specific connection of a user to an Oracle server.The session starts when the
User is validated by the Oracle server, and it ends when the user logs out or when there is an
Abnormal termination.
In the UNIX environment, most Oracle processes are threads of one master Oracle
Process rather than being individual processes. On Windows NT, all processes
Consist of at least one thread.
The difference between an Oracle dedicated server and a shared server when you set up an Oracle database, you should see an option on the database setup assistant wizard, which is how the database connection mode should be used. In Oracle9i or 10g, you can see that there are two connection modes, one is called dedicated server connection (dedicated server) and the other is called shared server connection (shared server). Let's classify and talk about the differences between the two connections.
Dedicated server mode means that every time the Oracle is accessed, the Listener of the Oracle server gets the access request and then creates a new process to service the access. Therefore, for each client access, a new process is generated to serve, which is similar to an one-to-one mapping relationship. A very important feature of this connection mode is that UGA (user global domain) is stored in PGA (process global domain). This feature also shows that the current user's memory space is allocated according to the process.
The other shared server connection is the concept of connection pool (pool), which is commonly used in programming. In this mode, a group of server connection processes are created when the database is initialized, and then these connection processes are put into a connection pool to manage. The number of processes in the initialized pool can be set manually when the database initialization is established. When a connection is established, Listener first accepts a request from the client to establish a connection, and then Listener generates a process called dipatcher to connect with the client. The scheduler places the client's request in a request queue in the SGA (system global domain), then looks for free connections in the shared server connection pool, and then lets the idle server process it. After processing, the processing results are put in the corresponding queue of SGA. The scheduler queries the corresponding queue, gets the returned result, and then returns it to the client. The advantage of this connection mode is that the number of server processes can be controlled, and it is unlikely that the server memory will collapse due to too many connections. However, due to increased complexity and requests for the corresponding queue, performance may be degraded.
In short, it may be better to use the first dedicated server during the development phase, because there is less intermediate complexity and there are generally fewer connections during development. In the practical application environment where multiple applications use one database at the same time, it may be better to adopt the second method, because if there are suddenly 1000 or 10000 request connections, the database server can't stand it if 10000 connections are established at the same time. Of course, we should also see how to make a decision on the actual situation at that time. There is no absolute difference between good and bad between the two.
About the comparison between the two, "if you come to a city and have to do several things in different parts of the city, you have two options in terms of transportation: one is to hire a chauffeured car, which will take you from A to B. waiting for you to finish your business in B, you are taking you from B to C. Another option is to call the taxi company to book a taxi, first take you from A to B, then you and the taxi do what you have to do, you do your business, the taxi goes to pick up other business, and when your business in B is done, you book a taxi with the taxi company, and the taxi company will contact other taxis near B to pick you up.
First of all, the setting of dedicated servers is very simple-there is no need to set it, this is the default option for oracle
For shared servers, you need to make some additional settings, when it is not difficult to follow administrator guide, the key is that you need to decide how many shared server servers and how many dispatcher you need, which not only requires experience, but also requires continuous observation and adjustment.
In dedicated servers, all your waits are waiting for the database itself, while in shared servers you may need to wait for an available shared server process.
Obviously, when users have a large number of concurrent connections, the number of server process of dedicated servers will also become very large. For the operating system, one more process means a little more administrative burden, knowing that the number of simultaneous concurrency supported by the operating system is not unlimited. This means that in dedicate servers, when you have a large number of user connections (for example, more than 5000 users at a time), your system burden will be quite heavy. In this case, shared servers can handle it relatively well, because 5000 users are connected at the same time, and we know that only 1% of the connections are active, so we only need to set 50 shared servers to handle all user requests well and save system resources.
As a benefit, shared servers can be used to control concurrent. It is important to know that the number of users' concurrency is by no means proportional to the processing capacity of the system (as shown in the figure below). When the number of users' concurrency exceeds a threshold, the processing capacity of the system will decrease significantly. Through shared servers, the concurrent of the system can be controlled not to exceed this threshold.
Before the introduction of automatic management of PGA, shared servers saved more memory than dedicated servers, but after the introduction of automatically managed PGA, the advantage of shared servers is not as obvious as we thought.
Dedicate servers A server process works long hours for a larger request without affecting other users, while in shared servers, some larger request will affect other users.
There are other factors to consider, for example, if you use weblogic's connecting pool on the front end, it may not be necessary for you to use shared servers in database level, because your user connection is already controlled at the weblogic level.
Shared servers also has a so-called pseudo-deadlock problem, which can be found in tom's new book.
We have discussed so much about dedicated servers and shared servers, and finally give you a hint: in fact, dedicated servers and shared servers can co-exist, in fact, even if you use shared servers, some management operations must be done in dedicated mode, such as startup or shutdown database. If it's really hard for you to choose, if your application may be partly OLTP (with a large number of users) and partly DW, you can actually consider using both dedicated servers and shared servers.
"
View the operation:
Idle > show parameter shared_server mts_servers
NAME_COL_PLUS_SHOW_PARAM TYPE
-
VALUE_COL_PLUS_SHOW_PARAM
-
Max_shared_servers integer
twenty
Shared_server_sessions integer
one hundred and sixty five
Shared_servers integer
one
-- dedicated mode if VALUE_COL_PLUS_SHOW_PARAM is greater than 0
Idle > select p.programmins.server from v$session s, v$process p
2 where s.paddr = p.addr
3
PROGRAM SERVER
Oracle@infa (PMON) DEDICATED
Oracle@infa (DBW0) DEDICATED
Oracle@infa (LGWR) DEDICATED
Oracle@infa (CKPT) DEDICATED
Oracle@infa (SMON) DEDICATED
Oracle@infa (RECO) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
Oracle@infa (TNS V1-V3) DEDICATED
15 rows selected.
Mode switching:
The connection established by the client.
If the server is in dedicated mode, it is useless for the client to modify it.
The server's way to switch between proprietary and shared modes is to modify the parameters in the parameter file.
Sample
Trace
In most cases, we prefer or get used to dedicated mode, in which the allocation of sga, etc., will be different, so if you switch to mts mode, don't forget that sga also needs to be adjusted. The most typical is that the mts mode requires a larger large_pool_size. If you really want to convert, you should take a closer look at oracle's documentation on mts. The shared connection only puts the connection SESSION information in the LARGE POOL, so the LARGE POOL is larger. The SESION information for the private connection is placed in the PGA.
Note:
1. If it is a dedicated server, the client can only create a dedicated server connection
two。 If it is shared server, the client can create dedicated server connection and shared server connection, as long as the server=dedicated or server=shared is specified in the service name.
So much for sharing the difference between session and process in Oracle. I hope the above content can be helpful to everyone and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.