程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> oracle shared server配置

oracle shared server配置

編輯:Oracle教程

oracle shared server配置


1、獨占服務器(dedicatedserver)   每一個session單獨分配一個serverprocess,直到用戶斷開連接,才釋放該進程所占用的資源。而大多數時候session都是idle的,所以存在占用資源的情況。   在有些情況下,必須使用獨占服務器模式:(本地連接)  
SQL> select username,SERVER,PROGRAM,OSUSER,MACHINEfrom v$session where username is not null;
  
USERNAME                       SERVER    PROGRAM                                         OSUSER                        MACHINE
------------------------------ --------------------------------------------------------- ------------------------------------------------------------
SYS                            DEDICATEDsqlplus@ora11g (TNS V1-V3)                      oracle                        ora11g

 

2、shared server特點   共享服務器響應用戶請求的步驟如下:   1) 客戶傳送一個請求到調度程序。   2) 調度程序將請求放在SGA中的請求隊列中(share pool 或 large pool)。   3) 其中的一個共享服務器進程響應並處理這個請求。   4) 共享服務器進程把處理完的請求回復放到SGA中的響應隊列中。   5) 調度器從響應隊列中取出已經完成的請求。   6) 調度器把完成的請求回復給客戶   關於SGA的請求和相應隊列以及Dispatcher,具有如下的一些特點:   1)在SGA中只有一個請求隊列。   2)共享服務器監控請求隊列的使用情況。   3)請求隊列遵循先進先出(FIFO)的原則。   4)共享服務器將已經完成的請求放在提交該請求的dispatcher所對應的response隊列中。   5)每一個dispatcher在SGA中都由一個對應的response隊列。   6)Dispatcher需要負責將完成的請求回復給相應的用戶進程。   7)在同一個session中,用戶進程始終連接的是同一個Dspatcher。   3、配置shared server   1)、配置dispatchs  
SQL> alter system setdispatchers="(PROTOCOL=tcp)(DISPATCHERS=5)";
  
System altered.
  
SQL> show parameters dispa
  
NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
dispatchers                         string      (PROTOCOL=tcp)(DISPATCHERS=5)
max_dispatchers                      integer
  
oracle  21441     1  0 15:22 ?        00:00:00 ora_pmon_prod
oracle  21443     1  0 15:22 ?        00:00:00 ora_psp0_prod
oracle  21445     1  1 15:22 ?        00:00:14 ora_vktm_prod
oracle  21449     1  0 15:22 ?        00:00:00 ora_gen0_prod
oracle  21451     1  0 15:22 ?        00:00:00 ora_diag_prod
oracle  21453     1  0 15:22 ?        00:00:00 ora_dbrm_prod
oracle  21455     1  0 15:22 ?        00:00:00 ora_dia0_prod
oracle  21457     1  0 15:22 ?        00:00:00 ora_mman_prod
oracle  21459     1  0 15:22 ?        00:00:00 ora_dbw0_prod
oracle  21461     1  0 15:22 ?        00:00:00 ora_dbw1_prod
oracle  21463     1  0 15:22 ?        00:00:00 ora_lgwr_prod
oracle  21465     1  0 15:22 ?        00:00:00 ora_ckpt_prod
oracle  21467     1  0 15:22 ?        00:00:00 ora_smon_prod
oracle  21469     1  0 15:22 ?        00:00:00 ora_reco_prod
oracle  21471     1  0 15:22 ?        00:00:01 ora_mmon_prod
oracle  21473     1  0 15:22 ?        00:00:00 ora_mmnl_prod
oracle  21475     1  0 15:22 ?        00:00:00 ora_d000_prod
oracle  21477     1  0 15:22 ?        00:00:00 ora_s000_prod
oracle  21485     1  0 15:23 ?        00:00:00 ora_qmnc_prod
oracle  21514     1  0 15:23 ?        00:00:00 ora_q000_prod
oracle  21516     1  0 15:23 ?        00:00:00 ora_q001_prod
oracle  21862     1  0 15:33 ?        00:00:00 ora_smco_prod
oracle  21881     1  0 15:33 ?        00:00:00 ora_w000_prod
oracle  21972     1  0 15:35 ?        00:00:00 ora_d001_prod  --調度進程啟用
oracle  21974     1  0 15:35 ?        00:00:00 ora_d002_prod
oracle  21976     1  0 15:35 ?        00:00:00 ora_d003_prod
oracle  21978     1  0 15:35 ?        00:00:00 ora_d004_prod

 

   2)、配置sharedserver
SQL> alter system set shared_servers=10;
  
System altered.
  
