Configure an Oracle Shared Server

Source: Internet
Author: User
Tags dedicated server

There are two main ways for users to connect to the oracle database server: private server connection and shared server connection.

In VPC mode, when the client sends a request to connect to the database, the listener is responsible for connecting the client to the VPC process, which serves only the user process of the session, even if it is idle. VPC processes correspond to user processes one by one. Each server process uses system resources, including the CPU cycle and memory.

In a high-load system, because the VPC process occupies memory and CPU resources, it will have a negative impact on the scalability of the system, therefore, the client usually needs to connect to the Apsara stack server of the database through the middleware connection pool or the sharing server of the database.

650) this. width = 650; "src =" http://img1.51cto.com/attachment/201309/154517541.jpg "title =" dedicate.jpg "alt =" 154517541.jpg"/>

In Shared Server mode, client user process connection requests are sent to the dispatch process (dispatcher) with the smallest load by the listener, the scheduling process is responsible for transmitting user requests to a common request queue in SGA. The idle sharing server process completes the user requests in the Request queue and puts the results in the response queue. Finally, the scheduling process retrieves the results in the response queue and returns them to the user process.

The connection between the session and the scheduling process persists during the session, while the connection with the listener is short. All scheduling processes share a public request queue, but each scheduling process has an independent response queue.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/213I42008-1.jpg "title =" shared_server.jpg "alt =" 154559197.jpg"/>

Configure the Shared Server

On the server side, the Shared Server is irrelevant to the database, but only to the instance. By dynamically registering an instance, listeners are automatically configured for the shared server.

The shared server requires two required parameters: dispatchers and shared_servers.

The dispatchers parameter controls the number of scheduling processes started in the instance and the behavior of these processes (protocol type, etc.). The max_dispatchers parameter specifies the maximum number of scheduling processes that can be started.

The shared_servers parameter controls the number of shared server processes started in the instance. The max_shared_servers parameter specifies the maximum number of processes that can be started on the Shared Server. The default value is 1/8 of the processers parameter value.

$ Grep-A 5 APPLE $ TNS_ADMIN/tnsnames. oraAPPLE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.90) (PORT = 1522) SQL>! Ps aux | grep ora_s0 .. _ orcl | grep-v greporacle 5223 0.0 1.0 666136 15028? Ss → show parameter dispatchersNAME type value =----------- revoke dispatchers string (PROTOCOL = TCP) (SERVICE = orclXDB) max_dispatchers integerSQL> alter system set dispatchers = '(PROTOCOL = TCP) (dispatchers = 3) '; // create three scheduling processes: D000, D001, and D002SQL> select name, network, paddr, status from v $ dispatcher; NAME NETWORK PADDR STA TUS ----- certificate -------------------- ---------------- D000 (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g.example.com) (PORT = 62238) cannot route 7ac8aff0 WAITD001 (ADDRESS = (PROTOCOL = tcp) (PORT = 54626) Route route 7ac8c030 WAITD002 (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g.example.com) (PORT = 16374) Route route 7ac8d070 WAITSQL>! Ps aux | grep ora_d0 .. _ orcl | grep-v greporacle 9303 0.0 1.0 666976 15992? Ss ora_d000_orcloracle 9392 0.0 1.0 666976? Ss ora_d0020.orcloracle 9396 0.0 1.0 666976 16004? Ss ora_d002_orclSQL> alter system set shared_servers = 6; // create 6 response queues S000 ~ S005 (usually a multiple of dispatchers) SQL> select name, paddr, status, circuit from v $ shared_server; NAME PADDR STATUS CIRCUIT ---- ---------------- -------------- ------------------ S000 worker WAIT (COMMON) 00S001 WAIT (COMMON) 00S002 000000007AC90130 WAIT (COMMON) 00S003 000000007AC91170 WAIT (COMMON) 00S004 0000wait (COMMON) 00S005 000000007AC94230 WAIT (COMMON) 00SQL>! Ps aux | grep ora_s0 .. _ orcl | grep-v greporacle 5223 0.0 1.0 666136 15028? Ss ora_s000_orcloracle 6692 0.1 1.0 666136? Ss ora_s001_orcloracle 6696 0.1 1.0 666136 15028? Ss ora_s002_orcloracle 6700 0.0 1.0 666136? Ss ora_s003_orcloracle 6704 0.1 1.0 666136? Ss ora_s004_orcloracle 6708 0.1 1.0 666136? Ss ora_s005_orclSQL> alter system set dispatchers = '(PROTOCOL = TCP) (dispatchers = 3) (listener = apple )'; // register dispathers to the LISTENER1 listener. SQL>! Lsnrctl service listener1 --------------- omitted output --------------- Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.90) (PORT = 1522) Services Summary... service "orcl.example.com" has 1 instance (s ). instance "orcl", status READY, has 4 handler (s) for this service... handler (s): "DEDICATED" established: 0 refused: 0 state: ready local server "D002" established: 0 refused: 0 current: 0 max: 972 state: ready DISPATCHER <machine: ora11g.example.com, pid: 4987> (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g.example.com) (PORT = 16374) "D001" established: 0 refused: 0 current: 0 max: 972 state: ready DISPATCHER <machine: ora11g.example.com, pid: 4983> (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g.example.com) (PORT = 54626 )) "D000" established: 0 refused: 0 current: 1 max: 972 state: ready DISPATCHER <machine: ora11g.example.com, pid: 4979> (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g.example.com) (PORT = 62238) The command completed successfully

