【實驗】【Shared Server Mode】取消共享伺服器模式

secooler發表於2009-07-23
【實驗目標】
共享伺服器模式     ---&gt  專有伺服器模式        
Shared Server Mode ---&gt  Dedicatied Server Mode

【方法一】需要重新啟動資料庫
中心思想:註釋掉shared_servers、max_shared_servers、dispatchers和max_dispatchers四個引數,重啟資料庫
1.生成待修改的PFILE
sys@ora10g> create pfile from spfile;

File created.

2.修改PFILE,將shared_servers、max_shared_servers、dispatchers和max_dispatchers四個引數刪除掉或註釋掉
ora10g@testdb /home/oracle$ vi $ORACLE_HOME/dbs/initora10g.ora

3.關閉資料庫
sys@ora10g> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

4.透過上面的PFILE生成SPFILE
NotConnected@> create spfile from pfile='$ORACLE_HOME/dbs/initora10g.ora';

File created.

5.重啟資料庫(這時預設使用的引數檔案已經是剛剛生成的SPFILE)
NotConnected@> startup;
ORACLE instance started.

Total System Global Area  562036736 bytes
Fixed Size                  2022312 bytes
Variable Size             163578968 bytes
Database Buffers          390070272 bytes
Redo Buffers                6365184 bytes
Database mounted.
Database opened.

6.OK,修改成功。
sec@ora10g> select server,program,status from v$session order by 1;

SERVER    PROGRAM                                          STATUS
--------- ------------------------------------------------ --------
DEDICATED oracle@testdb (q001)                             ACTIVE
DEDICATED oracle@testdb (PMON)                             ACTIVE
DEDICATED OMS                                              INACTIVE
DEDICATED OMS                                              ACTIVE
DEDICATED OMS                                              INACTIVE
DEDICATED oracle@testdb (q000)                             ACTIVE
DEDICATED OMS                                              INACTIVE
DEDICATED OMS                                              INACTIVE
DEDICATED oracle@testdb (J000)                             ACTIVE
DEDICATED oracle@testdb (QMNC)                             ACTIVE
DEDICATED oracle@testdb (ARC2)                             ACTIVE
DEDICATED oracle@testdb (ARC1)                             ACTIVE
DEDICATED oracle@testdb (ARC0)                             ACTIVE
DEDICATED sqlplus@testdb (TNS V1-V3)                       ACTIVE
DEDICATED oracle@testdb (MMNL)                             ACTIVE
DEDICATED oracle@testdb (MMON)                             ACTIVE
DEDICATED oracle@testdb (CJQ0)                             ACTIVE
DEDICATED oracle@testdb (RECO)                             ACTIVE
DEDICATED oracle@testdb (SMON)                             ACTIVE
DEDICATED oracle@testdb (CKPT)                             ACTIVE
DEDICATED oracle@testdb (LGWR)                             ACTIVE
DEDICATED oracle@testdb (DBW0)                             ACTIVE
DEDICATED oracle@testdb (MMAN)                             ACTIVE
DEDICATED oracle@testdb (PSP0)                             ACTIVE
DEDICATED emagent@testdb (TNS V1-V3)                       ACTIVE

25 rows selected.

【方法二】不需要重新啟動資料庫
中心思想:線上將shared_servers、max_shared_servers兩個引數修改為零(0)。
1.當前共享伺服器程式情況
sys@ora10g> select NAME,PADDR,STATUS,MESSAGES,BYTES from v$shared_server;

NAME PADDR            STATUS             MESSAGES      BYTES
---- ---------------- ---------------- ---------- ----------
S000 000000008165ECF0 EXEC                   2330     501830
S001 000000008165F4D8 EXEC                    111      16136
S002 000000008165FCC0 WAIT(COMMON)          12677    2929774

2.先看一下修改shared_servers引數為0的效果
sys@ora10g> alter system set shared_servers=0 scope=both;

System altered.

sys@ora10g> select NAME,PADDR,STATUS,MESSAGES,BYTES from v$shared_server;

NAME PADDR            STATUS             MESSAGES      BYTES
---- ---------------- ---------------- ---------- ----------
S000 000000008165ECF0 EXEC                   2356     505158
S001 000000008165F4D8 EXEC                    187      24957
S002 000000008165FCC0 WAIT(COMMON)          14770    3309104

3.是不是效果不明顯呢?那再看看將max_shared_servers引數修改為0的效果
sys@ora10g> alter system set max_shared_servers=0 scope=both;

System altered.

sys@ora10g> select NAME,PADDR,STATUS,MESSAGES,BYTES from v$shared_server;

NAME PADDR            STATUS             MESSAGES      BYTES
---- ---------------- ---------------- ---------- ----------
S000 000000008165ECF0 EXEC                   2386     508998
S001 000000008165F4D8 EXEC                    191      26155
S002 000000008165FCC0 QUIT                  14966    3318519

到這裡,所有的伺服器程式都被強制終止。

4.OK,在不能重新啟動的資料庫系統中就可以使用這樣的方法進行修改。

-- The End --

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-610026/,如需轉載,請註明出處,否則將追究法律責任。

相關文章