oracle  21441     1  0 15:22 ?        00:00:00 ora_pmon_prod
oracle  21443     1  0 15:22 ?        00:00:00 ora_psp0_prod
oracle  21445     1  1 15:22 ?        00:00:16 ora_vktm_prod
oracle  21449     1  0 15:22 ?        00:00:00 ora_gen0_prod
oracle  21451     1  0 15:22 ?        00:00:00 ora_diag_prod
oracle  21453     1  0 15:22 ?        00:00:00 ora_dbrm_prod
oracle  21455     1  0 15:22 ?        00:00:00 ora_dia0_prod
oracle  21457     1  0 15:22 ?        00:00:00 ora_mman_prod
oracle  21459     1  0 15:22 ?        00:00:00 ora_dbw0_prod
oracle  21461     1  0 15:22 ?        00:00:00 ora_dbw1_prod
oracle  21463     1  0 15:22 ?        00:00:00 ora_lgwr_prod
oracle  21465     1  0 15:22 ?        00:00:00 ora_ckpt_prod
oracle  21467     1  0 15:22 ?        00:00:00 ora_smon_prod
oracle  21469     1  0 15:22 ?        00:00:00 ora_reco_prod
oracle  21471     1  0 15:22 ?        00:00:01 ora_mmon_prod
oracle  21473     1  0 15:22 ?        00:00:00 ora_mmnl_prod
oracle  21475     1  0 15:22 ?        00:00:00 ora_d000_prod
oracle  21477     1  0 15:22 ?        00:00:00 ora_s000_prod
oracle  21485     1  0 15:23 ?        00:00:00 ora_qmnc_prod
oracle  21514     1  0 15:23 ?        00:00:00 ora_q000_prod
oracle  21516     1  0 15:23 ?        00:00:00 ora_q001_prod
oracle  21862     1  0 15:33 ?        00:00:00 ora_smco_prod
oracle  21881     1  0 15:33 ?        00:00:00 ora_w000_prod
oracle  21972     1  0 15:35 ?        00:00:00 ora_d001_prod
oracle  21974     1  0 15:35 ?        00:00:00 ora_d002_prod
oracle  21976     1  0 15:35 ?        00:00:00 ora_d003_prod
oracle  21978     1  0 15:35 ?        00:00:00 ora_d004_prod
oracle  22098     1  0 15:38 ?        00:00:00 ora_s001_prod
oracle  22100     1  0 15:38 ?        00:00:00 ora_s002_prod
oracle  22102     1  0 15:38 ?        00:00:00 ora_s003_prod
oracle  22104     1  0 15:38 ?        00:00:00 ora_s004_prod
oracle  22106     1  0 15:38 ?        00:00:00 ora_s005_prod
oracle  22108     1  0 15:38 ?        00:00:00 ora_s006_prod  --server進程啟動
oracle  22110     1  0 15:38 ?        00:00:00 ora_s007_prod
oracle  22112     1  015:38 ?        00:00:00 ora_s008_prod
oracle  22114     1  0 15:38 ?        00:00:00 ora_s009_prod

 

3)客戶端配置   在Oracle server 啟動listener   客戶端配置tnsnames.ora  
TEST =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST=ora11g)(PORT = 1521))
 (CONNECT_DATA =
   (SEVER = SHARED)
   (SERVICE_NAME = prod)
  )
 )
  
[oracle@ora11g admin]$ tnsping test
  
TNS Ping Utility for Linux: Version11.2.0.4.0 - Production on 04-NOV-2015 15:42:39
  
Copyright (c) 1997, 2013, Oracle.  All rights reserved.
  
Used parameter files:
  
  
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST=ora11g)(PORT = 1521)) (CONNECT_DATA = (SEVER =SHARED) (SERVICE_NAME = prod)))
OK (10 msec)

 

測試:  
[oracle@ora11g admin]$ sqlplus system/oracle@test
  
SQL*Plus: Release 11.2.0.4.0 Production onWed Nov 4 15:42:49 2015
  
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
  
  
Connected to:
Oracle Database 11g Enterprise EditionRelease 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Miningand Real Application Testing options
  
SQL>
  
SQL> select username,sid,server fromv$session where username is not null;
  
USERNAME                              SID SERVER
------------------------------ -------------------
SYS                                     9 DEDICATED
SYSTEM                                 12 NONE
  
  
  
SQL> selectusername,SERVER,PROGRAM,OSUSER,MACHINE from v$session where username is notnull;
  
USERNAME                       SERVER    PROGRAM                                          OSUSER                         MACHINE
------------------------------ --------------------------------------------------------- ------------------------------------------------------------
SYS                            DEDICATEDsqlplus@ora11g (TNS V1-V3)                      oracle                        ora11g
SYSTEM                         NONE      sqlplus@ora11g (TNS V1-V3)                       oracle                         ora11g

 

  4、監控共享server  
SQL> col network for a50
SQL> select name ,NETWORK,PADDR,STATUS,ACCEPT ,idle,busy from v$dispatcher;
  
NAME NETWORK                                           PADDR            STATUS           ACC       IDLE       BUSY
------------------------------------------------------ ---------------- ------------------- ---------- ----------
D000(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g)(PORT=33225))  00000000720BA7A0 WAIT             YES     132806         0
D001(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g)(PORT=49380))  00000000720C2D60 WAIT             YES      56575          0
D002(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g)(PORT=21687))  00000000720C3E18 WAIT             YES      56572         0
D003(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g)(PORT=53218))  00000000720C4ED0 WAIT             YES      56569         0
D004 (ADDRESS=(PROTOCOL=tcp)(HOST=ora11g)(PORT=51052))  00000000720C5F88 WAIT             YES      56563          2

 

  1)在sga 中配置large pool   ---監控dispatch的使用情況,如果使用率超過50%,需要增加dispatch
SQL> selectname,(busy/(busy+idle))*100  "busyrate"  from  v$dispatcher;
  
NAME busy rate
---- ----------
D000          0
D001          0
D002          0
D003          0
D004 .003085705

 

  關注客戶請求在請求隊列中等待了多長時間,請求隊列中等待的時間越長,則說明客戶等待的時間也越長。  
SQL> select decode(totalq,0,'Norequests') "wait time",
 2   wait/totalq||'hundredths ofseconds' "Average wait time per request" 
 3   from v$queue
 4   where type='COMMON';
  
wait time  Average wait time per request
------------------------------------------------------------------------
           0hundredths of seconds
           0hundredths of seconds

 


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved