CSDN博客

img lunar2000

管理共享服务器

发表于2004/7/9 10:58:00  1363人阅读

为什么使用共享服务器?

对于共享服务器(MTS),其最大的优点就在于不需要给每个连接都创建相应的专用服务器进程,因而共享服务器体系结构保持了运行实例所需的最少数目的进程。

 

在共享服务器(MTS)中,我们也可以使用配置为专用服务器的网络服务名称(即,网络服务名称的值应该在连接描述符中包括SERVER=DEDICATED 子句)实现专用服务器连接的方式。

 

当然,对于以下两种情况,要求必须使用专用服务器连接到实例中:

1.       使用RMAN时,必须使用专用服务器方式连接数据库

2.       批处理作业时

 

影响共享服务器配置的初始化参数

DISPATCHERS

这是配置共享服务器所必须的参数,该参数指示了系统启动时开始运行的调度进程的描述,。如果要使用多个调度进程,需要连续设置多个DISPATCHERS,例如:

 

SQL> select name , network from v$dispatcher;

 

NAME NETWORK

--------------------------------------------------------------------------------

 

SQL> ALTER SYSTEM SET DISPATCHERS="(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1))(DISPATCHERS=3)";

 

System altered

 

SQL> select name , network from v$dispatcher;

 

NAME NETWORK

--------------------------------------------------------------------------------

D000 (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1094))

D001 (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1095))

D002 (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1096))

 

SQL>

 

使用这个参数设置将启动三个调度进程,这两个调度程序将在IP地址为本机进行监听。注意HOST选项中指定的IP必须是实际存在的有效IP

 

这个参数可以使用ALTER SYSTEM SET DISPATCHERS命令动态的修改,可以添加的最多的DISPATCHERS数目由参数MAX_DISPATCHERS决定。例如:

 

ALTER SYSTEM SET DISPATCHERS

 = ‘(PROTOCOL=TCP)(DISPATCHERS=5)(INDEX=1)’;

 

这个例子中第一个设置告诉数据库修改参数文件中的第2DISPATCHERS的设置,使之为TCP/IP协议使用5DISPATCHERS,如果当前的调度进程少于5个,那么系统会增加调度进程到5个,如果当前哦调度进程大于5个,那么系统不能立即删除多余的调动进程,Oracle只能在用户断开连接后,才将DISPATCHERS的数目减少到5个。

 

    DISPATCHERS数目设置的太高或者太低都不利于系统的性能,通过查询V$QUEUEV$DISPATCHERSV$DISPATCHER_RATE,我们就可以确定是否需要增加调度进程,或者需要减少调度进程。通常如果调度进程的装载量很高,那么增加新的调度进程可能会提高性能;如果装载量很低,那么减少调度进程会提高性能。对于大多数应用,每1000个连接分配一个DISPATCHERS就可以了。

 

MAX_DISPATCHERS

指定系统中同时运行的调度进程的最大数目,这个参数是静态参数,缺省值是5

SHARED_SERVERS 数目

指定启动实例时需要创建的共享服务器进程的数目,Oracle 将根据请求队列的长度动态调整共享服务器进程的数目,最多可创建的共享服务器的数目由参数MAX_SHARED_SERVERS决定。

SHARED_SERVERS缺省值是1,如果不希望使用共享服务器结构,那么可以将这个参数值设置为0。该参数是个动态参数,可以ALTER SYSTEM命令动态的调整。一般来说,10 个连接分配一个共享服务器就可以了。

 

这个参数可以使用ALTER SYSTEM SET SHARED_SERVERS命令动态的修改,例如:

 

ALTER SYSTEM SET SHARED_SERVERS=0;

上述命令将终止所有的空闲的共享服务器进程。

 

MAX_ SHARED_SERVERS

指定系统中可以同时运行的共享服务器进程的最大数目,这个参数是静态参数

CIRCUITS

这是一个静态参数,如果使用共享服务器结构,用那么这个参数指定进出网络会话时可以利用的虚拟回路的总数;如果不使用共享服务器结构,那么这个参数为0

SHARED_SERVER_SESSIONS

指定共享服务器结构中允许的用户会话的总数,设置这个参数可以为专用服务器保留用户会话。这是一个静态参数,其取值范围在0SESSIONS-5之间。

 

LARGE_POOL_SIZE

由于在MTS中,UGA需要从LARGE_POOL_SIZE中分配,因此需要将这个参数的值指定为一个较大的值,以满足应用的需求。将该值设置的太低或太高都会影响系统的性能。

 

SESSIONS

指定系统可以创建的session的最大数目。该参数的缺省值是PROCESS*1.1+5,例如,PROCESS150(缺省值),那么SESSIONS的值为150*1.1+5 = 170

 

 

监视共享服务器

经常用开监视共享服务器的试图有9个:

V$DISPATCHER

包含有关调度进程的信息,包括DISPATCHERS的名称,DISPATCHERS的网址,进程地址,状态等各种信息。

 

列名

数据类型

描述

NAME

VARCHAR2(4)

Name of the dispatcher process

NETWORK

VARCHAR2(128)

Network address of the dispatcher

PADDR

RAW(4 | 8)

Process address

STATUS

VARCHAR2(16)

Status of the dispatcher:

  • WAIT - Idle
  • SEND - Sending a message
  • RECEIVE - Receiving a message
  • CONNECT - Establishing a connection
  • DISCONNECT - Handling a disconnect request
  • BREAK - Handling a break
  • TERMINATE - In the process of terminating
  • ACCEPT - Accepting connections (no further information available)
  • REFUSE - Rejecting connections (no further information available)

ACCEPT

VARCHAR2(3)

Indicates whether this dispatcher is accepting new connections (YES) or not (NO)

MESSAGES

NUMBER

Number of messages processed by the dispatcher

BYTES

NUMBER

Size (in bytes) of messages processed by the dispatcher

BREAKS

NUMBER

Number of breaks occurring in the connection

OWNED

NUMBER

Number of circuits owned by the dispatcher

CREATED

NUMBER

Number of circuits created by the dispatcher

IDLE

NUMBER

Total idle time for the dispatcher (in hundredths of a second)

BUSY

NUMBER

Total busy time for the dispatcher (in hundredths of a second)

LISTENER

NUMBER

Most recent Oracle error number the dispatcher received from the listener

CONF_INDX

NUMBER

Zero-based index of the DISPATCHERS configuration used by the dispatcher

 

 

 

 

V$DISPATCHER_RATE

包含调度进程的速率统计表。

 

V$QUEUE

包含有关共享服务器消息队列的信息。

 

 

列名

数据类型

描述

PADDR

RAW(4 | 8)

Address of the process that owns the queue

TYPE

VARCHAR2(10)

Type of queue:

  • COMMON - Processed by servers
  • DISPATCHER

QUEUED

NUMBER

Number of items in the queue

WAIT

NUMBER

Total time that all items in this queue have waited (in hundredths of a second). Divide by TOTALQ for average wait per item.

TOTALQ

NUMBER

Total number of items that have ever been in the queue

 

 

 

 

 

V$SHARED_SERVER

包含有关共享服务器进程的信息。

 

列名

数据类型

描述

NAME

VARCHAR2(4)

Name of the server

PADDR

RAW(4 | 8)

Server's process address

STATUS

VARCHAR2(16)

Server status:

EXEC - Executing SQL

WAIT (ENQ) - Waiting for a lock

WAIT (SEND) - Waiting to send data to user

WAIT (COMMON) - Idle; waiting for a user request

WAIT (RESET) - Waiting for a circuit to reset after a break

QUIT - Terminating

MESSAGES

NUMBER

Number of messages processed

BYTES

NUMBER

Total number of bytes in all messages

BREAKS

NUMBER

Number of breaks

CIRCUIT

RAW(4 | 8)

Address of circuit currently being serviced

IDLE

NUMBER

Total idle time (in hundredths of a second)

BUSY

NUMBER

Total busy time (in hundredths of a second)

REQUESTS

NUMBER

Total number of requests taken from the common queue in this server's lifetime

 

 

 

V$CIRCUIT

包含有关虚拟回路的信息,这些虚拟回路是一些通过调度程序和服务器连接到数据库的用户连接。

 

列名

数据类型

描述

CIRCUIT

RAW(4 | 8)

Circuit address

DISPATCHER

RAW(4 | 8)

Current dispatcher process address

SERVER

RAW(4 | 8)

Current server process address

WAITER

RAW(4 | 8)

Address of server process that is waiting for the (currently busy) circuit to become available

SADDR

RAW(4 | 8)

Address of session bound to the circuit

STATUS

VARCHAR2(16)

Status of the circuit:

  • BREAK - currently interrupted
  • EOF - about to be removed
  • OUTBOUND - an outward link to a remote database
  • NORMAL - normal circuit into the local database

QUEUE

VARCHAR2(16)

Queue the circuit is currently on:

  • COMMON - on the common queue, waiting to be picked up by a server process
  • DISPATCHER - waiting for the dispatcher
  • SERVER - currently being serviced
  • NONE - idle circuit

MESSAGE0

NUMBER

Size in bytes of the messages in the first message buffer

MESSAGE1

NUMBER

Size in bytes of the messages in the second message buffer

MESSAGE2

NUMBER

Size in bytes of the messages in the third message buffer

MESSAGE3

NUMBER

Size in bytes of the messages in the fourth message buffer

MESSAGES

NUMBER

Total number of messages that have gone through this circuit

BYTES

NUMBER

Total number of bytes that have gone through this circuit

BREAKS

NUMBER

Total number of breaks (interruptions) for this circuit

