配置Oracle共享服务器
用户连接Oracle数据库服务器主要有两种方式:专有服务器连接和共享服务器连接,在专有服务器模式中,当客户端发出连接数据库的请
用户连接Oracle数据库服务器主要有两种方式:专有服务器连接和共享服务器连接
在专有服务器模式中,当客户端发出连接数据库的请求时,监听器负责把客户端连接到专有服务器进程,该专有服务器进程只为该会话的用户进程服务,即使处于空闲状态。专有服务器进程与用户进程之间是一一对应的,每个服务器进程都会使用系统资源,包括CPU周期和内存。
在负荷很高的系统中,由于专有服务器进程占用了内存和CPU资源,因而会对系统的可伸缩性产生负面影响,所以一般客户端要通过中间件的连接池连接到数据库的专有服务器,或者连接到数据库的共享服务器。
相关阅读:
Oracle 共享服务器(Shared Server/MTS)的配置简析
Oracle共享服务器的监听注册机制研究
在共享服务器模式中,客户端用户进程的连接请求将被监听器传送至负载最小的调度进程(dispatcher)中,调度进程负责将用户请求传递到SGA中一个公共的请求队列。空闲的共享服务器进程将完成请求队列中的用户请求,并将结果放到响应队列中,最后调度进程将取出响应队列中的结果返回给用户进程。
会话与调度进程的连接在会话期间持久存在,而与监听器的连接是短暂的。且所有的调度进程共享一个公共的请求队列,但是每个调度进程都具有独立的响应队列。
配置共享服务器
在服务器端,,共享服务器与数据库无关,而只与实例有关。通过实例动态注册,会为共享服务器自动配置监听器。
共享服务器需要配置两个必需的参数:dispatchers和shared_servers
dispatchers参数控制在实例中启动的调度进程数以及这些进程的行为(协议类型等),max_dispatchers参数指定了能够启动的调度进程数的上限。
shared_servers参数控制在实例中启动的共享服务器进程的数量。max_shared_servers参数指定了能够启动共享服务器进程数的上限,默认为processers参数值的1/8。
$grep -A 5 APPLE $TNS_ADMIN/tnsnames.ora
APPLE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.90)(PORT = 1522))
)
SQL> !ps aux | grep ora_s0.._orcl | grep -v grep
oracle 5223 0.0 1.0 666136 15028 ? Ss 10:21 0:00 ora_s000_orcl
SQL> show parameter dispatchers
NAME TYPE VALUE
------------------------------------ ----------- ----------------------------------
dispatchers string (PROTOCOL=TCP) (SERVICE=orclXDB)
max_dispatchers integer
SQL> alter system set dispatchers='(PROTOCOL=TCP) (dispatchers=3)'; //创建3个调度进程D000、D001、D002
SQL> select name,network,paddr,status from v$dispatcher;
NAME NETWORK PADDR STATUS
----- ----------------------------------------------------------------- -------------------- ----------------
D000 (ADDRESS=(PROTOCOL=tcp)(HOST=ora11g.example.com)(PORT=62238)) 000000007AC8AFF0 WAIT
D001 (ADDRESS=(PROTOCOL=tcp)(HOST=ora11g.example.com)(PORT=54626)) 000000007AC8C030 WAIT
D002 (ADDRESS=(PROTOCOL=tcp)(HOST=ora11g.example.com)(PORT=16374)) 000000007AC8D070 WAIT
SQL> !ps aux | grep ora_d0.._orcl | grep -v grep
oracle 9303 0.0 1.0 666976 15992 ? Ss 15:35 0:00 ora_d000_orcl
oracle 9392 0.0 1.0 666976 15976 ? Ss 15:38 0:00 ora_d001_orcl
oracle 9396 0.0 1.0 666976 16004 ? Ss 15:38 0:00 ora_d002_orcl
SQL> alter system set shared_servers=6; //创建6个响应队列S000~S005(一般为dispatchers的倍数)
SQL> select name,paddr,status,circuit from v$shared_server;
NAME PADDR STATUS CIRCUIT
---- ---------------- ---------------- ----------------
S000 000000007AC8E0B0 WAIT(COMMON) 00
S001 000000007AC8F0F0 WAIT(COMMON) 00
S002 000000007AC90130 WAIT(COMMON) 00
S003 000000007AC91170 WAIT(COMMON) 00
S004 000000007AC921B0 WAIT(COMMON) 00
S005 000000007AC94230 WAIT(COMMON) 00
SQL> !ps aux | grep ora_s0.._orcl | grep -v grep
oracle 5223 0.0 1.0 666136 15028 ? Ss 10:21 0:00 ora_s000_orcl
oracle 6692 0.1 1.0 666136 15028 ? Ss 11:13 0:00 ora_s001_orcl
oracle 6696 0.1 1.0 666136 15028 ? Ss 11:13 0:00 ora_s002_orcl
oracle 6700 0.0 1.0 666136 15032 ? Ss 11:13 0:00 ora_s003_orcl
oracle 6704 0.1 1.0 666136 15044 ? Ss 11:13 0:00 ora_s004_orcl
oracle 6708 0.1 1.0 666136 15032 ? Ss 11:13 0:00 ora_s005_orcl
SQL> alter system set dispatchers='(PROTOCOL=TCP) (dispatchers=3) (listener=apple)'; //单独将dispathers注册到LISTENER1的监听器上
SQL> !lsnrctl service listener1
---------------省略输出---------------
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
(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g.example.com)(PORT=16374))
"D001" established:0 refused:0 current:0 max:972 state:ready
DISPATCHER
(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g.example.com)(PORT=54626))
"D000" established:0 refused:0 current:1 max:972 state:ready
DISPATCHER
(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g.example.com)(PORT=62238))
The command completed successfully
更多详情见请继续阅读下一页的精彩内容:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.
