Oracle programming Art Study Notes (4)-Oracle Architecture

Source: Internet
Author: User

Relationship between instances and databases
The database can be loaded and opened by multiple instances, and the instance can load and open a database at any time point.
· An instance is a group of background processes (Unix/Linux), threads (Windows), and shared memory.
· A database is a collection of data stored on disks.
· An instance can only load and open one database for a lifetime.
· The database can be loaded and opened by one or more instances (using RAC.

 

Dedicated server mode and Shared Server Mode
The two most common ways for Oracle servers to process requests are the dedicated server connection and shared server ).
An Oracle instance can use these two types of connections at the same time (in fact, even if it is configured to use a shared server connection, Oracle databases always support dedicated server connections ).


In dedicated server mode, when a customer logs on, Oracle will always create a new process, which will provide specialized services during session survival. A new dedicated server will appear for each session, and there is a one-to-one ing between the session and the dedicated server. As defined, this dedicated server is not part of the instance. The customer process (that is, the program that wants to connect to the database) will directly communicate with the dedicated server through a certain network channel (such as TCP/IP socket, the server process receives and executes the client's SQL statements.

A shared server is a Multi-Threaded Server or MTS. If this method is used, no other thread or new UNIX process will be created for each user connection. On the Shared Server, Oracle uses a "shared process" pool to provide services for a large number of users. A Shared Server is actually a connection pool mechanism.
In Shared Server mode, a customer process communicates with a scheduler process over the network, and the customer connects to send a request to the scheduler. The scheduler first places the request in the Request queue (①) in the SGA. The first available Shared Server retrieves this request from the request queue ② and processes it. After the Shared Server completes processing, place the response (return code, data, etc.) in the response queue ③. Then the scheduler obtains the response ④ and sends it back to the customer.

In dedicated server mode, because of one-to-one ing, you do not have to worry that long-running transactions will block other transactions. Therefore, in a non-OLTP environment, that is, when a transaction may run for a long time, you should only consider using this mode. Dedicated servers are recommended for Oracle and can be scaled out and down.
The Shared Server is only applicable to OLTP systems, which features short transactions and frequent transactions.
When a Shared Server is used, there may be a manual deadlock (artificial deadlock ). Consider the following situation,
There are five shared servers and 100 user sessions are established,
Assume that a user session updates a row but does not submit it,
At this time, another five user sessions may attempt to lock this row, and these five sessions will be blocked,
Now, the original user session (which holds the lock for this row) tries to commit the transaction and release the row lock accordingly, however, all the shared servers are monopolized by the five pending sessions,
This leads to an artificial deadlock: the lock owner will never be able to use the Shared Server to complete the submission, unless a waiting session abandons its Shared Server.

If the connection pool feature is already used in the application, do not use the sharing mode.

DRCP
After 11 GB, introduce DRCP in the database resident connection pool. Some application APIs do not provide efficient connection pools, and DRCP provides one for them. DRCP combines the dedicated server mode and Shared Server mode. It provides a server connection pool, but the dedicated server is put into the connection pool.
In Shared Server mode, a session may use multiple shared servers. However, in DRCP, the dedicated server process selected from the connection pool is dedicated to the customer process throughout the session lifecycle.

TNS Listener
Use SQL * Plus to connect to Oracle, for example, the following command:
Sqlplus scott/tiger @ orcl
Orcl is a TNS service name. TNS stands for the bottom layer of the Transparent Network (Transparent Network Substrate). This is the "basic" software for Handling Remote connections in Oracle customers. With this software, it is possible to establish peer-to-peer communication.
The TNS connection string tells the Oracle software how to connect to a remote database. Generally, the customer software reads a tnsnames. ora file. This is a plain text configuration file, which is usually stored in the [ORACLE_HOME] \ network \ admin directory.
In a network environment, the server runs a process called a TNS Listener. When the listener receives an inbound connection request, it checks the request using its own configuration file and establishes a connection.
If a dedicated server connection is established, the listener process creates a dedicated server for us. If it is a shared server connection request, the listener process knows which schedulers are running in the instance. After receiving the connection request, the listener selects a scheduler process from the available scheduler pool. The listener returns the connection information to the client, indicating how the client connects to the scheduler process. If possible, the listener can forward the connection to the scheduler process.

 


From: NowOrNever

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.