PRESENTATION

VARCHAR2(16)

The presentation protocol used by the client and server

 

 

 

 

V$SHARED_SERVER_MONITOR

包含用来调整共享服务器进程的信息。

列名

数据

类型

描述

MAXIMUM_CONNECTIONS

NUMBER

Highest number of virtual circuits in use at one time since the instance started. If this value reaches the value set for the CIRCUITS initialization parameter, then consider raising the value of CIRCUITS.

MAXIMUM_SESSIONS

NUMBER

Highest number of shared server sessions in use at one time since the instance started. If this reaches the value set for the SHARED_SERVER_SESSIONS initialization parameter, then consider raising the value of SHARED_SERVER_SESSIONS.

SERVERS_STARTED

NUMBER

Total number of shared servers started since the instance started (but not including those started during startup)

SERVERS_TERMINATED

NUMBER

Total number of shared servers stopped by Oracle since the instance started

SERVERS_HIGHWATER

NUMBER

Highest number of servers running at one time since the instance started. If this value reaches the value set for the MAX_SHARED_SERVERS initialization parameter, then consider raising the value of SHARED_SERVERS.

 

 

V$SGA

包含SGA 中各种内存结构的统计信息。

列名

数据类型

描述

NAME

VARCHAR2(20)

SGA component group

VALUE

NUMBER

Memory size (in bytes)

 

 

 

V$SGASTAT

包含SGA 中各种内存结构的详细信息。

列名

数据类型

描述

NAME

VARCHAR2(26)

SGA component name

BYTES

NUMBER

Memory size in bytes

POOL

VARCHAR2(11)

Designates the pool in which the memory in NAME resides:

  • large pool - memory is allocated from the large pool
  • shared pool - memory is allocated from the shared pool
  • java pool - memory is allocated from the Java pool

 

 

V$SHARED_POOL_RESERVED

这个视图使用来调整共享池中的保留池(RESERVED POOL)和存储空间的。只有当初始化参数设置了SHARED_POOL_RESERVED_SIZE参数后,这个试图的信息才可用。

 

列名

数据

类型

描述

FREE_SPACE

NUMBER

Total amount of free space on the reserved list

AVG_FREE_SIZE

NUMBER

Average size of the free memory on the reserved list

FREE_COUNT

NUMBER

Number of free pieces of memory on the reserved list

MAX_FREE_SIZE

NUMBER

Size of the largest free piece of memory on the reserved list

USED_SPACE

NUMBER

Total amount of used memory on the reserved list

AVG_USED_SIZE

NUMBER

Average size of the used memory on the reserved list

USED_COUNT

NUMBER

Number of used pieces of memory on the reserved list

MAX_USED_SIZE

NUMBER

Size of the largest used piece of memory on the reserved list

REQUESTS

NUMBER

Number of times that the reserved list was searched for a free piece of memory

REQUEST_MISSES

NUMBER

Number of times the reserved list did not have a free piece of memory to satisfy the request, and started flushing objects from the LRU list

LAST_MISS_SIZE

NUMBER

Request size of the last request miss, when the reserved list did not have a free piece of memory to satisfy the request and started flushing objects from the LRU list

MAX_MISS_SIZE

NUMBER

Request size of the largest request miss, when the reserved list did not have a free piece of memory to satisfy the request and started flushing objects from the LRU list

The following columns of V$SHARED_POOL_RESERVED contain values which are valid even if shared_pool_reserved_size is not set.

REQUEST_FAILURES

NUMBER

Number of times that no memory was found to satisfy a request (that is, the number of times the error ORA-04031 occurred)

LAST_FAILURE_SIZE

NUMBER

Request size of the last failed request (that is, the request size for the last ORA-04031 error)

ABORTED_REQUEST_THRESHOLD

NUMBER

Minimum size of a request which signals an ORA-04031 error without flushing objects

ABORTED_REQUESTS

NUMBER

Number of requests that signalled an ORA-04031 error without flushing objects

LAST_ABORTED_SIZE

NUMBER

Last size of the request that returned an ORA-04031 error without flushing objects from the LRU list

 

关闭调度进程

如果关闭某个指定的调度进程,首先需要从V$DISPATCHER试图找到需要关闭的调度进程:

SQL> select name , network from v$dispatcher;

 

NAME NETWORK

--------------------------------------------------------------------------------

D000 (ADDRESS=(PROTOCOL=tcp)(HOST=lunar)(PORT=1040))

 

SQL>

 

 

然后使用ALTER SYSTEM 命令关闭该调度进程:

SQL> ALTER SYSTEM SHUTDOWN IMMEDIATE 'D000';

 

System altered

 

SQL> select name , network from v$dispatcher;

 

NAME NETWORK

--------------------------------------------------------------------------------

 

SQL>

 

 

0 0

相关博文

我的热门文章

img
取 消
img