Connect the client to the Shared Server

When the private server mode and the Shared Server Mode coexist, EZCONNECT generally selects the Shared Server Mode for connection.

$ Sqlplus/nologSQL * Plus: Release 11.2.0.1.0 Production on Thu Sep 12 16:07:18 2013 Copyright (c) 1982,200 9, Oracle. all rights reserved. SQL> conn/as sysdbaConnected. SQL> alter system set local_listener = ''; // change the LISTENER back to the default" LISTENER "System altered. SQL> alter system set dispatchers = '(PROTOCOL = TCP) (dispatchers = 3)'; // register the scheduler to the "LISTENER" listening System altered. SQL>! The lsnrctl service // LISTENER has the Shared Server mode and dedicated server mode --------------- omitted output --------------- Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = ora11g.example.com) (PORT = 1521) Services Summary... service "+ ASM" has 1 instance (s ). instance "+ ASM", status READY, has 1 handler (s) for this service... handler (s): "DEDICATED" established: 0 refused: 0 state: ready LOCAL SERVERService "orcl.example.com" has 1 instanc E (s ). instance "orcl", status READY, has 4 handler (s) for this service... handler (s): "DEDICATED" established: 3 refused: 0 state: ready local server "D002" established: 0 refused: 0 current: 0 max: 972 state: ready DISPATCHER <machine: ora11g.example.com, pid: 4987> (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g.example.com) (PORT = 16374) "D001" established: 0 refused: 0 current: 0 max: 972 state: ready DISPATCHER <machi Ne: ora11g.example.com, pid: 4983> (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g.example.com) (PORT = 54626) "D000" established: 0 refused: 0 current: 0 max: 972 state: ready DISPATCHER <machine: ora11g.example.com, pid: 4979> (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g.example.com) (PORT = 62238) SQL>! Grep-A 10 ORCL $ TNS_ADMIN/tnsnames. oraORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.0.90) (PORT = 1521) (CONNECT_DATA = (SERVER = SHARED) // set the TNSNAMES connection mode to the Shared Server mode (SERVICE_NAME = orcl.example.com )))

Connect using TNSNAMES:

SQL> conn sys/oracle_4U @ orcl as sysdbaConnected. SQL>! Ps pid tty time cmd 6307 pts/1 00:00:00 sqlplus 6528 pts/1 00:00:00 psSQL> select server, port from v $ session where terminal = 'pts/1 '; // The Connection Mode of the current session is shared and the source PORT is 15707 server port --------- ---------- SHARED 15707SQL> select p. spid, p. pname from v $ process p, v $ circuit c where c. dispatcher = p. addr; // a virtual loop is generated to connect to the scheduler D000SPID PNAME ---------------------- ----- 4979 D000

Connect using EZCONNECT:

SQL> conn sys/oracle_4U@192.168.0.90: 1521/orcl.example.com as sysdbaConnected. SQL> select server, port from v $ session where terminal = 'pts/1 '; // The Connection Mode of the current session is shared and the source PORT is 15784 server port --------- ---------- SHARED 15784SQL> select p. spid, p. pname from v $ process p, v $ circuit c where c. dispatcher = p. addr; // a virtual loop is generated to connect to the scheduler D001SPID PNAME ---------------------- ----- 4983 D001SQL>! Ps aux | grep 4983 | grep-v greporacle 4983 0.0 1.1 666908? Ss ora_d001_orclSQL>! Netstat-ntp | grep 15784 (Not all processes cocould be identified, non-owned process info will not be shown, you wowould have to be root to see it all .) tcp 0 0 192.168.0.90: 1521 192.168.0.90: 15784 ESTABLISHED-tcp 0 0 192.168.0.90: 15784 192.168.0.90: 1521 ESTABLISHED 7420/sqlplus


This article from the "ghost fireworks smile" blog, please be sure to keep this source http://vnimos.blog.51cto.com/2014866/1296455

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.