ORACLE/ADMIN2012. 10. 12. 15:13
반응형

 

Sizing Redo Log Files

Sizing Redo Log Files

The size of the redo log files can influence performance, because the behavior of the database writer and archiver processes depend on the redo log sizes. Generally, larger redo log files provide better performance. Undersized log files increase checkpoint activity and reduce performance.
리두로그 파일 사이즈는 성능에 영향을 끼칠 수 있다, 왜냐하면 DBWR ARCn프로세스가 리두로그 사이즈에 영향을 받기 때문이다.
일반적으로, 큰 리두로그파일은 보다 나은 성능을 보장한다. 크기가 작은 로그파일은 chekcpint를 증가시키고 성능을 저하시킨다.

Although the size of the redo log files does not affect LGWR performance, it can affect DBWR and checkpoint behavior. Checkpoint frequency is affected by several factors, including log file size and the setting of the FAST_START_MTTR_TARGET initialization parameter. If the FAST_START_MTTR_TARGET parameter is set to limit the instance recovery time, Oracle Database automatically tries to checkpoint as frequently as necessary. Under this condition, the size of the log files should be large enough to avoid additional checkpointing due to under sized log files. The optimal size can be obtained by querying the OPTIMAL_LOGFILE_SIZE column from the V$INSTANCE_RECOVERY view. You can also obtain sizing advice on the Redo Log Groups page of Oracle Enterprise Manager.
비록 리두로그 파일 크기가 LGWR 프로세스의 성능에 영향을 주지는 않지만, DBWR 프로세스와 checkpoint에는 영향을 준다.
checkpoint 빈도는 리두로그파일 크기를 포함하여 FAST_START_MTTR_TARGET 파라미터등에 영향을 받는다.
만약 FAST_START_MTTR_TARGET 파라미터가 인스턴스 복구시간의 제한값으로 설정되면, 오라클 데이터베이스가
자동적으로 필요한 만큼의 checkpoint 빈도를 조절한다. 이 상황 하에서는, 리두로그 파일 사이즈는 작은 크기때문에
추가적인 checkpoint가 일어나는걸 방지하기 위해 충분히 크게 설정되어야 한다. 가장 최적의 사이즈에 대한 값은
V$INSTANCE_RECOVERY 뷰의 OPTIMAL_LOGFILE_SIZE 컬럼에서 확인이 가능하다. 또한 OEM의 Redo Log Group으로
부터도 확인 가능하다.

It may not always be possible to provide a specific size recommendation for redo log files, but redo log files in the range of 100 MB to a few gigabytes are considered reasonable. Size online redo log files according to the amount of redo your system generates. A rough guide is to switch log files at most once every 20 minutes.
리두로그 파일의 크기를 정확히 정하기는 힘들지만, 100MB에서 몇GB 까지가 합당하다. 리두로그 파일의 크기는 시스템이
생성하는 리두의 양에 따라 조절해야 한다. 대략 20분에 1번정도로 설정하면 된다.


[[리두로그 리사이징]]
*. REDO LOG group은 3개 이상 권장, member는 2개 권장
(member는 물리적으로 서로 다른 위치에 분산 권장)
*. 평상시 REDO LOG 스위치가 약 20분 이상 유지할 수 있는 Size 권장
(alert_TESTDB.log에서 지속적으로 모니터링해서 필요시 REDO LOG 크기를 증가시킬 것)
*. 체크포인트 간격 조절(initTESTDB.ora파라미터에서) fast_start_mttr_target = 600

*. DB Startup 상태에서 작업 가능

1. sqlplus 접속(Internal로 접속)
$> sqlplus '/ as sysdba'
OR
$> sqlplus system/manager

2. currunt REDO LOG 조회
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 43 104857600 2 YES INACTIVE 8485439 01-SEP-03
2 1 44 104857600 2 YES INACTIVE 8585874 02-SEP-03
3 1 45 104857600 2 NO CURRENT 8756665 03-SEP-03
STATUS가 Inactive인 경우만 작업 가능

3. REDO LOG file을 switch
SQL> alter system switch logfile;
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 46 104857600 2 NO CURRENT 8988801 03-SEP-03
2 1 44 104857600 2 YES INACTIVE 8585874 02-SEP-03
3 1 45 104857600 2 YES ACTIVE 8756665 03-SEP-03
SQL> alter system switch logfile;
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 46 104857600 2 YES ACTIVE 8988801 03-SEP-03
2 1 47 104857600 2 NO CURRENT 8990631 03-SEP-03
3 1 45 104857600 2 YES INACTIVE 8756665 03-SEP-03

4. acitive 한 REDO LOG group을 inactive로 변경
SQL> alter system checkpoint;

5. REDO LOG Drop
SQL> alter database drop logfile group 2;
6. REDO LOG logfile 삭제
SQL> !rm /oradata1/redo2a.dbf;
SQL> !rm /oradata2/redo2b.dbf;

7. REDO LOG logfile 추가
1) 멤버가 없는 경우
SQL> alter database add logfile group 2 '/oradata/redo2.dbf' size 100M;
2) 멤버가 있는 경우
SQL> alter database add logfile member '/oradata/redo2b.dbf' to group 2;
SQL> alter database add logfile
group 2 ('/oradata1/redo2a','/oradata2/redo2b') size 100M reuse;
3) 여러개의 REDO LOG 추가할 경우
SQL> alter database add logfile
group 4 ('/oradata1/redo4a','/oradata2/redo4b') size 100M,
group 5 ('/oradata1/redo5a','/oradata2/redo5b') size 100M,
group 6 ('/oradata1/redo6a','/oradata2/redo6b') size 100M;

[출처] DBMS관리 - 리두로그(REDO LOG) Resize 방법|작성자 smileDBA

반응형
Posted by [PineTree]
ORACLE/ADMIN2012. 8. 23. 15:06
반응형

 

using-dynamic-intimate-memory-sparc-168402.pdf

 

Dynamic Intimate Shared Memory (DISM)

Dynamic Intimate Shared Memory (DISM)를 사용하여 데이터베이스가 공유 데이터 세그먼트의 크기를 동적으로 확장 또는 감소시킬 수 있습니다. 이 기능은 Intimate Shared Memory (ISM)의 잘못된 구성 문제 및 서비스 거부 안전 취약성을 제거합니다.

ISM은 대량의 잠긴 메모리 페이지로 구성된 공유 메모리 세그먼트입니다. ISM 잠긴 페이지 수는 일정하거나 불변합니다. 동적 ISM (DISM)은 페이지 가능한 ISM 공유 메모리로서 잠긴 페이지의 수가 다양합니다(변경 가능). 따라서 DISM은 동적 재구성 시 시스템에 물리적 메모리를 해제나 추가할 수 있도록 지원합니다. DISM 크기는 사용 가능한 물리적 메모리에 디스크 스왑을 더한 크기입니다.

shmop(2) 설명서 페이지를 참조하십시오.


주 –

Solaris 9 9/02 갱신 릴리스에서는 DISM에 대해 대형 페이지를 지원합니다. 대형 페이지 지원에 대한 설명은 SPARC: DISM (Dynamic Intimate Shared Memory) 대형 페이지 지원를 참조하십시오.


반응형
Posted by [PineTree]
ORACLE/ADMIN2012. 5. 15. 17:24
반응형

Automatic Tuning of Undo_retention Causes Space Problems [ID 420525.1]

--------------------------------------------------------------------------------
 
  수정 날짜 09-FEB-2011     유형 PROBLEM     상태 PUBLISHED  

In this Document
  Symptoms
  Cause
  Solution
  References

 

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

 

Applies to:
Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 10.2.0.3 - Release: 10.2 to 10.2
Information in this document applies to any platform.
Oracle Server Enterprise Edition - Version: 10.2.0.1 to 10.2.0.3 -- fixed by patchset 10.2.0.4 and no issues on this at 11g
Symptoms
You have verified that Note 413732.1 is not applicable and the problem is not a misunderstanding in the way EXPIRED/UNEXPIRED are used and reused over time.

Look for:

1.) System (Automatic) Managed Undo
undo_management=auto in init.ora file

2.) Fixed size undo tablespace
SQL> select autoextensible from dba_data_files where tablespace_name='<current_undo_tablespace >'

returns "No" for all the undo tablespace datafiles.

3.) The undo tablespace is already sized such that it always has more than enough space to store all the undo generated within the undo_retention time, and the in-use undo space never exceeds the undo tablespace warning alert threshold (see below for the query to show the thresholds).

4.) The tablespace threshold alerts recommend that the DBA add more space to the undo tablespace:

SQL> select creation_time, metric_value, message_type,reason, suggested_action from dba_outstanding_alerts where object_name='<current_undo_ts>';

returns a suggested action of: "Add space to the tablespace"

Or,

This recommendation has been reported in the past but the condition has now cleared:
SQL> select creation_time, metric_value, message_type, reason, suggested_action, resolution from dba_alert_history where object_name='<current_undo_ts>';

5.) The undo tablespace in-use space exceeded the warning alert threshold at some point in time:

To see the warning alert percentage threshold:

SQL> select object_type, object_name, warning_value, critical_value from dba_thresholds where object_type='TABLESPACE';

To see the (current) undo tablespace percent of space in-use:
SQL> select
((select (nvl(sum(bytes),0))
from dba_undo_extents
where tablespace_name='<current_undo_ts>'
and status in ('ACTIVE','UNEXPIRED')) *100) /
(select sum(bytes)
from dba_data_files
where tablespace_name='<current_undo_ts>')
"PCT_INUSE"
from dual;

Cause
This is due to Bug 5387030 that is fixed in 10.2.0.4 patchset of RDBMS server.

 

Solution
Apply the patch for the Bug 5387030. Check the Oracle Support Portal for patch availability for your platform and RDBMS version.

Workaround

There are 3 possible alternate workarounds (any one of these should resolve the problem of the alerts triggering unnecessarily):

1.) Set the autoextend and maxsize attribute of each datafile in the undo ts so it is autoextensible and its maxsize is equal to its current size so the undo tablespace now has the autoextend attribute but does not autoextend:

SQL> alter database datafile '<datafile_flename>'
autoextend on maxsize <current_size>;

With this setting, v$undostat.tuned_undoretention is not calculated based on a percentage of the undo tablespace size, instead v$undostat.tuned_undoretention is set to the maximum of (maxquerylen secs + 300) undo_retention specified in init.ora file.

2.) Set the following hidden parameter in init.ora file:
_smu_debug_mode=33554432

or

SQL> Alter system set "_smu_debug_mode" = 33554432;

With this setting, v$undostat.tuned_undoretention is not calculated based on a percentage of the fixed size undo tablespace, instead v$undostat.tuned_undoretention is set to the maximum of (maxquerylen secs + 300) undo_retention specified in init.ora file.

3.) Set the following hidden parameter in init.ora:
_undo_autotune = false

or

SQL> Alter system set "_undo_autotune" = false;

With this setting, v$undostat (and therefore v$undostat.tuned_undoretention) is not maintained and the undo_retention used is the one specified in init.ora file.   NOTE:  This means you loose all advantages in having automatic undo management and is not an ideal long term fix.

NOTE: Even with the patch fix installed, the autotuned retention can still grow under certain circumstances.  The fix attempts to throttle back how aggressive that autotuning will be.  Options 2 and 3 may be needed to get around this aggressive growth in some environments.


References
NOTE:413732.1 - Full UNDO Tablespace In 10gR2

 관련 자료

 

--------------------------------------------------------------------------------
제품
--------------------------------------------------------------------------------

•Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition
키워드
--------------------------------------------------------------------------------
TABLESPACE; UNDO_MANAGEMENT; UNDO_RETENTION; UNDO TABLESPACE

 

반응형
Posted by [PineTree]
ORACLE/ADMIN2012. 5. 11. 11:07
반응형

● 개요

- 추가적인 리스너를 생성할 수 있다.
- 오라클 넷 서비스를 생성할 수 있다.
- connect-time failover를 구성할 수 있다.



● 오라클 넷 서비스(Oracle Net Services)
   ◎ 정의
       : 네트워크 connection을 가능하게 하는 소프트웨어

   ◎ 전체 구조도



   ◎ 리스너에 추가하는 법

       ○ telnet으로 추가
           - 리스너가 동작중인지 확인

OS] ps -ef|grep lsnr



           - linstener.ora가 있는 디렉토리로 이동 후 확인

OS] cd $ORACLE_HOME/network/admin
OS] ls


           - listener.ora의 내용을 확인

OS] vi listener.ora


           - 내용을 확인해보면 다음과 같다. 빨간색 부분을 추가한다.(띄어쓰기 안맞을 경우 에러 발생할 가능성이 있다.)

L1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ora10gr2.gsedu.com)(PORT = 1521))
    )
  )
SID_LIST_L1 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (GLOBAL_DBNAME = orcl)
    )
    (SID_DESC =
      (SID_NAME = ikdb)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (GLOBAL_DBNAME = ikdb)
    )
  )

L2 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ora10gr2.gsedu.com)(PORT = 1621))
    )
  )
SID_LIST_L2 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = jgh_db)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (GLOBAL_DBNAME = jgh_db)
    )
  )


           - 리스너를 start시킨다.
             기본은 1521 포트의 리스너가 start되지만 리스너를 명시해서 start, stop을 할 수 있다.

OS] lsnrctl start
OS] lsnrctl stop
OS] lsnrctl start L1
OS] lsnrctl start L2
OS] lsnrctl stop L1
OS] lsnrctl stop L2


           - lsnrctl 명령으로도 가능

OS] lsnrctl
LSNRCTL> start l1
LSNRCTL> start l2
LSNRCTL> service l1
LSNRCTL> service l2
LSNRCTL> status l1
LSNRCTL> status l2
LSNRCTL> set current l2           -- 디폴트 리스너를 바꿀 수 있다.



       ○ Oracle Net Manager로 추가

OS] netmgr



       ○ Oracle Configuration Assistant로 추가

OS] netca


       ○ EM으로 추가



 ※ Server에 기본 리스너외에 추가 리스너 등록

SQL> alter system set local_listener = a            -- 같은 machine내에 a리스트를 보고 등록
SQL> alter system set remote_listener =         -- 다른 machine의 리스너 등록


 

<tnsnames.ora>
=
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.10)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.11)(PORT = 1621))
    (CONNECT_DATA =
         (SERVER = DEDICATED)
         (SID = orcl)
    )
)



※ RAC환경에서의 설정
    - SID는 중복 불가, SERVICE_NAME은 중복 가능

SERVER1 (192.168.0.10)
OS] vi initi1.ora
instance_name = i1
service_names = haha, hoho
remote_listener = .....


 

SERVER2 (192.168.0.11)
OS] vi initi2.ora
instance_name = i2
service_names = haha, hoho
remote_listener = .....


 

SERVER3 (192.168.0.12)
OS] vi initi3.ora
instance_name = i3
service_names = haha, hoho
remote_listener = .....


 

CLIENT
<tnsnames.ora>
sqlplus chris/chris@a                         -- a : connect identifier(=network alias, service alias)
a =
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.10)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.11)(PORT = 1521))
    (CONNECT_DATA =
         (SERVER = DEDICATED)
         (SERVICE_NAME = haha)
    ) 
)
-- connect discriptor


- haha라는 서비스명으로 접속하므로 i1이 shutdown되어 있더라도 i2로 접속이 가능
  SID=i1으로 할 경우 문제가 생길 소지가 있음. SERVICE_NAME으로 하는 것이 좋음

※ instance name이 같은 서버가 있어도 도메인으로 식별 가능

instance1
instance_name = HRDB
db_domain = asia.com


 

instance2
instance_name = HRDB
db_domain = africa.com



※ Dedicated Server vs. Shared Server

  Dedicated Server
    - 하나의 유저에 하나의 서버 프로세스가 담당.
    - sserver process당 PGA가 생긴다.

    dedicate server로 접속시 client의 tnsnames.ora설정 파일

<tnsnames.ora>
shared =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.122.1)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.122.1)(PORT = 1621))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )



  Shared Server
    - 일정 갯수의 서버 프로세스를 유저서버프로세스가 공유하는 형식
    - UGA(user session data, cursor state, sort data)가 SGA내에 생김(서버 프로세스가 공유하기 위해서)
    - 아래의 파일들을 설정해주어야 함

    shared server 접속시 client의 tnsnames.ora 설정 파일

<tnsnames.ora>
shared =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.122.1)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.122.1)(PORT = 1621))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = SHARED)
      (SERVICE_NAME = orcl)
    )
  )


      server의 파라미터 파일 설정

SQL> alter system set shared_servers = 2;                                             -- 서버프로세스를 2개
SQL> alter system set dispatchers = '(protocol=tsp)(dispatchers=3)';        -- 디스패쳐를 3개



기타참고사항

- JDBC 드라이버
    : Java Database Connectivity의 약자. 번역기. DBMS의 벤더들이 만든다.
      oracle net을 simmulate한 것
      사용시에 오라클의 버전에 맞게 사용할 것

- 리스너가 살아있는지 확인(서버가 살아있는지 확인하는 것은 아님)
   tnsping 172.16.122.106:1521/orcl

- name resolution
  : connect identifier(network alias, service alias)를 connect descriptor로 바꾸는 행위를 말한다.

- linux : oerr ora 12154 명령을 치면 에러에 대한 내용이 나옴.

- 오라클에서의 connection과 session
   - connection
      : communication path way
   - session
      : log in ~ log out

반응형
Posted by [PineTree]
ORACLE/ADMIN2012. 1. 2. 14:32
반응형

Maxgauge와 같은 툴의 가장 큰 장점은 Oracle Hang 상황에서도 액티브 세션의 리스트를 얻을 수 있다는 것입니다. 대기 이벤트와 SQL 정보가 포함된 액티브 세션 목록이야말로 모든 성능 트러블슈팅의 시작입니다.

Maxgauge와 같은 툴이 Oracle Hang 상황에서도 데이터를 수집할 수 있는 것은 DMA(Direct Memory Access)를 사용하기 때문입니다. 이 방법은 Oracle의 COE(Center Of Expertise) 팀이 극한의 상황, 즉 SQL로 필요한 정보를 수집하지 못할 때 사용하던 방법입니다. 이것이 Maxgauge와 같은 툴 덕분에 보편화된 것입니다.

만일 Maxgauge와 같은 툴이 없다면 어떻게 해야 할까요? Oracle이 제공하는 ASHDUMP 기능을 Preliminary Connection과 함께 사용할 수 있습니다.

  • Preliminary Connection이란 SQL*Net 방식이 아닌 Direct Memory Access 방식으로 Connection을 맺는 것을 말합니다.
  • ASHDUMP는 액티브 세션 목록의 메모리 버전인 ASH(Active Session History)를 텍스트 파일에 기록하는 기능입니다.
따라서 위 두 기능을 같이 사용하면 마치 DMA 방식으로 액티브 세션의 목록을 얻는 것과 동일한 효과가 있습니다.

아래에 간단한 예제가 있습니다.

우선 Preliminary Connection을 맺습니다.

1 #> sqlplus -prelim sys/oracle@ukja1106 as sysdba
2   
3 SQL*Plus: Release 11.1.0.6.0 - Production on Mon Apr 26 09:43:35 2010
4   
5 Copyright (c) 1982, 2007, Oracle.  All rights reserved.
일반적인 쿼리는 동작하지 않습니다.
1 alter session set nls_date_format='yyyy/mm/dd hh24:mi:ss'
2 *
3 ERROR at line 1:
4 ORA-01012: not logged on
5 Process ID: 0
6 Session ID: 0 Serial number: 0
Preliminary Connection 상태에서 ASHDUMP를 수행합니다. 레벨(10)은 10분을 의미합니다. 즉 지난 10분간의 ASH를 의미합니다.
1 SYS@ukja1106> oradebug setmypid
2 Statement processed.
3 SYS@ukja1106> oradebug dump ashdump 10
4 Statement processed.
5 SYS@ukja1106> oradebug tracefile_name
6 c:\oracle\diag\rdbms\ukja1106\ukja1106\trace\ukja1106_ora_12152.trc
Dump 파일의 내용은 다음과 같습니다. 11g부터는 액티브 세션 목록과 함께 해당 목록을 테이블로 로딩하는 스크립트까지 함께 제공합니다. Hang의 악몽이 지나간 후(대부분 리스타트) 사후 분석을 위한 것입니다.
001 Processing Oradebug command 'dump ashdump 10'
002 ASH dump
003 <<<ACTIVE BEGIN HEADER DUMP TRACE PROCESS - HISTORY SESSION>>>
004 ****************
005 SCRIPT TO IMPORT
006 ****************
007 ------------------------------------------
008 Step 1: Create destination table <ASHDUMP>
009 ------------------------------------------
010 CREATE TABLE ashdump AS
011 SELECT * FROM SYS.WRH$_ACTIVE_SESSION_HISTORY WHERE rownum < 0
012 ----------------------------------------------------------------
013 Step 2: Create the SQL*Loader control file <ASHLDR.CTL> as below
014 ----------------------------------------------------------------
015 load data 
016 infile * "str '\n####\n'"
017 append
018 into table ashdump
019 fields terminated by ',' optionally enclosed by '"'
020 (                               
021 SNAP_ID  CONSTANT 0           , 
022 DBID                          , 
023 INSTANCE_NUMBER               , 
024 SAMPLE_ID                     , 
025 SAMPLE_TIME TIMESTAMP ENCLOSED BY '"' AND '"' "TO_TIMESTAMP(:SAMPLE_TIME   ,'MM-DD-YYYY HH24:MI:SSXFF')"   , 
026 SESSION_ID                    , 
027 SESSION_SERIAL#               , 
028 SESSION_TYPE                  , 
029 USER_ID                       , 
030 SQL_ID                        , 
031 SQL_CHILD_NUMBER              , 
032 SQL_OPCODE                    , 
033 FORCE_MATCHING_SIGNATURE      , 
034 TOP_LEVEL_SQL_ID              , 
035 TOP_LEVEL_SQL_OPCODE          , 
036 SQL_PLAN_HASH_VALUE           , 
037 SQL_PLAN_LINE_ID              , 
038 SQL_PLAN_OPERATION#           , 
039 SQL_PLAN_OPTIONS#             , 
040 SQL_EXEC_ID                   , 
041 SQL_EXEC_START DATE 'MM/DD/YYYY HH24:MI:SS' ENCLOSED BY '"' AND '"' ":SQL_EXEC_START"   , 
042 PLSQL_ENTRY_OBJECT_ID         , 
043 PLSQL_ENTRY_SUBPROGRAM_ID     , 
044 PLSQL_OBJECT_ID               , 
045 PLSQL_SUBPROGRAM_ID           , 
046 QC_INSTANCE_ID                , 
047 QC_SESSION_ID                 , 
048 QC_SESSION_SERIAL#            , 
049 EVENT_ID                      , 
050 SEQ#                          , 
051 P1                            , 
052 P2                            , 
053 P3                            , 
054 WAIT_TIME                     , 
055 TIME_WAITED                   , 
056 BLOCKING_SESSION              , 
057 BLOCKING_SESSION_SERIAL#      , 
058 CURRENT_OBJ#                  , 
059 CURRENT_FILE#                 , 
060 CURRENT_BLOCK#                , 
061 CURRENT_ROW#                  , 
062 CONSUMER_GROUP_ID             , 
063 XID                           , 
064 REMOTE_INSTANCE#              , 
065 TIME_MODEL                    , 
066 SERVICE_HASH                  , 
067 PROGRAM                       , 
068 MODULE                        , 
069 ACTION                        , 
070 CLIENT_ID                       
071 )                               
072 ---------------------------------------------------
073 Step 3: Load the ash rows dumped in this trace file
074 ---------------------------------------------------
075 sqlldr userid/password control=ashldr.ctl data=<THIS_TRACE_FILENAME> errors=1000000
076 ---------------------------------------------------
077 <<<ACTIVE HEADER DUMP TRACE PROCESS - HISTORY SESSION END>>>
078 <<<ACTIVE BEGIN DUMP TRACE PROCESS - HISTORY SESSION>>>
079 ####
080 58646642,1,12519562,"04-26-2010 09:44:01.822000000",160,1,2,0,
081 "",0,0,0,"",0,0,0,0,0,
082 0,"",0,0,0,0,0,0,0,
083 3213517201,9858,0,3,1,0,69788,4294967295,0,
084 4294967295,0,0,0,0,,0,0,165959219,
085 "ORACLE.EXE (CKPT)","",
086 "",""
087 ####
088 58646642,1,12519486,"04-26-2010 09:42:45.808000000",160,1,2,0,
089 "",0,0,0,"",0,0,0,0,0,
090 0,"",0,0,0,0,0,0,0,
091 3213517201,9767,1,1,1,0,38825,4294967295,0,
092 4294967295,0,0,0,0,,0,0,165959219,
093 "ORACLE.EXE (CKPT)","",
094 "",""
095 ####
096 58646642,1,12519416,"04-26-2010 09:41:35.770000000",160,1,2,0,
097 "",0,0,0,"",0,0,0,0,0,
098 0,"",0,0,0,0,0,0,0,
099 4078387448,9683,3,3,3,0,11083,4294967295,0,
100 4294967295,0,0,0,0,,0,0,165959219,
101 "ORACLE.EXE (CKPT)","",
102 "",""
103 ####
104 58646642,1,12519384,"04-26-2010 09:41:03.774000000",163,1,2,0,
105 "",0,0,0,"",0,0,0,0,0,
106 0,"",0,0,0,0,0,0,0,
107 3176176482,40612,5,1,1000,999888,0,4294967291,0,
108 4294967295,0,0,0,0,,0,0,165959219,
109 "ORACLE.EXE (DIA0)","",
110 "",""
111 ####
112 58646642,1,12519304,"04-26-2010 09:39:43.719000000",160,1,2,0,
113 "",0,0,0,"",0,0,0,0,0,
114 0,"",0,0,0,0,0,0,0,
115 3213517201,9551,1,1,1,0,38798,4294967295,0,
116 4294967295,0,0,0,0,,0,0,165959219,
117 "ORACLE.EXE (CKPT)","",
118 "",""
119 ####
120 58646642,1,12519265,"04-26-2010 09:39:04.663000000",163,1,2,0,
121 "",0,0,0,"",0,0,0,0,0,
122 0,"",0,0,0,0,0,0,0,
123 3176176482,40493,5,1,1000,999941,0,4294967291,0,
124 4294967295,0,0,0,0,,0,0,165959219,
125 "ORACLE.EXE (DIA0)","",
126 "",""
127 ####
128 58646642,1,12519183,"04-26-2010 09:37:42.554000000",160,1,2,0,
129 "",0,0,0,"",0,0,0,0,0,
130 0,"",0,0,0,0,0,0,0,
131 3213517201,9406,0,1,1,0,54077,4294967295,0,
132 4294967295,0,0,0,0,,0,0,165959219,
133 "ORACLE.EXE (CKPT)","",
134 "",""
135 ####
136 <<<ACTIVE DUMP TRACE PROCESS - HISTORY SESSION END>>>
137   
138 *** 2010-04-26 09:45:51.625
139 Oradebug command 'dump ashdump 10' console output: <NONE>
사후 분석 용도로 사용되면 대단히 유용할 것입니다. Preliminary Connection에서는 전통적인 트러블슈팅 데이터인 Hang Analyze나 System State Dump도 사용 가능합니다. 단, Preliminary Connection와 oradebug는 비공식적인 지원 기능이기 때문에 철저한 테스트 후 사용해야 되며, 가능한 오라클 지원 엔지니어의 승인하에 사용해야 합니다.

더 자세한 정보들은 아래 문서를 참조하세요.

출처 : http://ukja.tistory.com/310

반응형
Posted by [PineTree]
ORACLE/ADMIN2011. 12. 28. 23:33
반응형


오라클이 버전업이 되면, 오라클의 내부 동작 방식을 제어하는 파라미터에 대한 변경사항이 발생하게 된다. 즉, 파라미터의 기본설정값이 변경되거나, 새로운 기능 추가로 인해 필요한 파라미터가 추가되거나, 더 이상 불필요한 파라미터가 사라지게 된다. 따라서 오라클 업그레이드시에는 이러한 파라미터의 변경사항들을 체크해보는 것이 필요하다. 본 문서는 오라클 9i, 10g, 11g에 대해서 각각의 버전간의 파라미터 값의 변경사항/추가/삭제 사항들을 정리하는것을 목적으로 한다.

오라클 9i, 10g, 11g 간의 파라미터 기본설정 값의 변경 내역

아래의 파일에 각 버전간에 기본설정 값이 변경된 내역을 정리하였다.


오라클 9i, 10g, 11g에서 추가되거나/사라진 파라미터 내역

오라클이 버전업되면 추가되어지는 파라미터가 수백개가 넘는다. 따라서 본 문서에 그 내용을 담는 대신 첨부되어진 파일을 참조하기 바란다.

반응형
Posted by [PineTree]
ORACLE/ADMIN2011. 12. 21. 10:17
반응형

불량SQL을 찾을때와 락문제를 해결할때 도움이 될 것입니다.

 

유용하게 사용되길 바라며...
 

  1. 10분이내에 수행된 쿼리중 세션에 남아있는 쿼리
    SELECT sql_text
      FROM v$sqltext a, v$session b
     WHERE a.hash_value = b.sql_hash_value
       AND logon_time <= to_date(to_char(sysdate,'yyyymmddhh24mi')-10,'yyyymmddhh24mi');
  2. Buffer Cache Hit Ratio
    SELECT ROUND(((1-(SUM(DECODE(name, 'physical reads', value,0))/
    (SUM(DECODE(name, 'db block gets', value,0))+
    (SUM(DECODE(name, 'consistent gets', value, 0))))))*100),2) || '%' "Buffer Cache Hit Ratio"
    FROM V$SYSSTAT;
  3. Library Cache Hit Ratio
    SELECT (1-SUM (reloads)/SUM(pins))*100 "Library Cache Hit Ratio"
    FROM V$LIBRARYCACHE;
  4. Data Dictionary Cache Hit Ratio
    SELECT (1-SUM(getmisses)/SUM(gets))*100 "Data Dictionary Hit Ratio"
    FROM V$ROWCACHE;
  5. 테이블 스페이스 사용량
    SELECT a.tablespace_name ,
           a.total "Total(Mb)" ,
           a.total - b.free "Used(Mb)" ,
           NVL( b.free , 0 ) "Free(Mb)" ,
           ROUND(( a.total - NVL( b.free , 0 ) ) *100/total , 0 ) "Used(%)"
    FROM   (
            SELECT tablespace_name ,
                   ROUND(( SUM( bytes ) /1024/1024 ) , 0 ) AS total
            FROM   dba_data_files
            GROUP  BY tablespace_name
           ) a ,
           (
            SELECT tablespace_name ,
                   ROUND(( SUM( bytes ) /1024/1024 ) , 0 ) AS free
            FROM   dba_free_space
            GROUP  BY tablespace_name
           ) b
    WHERE  a.tablespace_name = b.tablespace_name( + )
    ORDER  BY a.tablespace_name ;
  6. 오라클서버의 메모리
    SELECT * FROM v$sgastat
     
    SELECT pool, sum(bytes) "SIZE"
    FROM v$sgastat
    WHERE pool = 'shared pool'
    GROUP BY pool
  7. cpu를 많이 사용하는 쿼리문과 프로세스아이디,시리얼번호,머신 알아내기
    SELECT c.sql_text
    ,b.SID
    , b.SERIAL#
    ,b.machine
    ,b.OSUSER
    ,b.logon_time --이 쿼리를 호출한 시간
    FROM v$process a, v$session b, v$sqltext c
    WHERE a.addr = b.paddr
    AND b.sql_hash_value = c.hash_value
    --and a.spid = '675958'
    ORDER BY c.PIECE
  8. cpu를 많이 사용하는 쿼리문과 프로세스아이디,시리얼번호,머신 알아내기2
    SELECT c.sql_text
    FROM v$process a, v$session b, v$sqltext c
    WHERE a.addr = b.paddr
    AND b.sql_hash_value = c.hash_value
    AND a.spid = '171'
    ORDER BY c.PIECE
  9. 프로세스 아이디를 이용하여 쿼리문 알아내기
    SELECT c.sql_text
    ,b.SID
    , b.SERIAL#
    ,b.machine
    ,b.OSUSER
    ,b.logon_time --이 쿼리를 호출한 시간
    FROM v$process a, v$session b, v$sqltext c
    WHERE a.addr = b.paddr
    AND b.sql_hash_value = c.hash_value
    AND a.spid = '1708032' --1912870/
    ORDER BY c.PIECE
  10. 세션 죽이기(SID,SERAIL#)
    ALTER SYSTEM KILL SESSION '8,4093'
  11. 오라클 세션과 관련된 테이블
    SELECT count(*) FROM v$session WHERE machine ='머신이름' AND schemaname ='스키마이름'
  12. 현재 커서 수 확인
    SELECT sid, count(sid) cursor
    FROM V$OPEN_CURSOR
    WHERE user_name = 'ilips'
    GROUP BY sid
    ORDER BY cursor DESC
     
    SELECT sql_text, count(sid) cnt
    FROM v$OPEN_CURSOR
    GROUP BY sql_text
    ORDER BY cnt DESC
     
    SELECT * FROM v$session_wait
     
    SELECT sid, serial#, username, taddr, used_ublk, used_urec
    FROM v$transaction t, v$session s
    WHERE t.addr = s.taddr;
     
    SELECT *  FROM sys.v_$open_cursor
  13. V$LOCK 을 사용한 잠금 경합 모니터링
    SELECT s.username, s.sid, s.serial#, s.logon_time,
        DECODE(l.type, 'TM', 'TABLE LOCK',
          'TX', 'ROW LOCK',
           NULL) "LOCK LEVEL",
        o.owner, o.object_name, o.object_type
    FROM v$session s, v$lock l, dba_objects o
    WHERE s.sid = l.sid
    AND o.object_id = l.id1
    AND s.username IS NOT NULL
  14. 락이 걸린 세션 자세히 알아보기
    SELECT a.sid, a.serial#,a.username,a.process,b.object_name,
    decode(c.lmode,2,'RS',3,'RX',4,'S',5,'SRX',8,'X','NO') "TABLE LOCK",
    decode (a.command,2,'INSERT',3,'SELECT',6,'UPDATE',7,'DELETE',12,'DROP TABLE',26,'LOCK TABLE','UNknown') "SQL",
    decode(a.lockwait, NULL,'NO wait','Wait') "STATUS"
    FROM v$session a,dba_objects b, v$lock c
    WHERE a.sid=c.sid AND b.object_id=c.id1
    AND c.type='TM'
  15. 락이 걸린 세션 간단히 알아보기
    SELECT a.sid, a.serial#, b.type, c.object_name, a.program, a.lockwait,
           a.logon_time, a.process, a.osuser, a.terminal
    FROM v$session a, v$lock b, dba_objects c
    WHERE a.sid = b.sid
      AND b.id1 = c.object_id
      AND b.type = 'TM';
    SELECT a.sid, a.serial#, a.username, a.process, b.object_name
    FROM v$session a , dba_objects b, v$lock c
    WHERE a.sid=c.sid AND b.object_id = c.id1
    AND c.type = 'TM'
  16. 락이 걸린 세션을 찾아 내어 세션을 죽이려고 해도 죽지 않는 경우 
    아래 쿼리문으로 OS단의 PROCESS ID를 찾아내어 OS에서 죽인다. 
     # kill -9 프로세스아이디 


    SELECT substr(s.username,1,11) "ORACLE USER", p.pid "PROCESS ID",
    s.sid "SESSION ID", s.serial#, osuser "OS USER",
    p.spid "PROC SPID",s.process "SESS SPID", s.lockwait "LOCK WAIT"
    FROM v$process p, v$session s, v$access a
    WHERE a.sid=s.sid AND
    p.addr=s.paddr AND
    s.username != 'SYS'


    위 쿼리문의 결과가 있다면 락이 걸린 세션이 있다는것이므로 아래의 쿼리문으로 세션을 죽인다.

    ALTER SYSTEM KILL SESSION '11,39061'

 

SELECT * FROM dba_External_Locations
SELECT * FROM nls_database_parameters


--1. Buffer Cache Hit Ratio

SELECT ROUND(((1-(SUM(DECODE(name, 'physical reads', value,0))/
(SUM(DECODE(name, 'db block gets', value,0))+
(SUM(DECODE(name, 'consistent gets', value, 0))))))*100),2) || '%' "Buffer Cache Hit Ratio"
FROM V$SYSSTAT;

--2. Library Cache Hit Ratio

SELECT (1-SUM (reloads)/SUM(pins))*100 "Library Cache Hit Ratio"
From V$LIBRARYCACHE;


--3. Data Dictionary Cache Hit Ratio

SELECT (1-SUM(getmisses)/SUM(gets))*100 "Data Dictionary Hit Ratio"
FROM V$ROWCACHE;

 

-- 테이블 스페이스 사용량

SELECT a.tablespace_name,
             a.total "Total(Mb)",
             a.total - b.free "Used(Mb)",
             nvl(b.free,0) "Free(Mb)",
             round((a.total - nvl(b.free,0))*100/total,0)  "Used(%)"
from    (   select     tablespace_name,
                            round((sum(bytes)/1024/1024),0) as total
               from       dba_data_files
               group by tablespace_name) a,
         (     select     tablespace_name,
                             round((sum(bytes)/1024/1024),0) as free
               from        dba_free_space
               group by  tablespace_name) b
where      a.tablespace_name = b.tablespace_name(+)
order by   a.tablespace_name;

 
--오라클서버의 메모리

select * from v$sgastat

select pool, sum(bytes) "SIZE"
from v$sgastat
where pool = 'shared pool'
group by pool

 

--cpu를 많이 사용하는 쿼리문과 프로세스아이디,시리얼번호,머신 알아내기

select c.sql_text
,b.SID
, b.SERIAL#
,b.machine
,b.OSUSER
,b.logon_time --이 쿼리를 호출한 시간
from v$process a, v$session b, v$sqltext c
where a.addr = b.paddr
and b.sql_hash_value = c.hash_value
--and a.spid = '675958'
order by c.PIECE

 
 
--cpu를 많이 사용하는 쿼리문과 프로세스아이디,시리얼번호,머신 알아내기

select c.sql_text
from v$process a, v$session b, v$sqltext c
where a.addr = b.paddr
and b.sql_hash_value = c.hash_value
and a.spid = '171'
order by c.PIECE

 

--프로세스 아이디를 이용하여 쿼리문 알아내기

select c.sql_text
,b.SID
, b.SERIAL#
,b.machine
,b.OSUSER
,b.logon_time --이 쿼리를 호출한 시간
from v$process a, v$session b, v$sqltext c
where a.addr = b.paddr
and b.sql_hash_value = c.hash_value
and a.spid = '1708032' --1912870/
order by c.PIECE

 

--세션 죽이기(SID,SERAIL#)

--ALTER SYSTEM KILL SESSION '8,4093'

--오라클 세션과 관련된 테이블*/

--select count(*) from v$session where machine ='머신이름' and schemaname ='스키마이름'

 

--현재 커서 수 확인

SELECT sid, count(sid) cursor
FROM V$OPEN_CURSOR
WHERE user_name = 'ilips'
GROUP BY sid
ORDER BY cursor DESC

SELECT sql_text, count(sid) cnt
FROM v$OPEN_CURSOR
GROUP BY sql_text
ORDER BY cnt DESC

select * from v$session_wait

select sid, serial#, username, taddr, used_ublk, used_urec
 from v$transaction t, v$session s
 where t.addr = s.taddr;

select *  from sys.v_$open_cursor

 

--V$LOCK 을 사용한 잠금 경합 모니터링

SELECT s.username, s.sid, s.serial#, s.logon_time,
    DECODE(l.type, 'TM', 'TABLE LOCK',
          'TX', 'ROW LOCK',
       NULL) "LOCK LEVEL",
    o.owner, o.object_name, o.object_type
FROM v$session s, v$lock l, dba_objects o
WHERE s.sid = l.sid
AND o.object_id = l.id1
AND s.username IS NOT NULL

 

--락이 걸린 세션 자세히 알아보기

select a.sid, a.serial#,a.username,a.process,b.object_name,
decode(c.lmode,2,'RS',3,'RX',4,'S',5,'SRX',8,'X','NO') "TABLE LOCK",
decode (a.command,2,'INSERT',3,'SELECT',6,'UPDATE',7,'DELETE',12,'DROP TABLE',26,'LOCK TABLE','UNknown') "SQL",
decode(a.lockwait, NULL,'NO wait','Wait') "STATUS"
from v$session a,dba_objects b, v$lock c
where a.sid=c.sid and b.object_id=c.id1
and c.type='TM'

 

--락이 걸린 세션 간단히 알아보기

select a.sid, a.serial#, b.type, c.object_name, a.program, a.lockwait,
       a.logon_time, a.process, a.osuser, a.terminal
from v$session a, v$lock b, dba_objects c
where a.sid = b.sid
  and b.id1 = c.object_id
  and b.type = 'TM';

select a.sid, a.serial#, a.username, a.process, b.object_name
from v$session a , dba_objects b, v$lock c
where a.sid=c.sid and b.object_id = c.id1
and c.type = 'TM'

 
--락이 걸린 세션을 찾아 내어 세션을 죽이려고 해도 죽지 않는 경우
--아래 쿼리문으로 OS단의 PROCESS ID를 찾아내어 OS에서 죽인다
--kill -9 프로세스아이디

select substr(s.username,1,11) "ORACLE USER", p.pid "PROCESS ID",
s.sid "SESSION ID", s.serial#, osuser "OS USER",
p.spid "PROC SPID",s.process "SESS SPID", s.lockwait "LOCK WAIT"
from v$process p, v$session s, v$access a
where a.sid=s.sid and
p.addr=s.paddr and
s.username != 'SYS'

--위 쿼리문의 결과가 있다면 락이 걸린 세션이 있다는것이므로 아래의 쿼리문으로 세션을 죽인다

ALTER SYSTEM KILL SESSION '11,39061'

 

 

alter session으로 죽지않는 프로세스 죽이기

1.oracle이 설치된 서버에 텔넷으로 root로 접속한다
2.su -오라클계정
3.sqlplus '/as sysdba''
4.connect system/sys
5.ALTER SYSTEM KILL SESSION '137,1723'

 

 

-- 특정 테이블에 사용된 쿼리
SELECT * FROM V$SQLAREA
WHERE parsing_schema_name = 'ING'
AND lower(sql_text) LIKE '%order_result_report_tbl%'
ORDER BY last_active_time DESC


-- 현재 세션에서 사용되는 쿼리
SELECT S.SID
     , S.SERIAL#
     , S.STATUS
     , S.PROCESS
     , S.OSUSER
     , A.SQL_TEXT
     , P.PROGRAM
  FROM V$SESSION S
     , V$SQLAREA A
     , V$PROCESS P
WHERE S.SQL_HASH_VALUE =  A.HASH_VALUE
  AND S.SQL_ADDRESS    =  A.ADDRESS
  AND S.PADDR          =  P.ADDR
  AND S.SCHEMANAME     = 'ING'
  AND S.STATUS         = 'ACTIVE'


--
select
 sql_text,
 sharable_mem + persistent_mem + runtime_mem memory,
 sorts,
 executions,
 first_load_time,
 invalidations,
 parse_calls,
 disk_reads,
 buffer_gets,
 rows_processed,
 round(rows_processed/greatest(executions,1)) row_ratio,
 round(disk_reads/greatest(executions,1)) disk_ratio,
 round(buffer_gets/greatest(executions,1)) buffer_ratio
from v$sqlarea
where
 executions > 100
or disk_reads > 1000
or buffer_gets > 1000
or rows_processed > 1000
order by
 executions * 250 + disk_reads * 25 + buffer_gets desc

 
--
SELECT
    PARSING_SCHEMA_NAME,
    executions,
    SQL_TEXT,
   disk_reads,
   buffer_gets,
    elapsed_time / executions AS elapsed_time,
    buffer_gets / decode(executions,0,1,executions) / 500 AS runtime,
    bind_data,
    MODULE,
    sharable_mem,
    persistent_mem,
    runtime_mem,
   rows_processed,
   round(rows_processed/greatest(executions,1)) row_ratio,
   round(disk_reads/greatest(executions,1)) disk_ratio,
   round(buffer_gets/greatest(executions,1)) buffer_ratio,
    LAST_LOAD_TIME,
    LAST_ACTIVE_TIME
FROM
    V$SQLAREA
WHERE
    LAST_LOAD_TIME BETWEEN SYSDATE - 1 AND SYSDATE
    AND PARSING_SCHEMA_NAME IN('WORLDGATE')
    AND SQL_TEXT LIKE 'SELECT%'
ORDER BY
    buffer_gets / decode(executions,0,1,executions) / 500 DESC
   
   
   
-- 10초 이상
select translate(sql_text,'&',':') ,
' Expected Run Time = '||
buffer_gets / decode(executions,0,1,executions) / 500 runt

from v$sqlarea
where buffer_gets / decode(executions,0,1,executions) / 500 > 10
and upper(sql_text) not like '%BEGIN%'
and upper(sql_text) not like '%SQLAREA%'
and upper(sql_text) not like '%DBA_%'
and upper(sql_text) not like '%USER_%'
and upper(sql_text) not like '%ALL_%'
order by executions desc

   

평균 메모리 사용량이 많은 SQL (상위 N개)

SELECT BUFFER_GETS,DISK_READS,

       EXECUTIONS,BUFFER_PER_EXEC,SQL_TEXT

FROM ( SELECT BUFFER_GETS,DISK_READS, EXECUTIONS,

   BUFFER_GETS/DECODE(EXECUTIONS,0,1,EXECUTIONS) BUFFER_PER_EXEC,

   SQL_TEXT

       FROM   V$SQLAREA

WHERE LAST_ACTIVE_TIME > trunc(SYSDATE)-8/24
AND  ROWNUM <=  5
       ORDER BY BUFFER_GETS/DECODE(EXECUTIONS,0,1,EXECUTIONS) DESC )

 

 

총 메모리 사용량이 많은 SQL (상위 N개)

SELECT BUFFER_GETS,DISK_READS,EXECUTIONS,SQL_TEXT

FROM (SELECT BUFFER_GETS,DISK_READS,EXECUTIONS,SQL_TEXT

      FROM V$SQLAREA

      ORDER BY BUFFER_GETS DESC  )

WHERE ROWNUM <= 5



반응형
Posted by [PineTree]
ORACLE/ADMIN2011. 12. 15. 14:30
반응형
반응형
Posted by [PineTree]
ORACLE/ADMIN2011. 12. 13. 14:55
반응형

ORACLE - Shared Server와 Dedicated Server의 접속 방식

이미지를 클릭하시면 원본크기로 보실수 있습니다.

 

 

  • 이전에 봤던 그림이랑 다르네요. ㅡ.,ㅡ 물론, 데이터베이스 버퍼 캐시 등도 있지만,
  • 설명을 하기 편하게 하기 위해, 생략 하였습니다.

이미지를 클릭하시면 원본크기로 보실수 있습니다.

  • 사용자 프로세스가 Dedicated Server를 통해 접속



이미지를 클릭하시면 원본크기로 보실수 있습니다.



 

  • 반면 Shared Server를 통하면 여러개의 백그라운드 프로세스를 통하여 접속 및 처리가 가능하게 됩니다.
  • DO0 , DO1...은 디스패쳐입니다.
  • Conn hr/hr 이 L에 돌아갔다가 오는데, 이것은 리다이렉트 방식입니다.

이미지를 클릭하시면 원본크기로 보실수 있습니다.

  • 이렇게 프로세스는 적지만 다량의 작업이 가능하기 때문에, 서버에 부하가 적습니다.
  • 하지만, 반환하는 시간이 Dedicated Server 보다는 조금 더 오래 걸릴 수 있습니다.
  • Shared Server를 사용한다고 해서, Dedicated Server를 사용하지 못하는 것은 아닙니다.
    • Shared Server를 사용하면, 서버 프로세스들간의 Road Balance가 되어서 idle(논다)프로세스가 줄어들어서 작업에 효율을 높일 수 있습니다.

PPT 참고 설명


  • Dedicated Server

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 클라이언트가 명령문을 요청해서 처리하는 동안에만 동작하는 프로세스 입니다.

 

  • Shared Server



    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 미리 정의된 프로세스들이 사용자의 접속이 없어도 이렇게 실행되어 있습니다.
    • 사용자는 Dispatcher 들을 통해서 간접적으로 접속하여 반환하게 됩니다.

# 기타 설명

  • Dedicated Server에서는 공유할 필요가 없기 때문에, 각각의 명령문을 PGA에 저장되어 사용됩니다.
  • 반면, Shared Server Processor 들도 PGA가 있긴 하지만, 각각의 명령문을 공유해야 하기 때문에 Stack정보를 제외하고 나머지는 SGA에 들어가면서 UGA로 명칭만 변경되어 공유가 됩니다.
  • UGA 는 기본적으로 Shared Pool에 들어가게 되고, 접속자가 늘어날 경우에는 이 UGA공간도 늘어납니다.
  • Shared Server 구조에서는 Large Pool 사이즈를 지정하여, UGA가 들어갈 수 있도록 사용해줘야 합니다.(기본 0)
    • Shared Server 구조는 다중 시스템(프로세스가 여러개)일 때 효율적입니다.
  • Shared Server를 구성할 때에는 Spfile Shared_Servers = 를 몇개이다 라고 지정해야 하며,
  • Dispatchers = 역시 속성등도 구성을 해줘야 합니다.
    • 그 중에, Connection 개수를 지정해 주는데, 예로 Conn = 30 이면, 최대 90명이 접속가능 합니다.
    • 또한 Pool = on 속성을 사용할 수 있으며, 이것을 사용하면 세션 기능도 사용가능하여 Connection을 더 증가시킬 수 있습니다.
      • 예 : Dispatchers = (conn = 30)
                                  (Pool = on)
                                  (sess = 50)
      • 풀링기능을 활성화 시킴으로써 더 많은 사용자들을 수용할 수 있습니다.
    • Connection Manager 라는 미들티어를 구성할 수 있는데, 이것은 별도의 기기에 구성하여 서버로 사용해야 합니다.
    • 사용자는 이 미들티어를 통해서 접속하며, 미들티어는 사용자의 다중접속을 서버에게는 단일 접속으로 처리하도록 해줍니다.

      이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • ▲오라클 Connection Manager

 Oracle Shared Server의 이점

  • Instance에 대한 Process 수를 줄인다.
  • 허용되는 User수를 증가시킨다.
  • 로드 밸런싱을 수행한다.
    • 서버프로세스의 로드밸런스
  • 휴지 Server Process의 수를 줄인다.
  • 메모리 사용량과 시스템 오버헤드를 줄인다.
    • 주로 메모리에 대한 오버헤드는 많이 줄어들지만, CPU에 대한 오버헤드는 증가합니다.

 

 Oracle Shared Server와 함께 Dedicated Server 사용


 




이미지를 클릭하시면 원본크기로 보실수 있습니다.

  • 절차상의 차이점은 있지만, 둘다 리스너를 통해서 가야합니다.
  • 또한 항상 디스패쳐당 접속수가 동일하게 유지하도록 해야 합니다.
  • 이렇게 디스패쳐에 연결되기 위해서는 Remote와 Server의 접속방식이 동일해야 합니다.
  • SYSDBA가 접속할 때는 LOCAL 이던 무엇이던간에 무조건 전용서버가 할당됩니다.

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 사용자는 Request Queue를 통해 간접적으로 전하고, 반환을 받습니다.
    • Response Queue는 Dispatcher당 하나씩 가지고 있습니다.



    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • Shared Pool 및 다른 메모리구조 : Larger Pool 입니다. Large Pool은 이러한 문제로 인해 반드시 설정해야 합니다.

    Oracle Shared Server의 구성

    • 필수 초기화 Parameter
      • DISPATCHERS
      • SHARED_SERVERS
        • 똑똑합니다. 동적으로 MAX 값까지 필요하면 늘여줍니다. 하지만, 줄이는건 동적이지 못합니다.
    • 선택적 초기화 Parameter
      • MAX_DISPATCHERS
      • MAX_SHARED_SERVERS
        • 이 MAX 값은 Default값이 있기 때문에 선택적 값입니다.
      • CIRCUITS
        • Shared Server를 통한 경로. Response, Request를 통한....
        • 이것은 값을 튜닝해서 서버의 성능을 높이거나 하진 않지만, 값을 높여 놓으면 나중에 오라클이 인지를 하게 되고, 나중에 오라클이 Queue 사이즈를 크게 조정하거나 합니다.
        • 단, 큐를 키우게 되면 SGA의 다른 요소가 영향을 받습니다.
      • SHARED_SERVER_SESSIONS
        • Shared Server Sessions 을 모두 제한하는 파라미터 입니다.
        • 만약, 6개의 세션이 등록되었다면, 6개의 세션이 실행하고 있다는 뜻이 됩니다.
        • V$Session을 조회하면, 혼자 작업 중인데도 많은 세션이 동작중임을 볼 수 있습니다.
        • 1명이 쓰는데도 많이 접속한 것을 볼 수 있지요.
        • Shared_Server_Sessions의 값은 항상 낮게 설정해야 합니다. 그래야만, 나중에 Shared Server가 꽉 차더라도 공간을 보장해줘서 후에, Dedicated Server를 예약할 수 있도록 합니다.


    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 지정된 프로토콜에 대해 처음에 시작된 Dispatcher 수를 지정합니다.
    • \는 줄바꿈표시 ㅡ.,ㅡ
    • DISPATCHERS 매개변수
      데이터베이스 관리자는 DISPATCHERS 매개변수를 사용하여 각 디스패처에 대해 다양
      한 속성을 설정합니다.
      Oracle9i는 Oracle Net 서비스에서 사용되는 구문과 유사한 이름-값 구문을 지원하여 기
      존 속성과 추가 속성의 사양을 위치 독립적이며 대소문자를 구분하지 않는 방식으로 설
      정합니다.
      예:

    이미지를 클릭하시면 원본크기로 보실수 있습니다.


    Oracle Database Configuration Assistant를 사용하여 이 매개변수를 구성할 수 있습니다.

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    Dispatchers의 파라미터

     

    • PROTOCOL
    • ADDRESS
    • DESCRIPTION
    • DISPATCHERS
    • SESSIONS
    • LISTENER
    • CONNECTIONS

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 동시에 실행될 수 잇는 최대 디스패쳐 프로세스 수 지정합니다.
    • 처음 시작 시보다 더 많은 디스패쳐를 지정이 가능합니다.

     

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 인스턴스가 시작될 때 생성할 서버 프로세스의 수를 지정합니다.
    • 이것은 Alter  명령어를 이용하여 늘리거나 줄일 수 있습니다.

     

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 시작 가능한 최대 Shared Server수를 지정합니다.
    • 직접 조정하지 않아도, 나중에 오라클서버가 자동으로 늘렺부니다.
    • Request Queue의 길이에 따라 공유서버의 구성이 달라집니다.

     

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 수신 및 송신 네트워크 세션에 사용할 수 있는 가상 Circuit의 총 수를 지정합니다.
    • 전체 SGA 크기에 영향을 줍니다.

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 허용되는 Oracle Shared ServerUser 세션의 총 수를 지정합니다.
    • 이 파라미터를 설정하면 전용서버에 대한 사용자 세션을 예약할 수 있습니다.
    • LARGE_POOL_SIZE : UGA를 사용하기 위해 라지풀을 조정한다.

    ▶ 설정 확인

    이미지를 클릭하시면 원본크기로 보실수 있습니다.

    • 위의 명령을 실행하여 인스턴스가 시작될 때 디스패쳐가 리스너에 등록되었는지 확인합니다.
    • 단일 연결을 설정하여 공유 서버를 통해 연결한 다음 V$Circuit 뷰를 질의하여 Shared Server 연결 당 하나의 항목만 표시되는지 확인합니다.

    ▶ 동적 뷰

    • V$CIRCUITS
    • V$SHARED_SERVER
    • V$DISPATCHER
    • V$SHARED_SERVER_MONITOR
    • V$QUEUE
    • V$SESSION

  • 반응형

    'ORACLE > ADMIN' 카테고리의 다른 글

    오라클 모니터링 쿼리  (0) 2011.12.21
    oracle inactive session 정리  (0) 2011.12.15
    Shared Server (MTS) Diagnostics [ID 1005259.6]  (0) 2011.12.08
    oracle MTS  (0) 2011.12.08
    오라클 패치 후 다시 원복 하기  (0) 2011.12.08
    Posted by [PineTree]
    ORACLE/ADMIN2011. 12. 8. 10:56
    반응형

    Shared Server (MTS) Diagnostics [ID 1005259.6]

      수정 날짜 29-SEP-2011     유형 BULLETIN     상태 PUBLISHED  

    In this Document
      Purpose
      Scope and Application
      Shared Server (MTS) Diagnostics
      References


    Applies to:

    Oracle Server - Enterprise Edition - Version: 8.1.5.0 to 10.2.0.1 - Release: 8.1.5 to 10.2
    Oracle Net Services - Version: 8.1.5.0.0 to 10.2.0.1.0   [Release: 8.1.5 to 10.2]
    Information in this document applies to any platform.

    Purpose

    Introduction

    This document contains information about the Shared Server configuration of the Oracle Database software and some of the SQL scripts necessary to gather diagnostic information with guidelines for interpreting results. Prior to Oracle 9.0, Shared Server was called Multi-Threaded Server; the name was changed to reflect the extensive enhancements made.

    Scope and Application

    Skill level rating for this Article: Intermediate

    Shared Server (MTS) Diagnostics

    Architecture of the Shared Server Database Configuration

    The best position to be in will always be based on understanding. The components of the Shared Server database configuration consist of the Dispatchers and the Shared Servers. These components run as separate processes in the operating system (or threads in some operating systems). They interact with each other through the use of a Common Queue (CQ - also known as the Virtual Queue, of which there could be multiple CQs) and individual Dispatcher Queues. Both queues reside in the Shared Global Area (SGA) and are sized automatically by the database itself. Another component of Shared Server is not a process but an abstraction of the user session(more of an owned pointer), called a Virtual Circuit (VC). The communication between the Dispatchers and Shared Servers is primarily done by passing ownership of a Virtual Circuit from one to another.

    Fig. 1: Diagram of Shared Server Architecture

    Fig. 1: Diagram of Shared Server Architecture

     

    The stages that Shared Server goes through are quite simple. After the client sends the connection request to the Listener, it will either redirect or hand off (called warm hand-off) the connection to the Dispatcher (the Dispatcher does not necessarily need to be on the same host as the Listener). Once the client has connected to a Dispatcher it stays connected to that Dispatcher. Before the client completes the database log in, the Dispatcher associates a Virtual Circuit (VC) for that database session. There exists exactly one row in the VC view (V$CIRCUIT) for each client connection. This view also shows the current status of the client's VC. Once the VC has been associated with the database session, the client will complete the database logon by passing the username and password to the Dispatcher. This request, as part of the VC for that new session, will be placed in the Common Queue where the first available Shared Server will complete the logon. Once each phase of the logon has completed, the Shared Server will pass the VC back to the Dispatcher, which then passes the response back to the Client (this actually takes several round trips to the client, in just the same manner as if it was a Dedicated connection).

    Once the logon has completed, the client starts a normal conversation with the database. When the client makes a request to the database, it is the Dispatcher that picks up this request from the operating system's network protocol. The Dispatcher then determines which client session the request came from (remember that a Dispatcher can be configured for Connection Pooling and Multiplexing: see the Net Administration Guide for more information on those configurations), tags that sessions' VC that there is a new message (there is also a pointer to that session buffer in the VC) and places the VC in the Common Queue. The CQ is serviced by the Shared Servers on a first-in-first-out basis. The next available Shared Server pulls the VC from the CQ and processes the request. Part of the VC structure is the identity of the Dispatcher that created it (and which client is connected to it). When the Shared Server is finished processing the request, it writes the output to the session buffer, changes the VC's ownership back to the Dispatcher that created it, places the VC into that Dispatcher's queue, and posts the Dispatcher it has something in its queue. The Dispatcher then checks its queue and sends what is in the session buffer through the operating system network protocol back to the Client.

    In the case where there is a request for a Database Link, it is the Shared Server process that will, from the link definition, create an outbound VC and place it into the least loaded Dispatcher's queue (not necessarily the same Dispatcher the Client is connected to). This Dispatcher then logs into the remote database and passes the query to it for processing. Once the remote database responds, the Dispatcher then places the VC back into that Shared Server's ownership.

    The Dispatchers are not limited to just the Oracle Net protocol. They also are able to understand FTP, HTTP(S), WebDAV, IIOP, SMTP, and TCP protocols.

     

    The main views containing Shared Server information include:

    V$CIRCUIT
    V$DISPATCHER
    V$DISPATCHER_CONFIG
    V$DISPATCHER_RATE
    V$QUEUE
    V$SESSION
    V$SHARED_SERVER
    V$SHARED_SERVER_MONITOR

    Dispatchers: The Number Of Dispatchers

     

    The number of Dispatchers present in a Shared Server database configuration may vary from zero up to the system INIT.ORA parameter of MAX_DISPATCHERS. The initial number of Dispatchers created at instance startup is the value defined by the DISPATCHERS parameter in the system INIT.ORA and can exceed the MAX_DISPATCHERS value (as of version 10). Both parameters can be altered at runtime by ALTER SYSTEM commands (version 9.0 onwards, consult the SQL Reference manual for the particular version being run).

    It is the PMON database background process that starts or stops any background processes, such as Dispatchers and Shared Servers. Dispatchers are not dynamically started or stopped, but must be manually maintained. Apart from restarting the database in order for the database to take on a new value set in the INIT.ORA, the following command may also be issued while the database is running:

    SQL> ALTER SYSTEM SET DISPATCHERS='string';

    Where 'string' is a valid setting for the DISPATCHERS parameter. For example:

    SQL> ALTER SYSTEM SET DISPATCHERS='(PROTOCOL=TCP )(DISPATCHERS=2)';
    SQL> ALTER SYSTEM SET DISPATCHERS='(PROTOCOL=TCPS)(DISPATCHERS=2)';

    PMON creates or destroys Dispatchers and then informs the Listener with their current state. PMON also updates the Listener about every ten seconds (depending on system load and other factors) with the current number of sessions and database load. To have PMON update the Listener with a change outside its normal cycle (as long as the LOCAL_LISTENER and REMOTE_LISTENER parameters are properly set in the system INIT.ORA) use this command:
    SQL> ALTER SYSTEM REGISTER;

    One can then query then Listener for the new services that have been registered:

     
    #> lsnrctl services

    LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 25-MAY-2006 17:26:51
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
      Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
        Handler(s):
          "DEDICATED" established:0 refused:0
          LOCAL SERVER
    Service "V10R2.us.oracle.com" has 1 instance(s).
      Instance "V10r2", status READY, has 5 handler(s) for this service...
        Handler(s): 
          "DEDICATED" established:1 refused:0 state:ready
              LOCAL SERVER
          "D000" established:0 refused:0 current:0 max:992 state:ready 
             DISPATCHER <machine: anrique, pid: 5591>
             (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38049))
          "D001" established:0 refused:0 current:0 max:992 state:ready
             DISPATCHER <machine: anrique, pid: 5593>
             (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38050))
          "D002" established:0 refused:0 current:0 max:992 state:ready
             DISPATCHER <machine: anrique, pid: 5595>
             (ADDRESS=(PROTOCOL=tcps)(HOST=anrique.us.oracle.com)(PORT=38051))
          "D003" established:0 refused:0 current:0 max:992 state:ready
             DISPATCHER <machine: anrique, pid: 5597>
             (ADDRESS=(PROTOCOL=tcps)(HOST=anrique.us.oracle.com)(PORT=38052))
    The command completed successfully

    From this output we can see that there are four dispatchers, two using TCP and two using TCPS. The TCP ports that are assigned to the Dispatchers were allocated by the operating system. To specify what port to use, each Dispatcher has to be configured individually specifying the port number in the ADDRESS parameter section (see the Oracle Net Administration Guide on how to assign ports to Dispatchers).

    Dispatchers can also be configured for a particular service. By default, each Dispatcher will service all SERVICE_NAMES and the DB_NAME. Dispatchers can be set up to only service a specific Service.


    SQL> ALTER SYSTEM SET DISPATCHERS='(PROTOCOL=TCP)(DISPATCHERS=1)(INDEX=1)(SERVICE=V10R2_DISP)';

    SQL> ALTER SYSTEM REGISTER;

    #> lsnrctl services
    LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 25-MAY-2006 18:54:39
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
    Services Summary...
      Service "PLSExtProc" has 1 instance(s).
        Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
          Handler(s):
            "DEDICATED" established:0 refused:0
            LOCAL SERVER
    Service "V10R2_DISP" has 1 instance(s).
      Instance "V10r2", status READY, has 1 handler(s) for this service...
       Handler(s):
          "D003" established:0 refused:0 current:0 max:992 state:ready
              DISPATCHER <machine: anrique, pid: 6071>
              (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38731)) 
    Service "V10r2" has 1 instance(s). 
       Instance "V10r2", 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:992 state:ready
             DISPATCHER <machine: anrique, pid: 6040>
             (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38697))
          "D001" established:0 refused:0 current:0 max:992 state:ready
             DISPATCHER <machine: anrique, pid: 6038>
             (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38696)) 
          "D000" established:0 refused:0 current:0 max:992 state:ready
             DISPATCHER <machine: anrique, pid: 6036>
             (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38692))
    The command completed successfully

     The command added one Dispatcher, D003, to service the SERVICE_NAME of V10R2_DISP (specified by the SERVICE clause). To get this Dispatcher to service V10R2_DISP the INDEX clause was used (INDEX can also be used to "separate" Dispatchers from other TCP Dispatchers). This new Dispatcher gets a new INDEX:


    SQL> SELECT CONF_INDX, NAME, NETWORK FROM V$DISPATCHER;

    CONF_INDX NAME NETWORK 
    --------- ---- ---------------------------------------------------------------- 
            0 D000 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38692)) 
            0 D001 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38696)) 
            0 D002 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38697)) 
            1 D003 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=38731))

     If the desire is to add more Dispatchers for a particular protocol, either issue the ALTER SYSTEM command specifying the full DESCRIPTION of the Dispatcher, or the Dispatcher's INDEX. For example, below are three Dispatchers configured for TCP and one configured for TCPS and there is a need to add one more TCP Dispatcher:


    SQL> SELECT CONF_INDX, NAME, NETWORK from V$DISPATCHER;

    CONF_INDX NAME NETWORK
    --------- ---- ----------------------------------------------------------------
            0 D000 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=1500))
            1 D001 (ADDRESS=(PROTOCOL=tcps)(HOST=anrique.us.oracle.com)(PORT=1501))
            0 D002 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=48236))
            0 D003 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=48237))

    SQL> ALTER SYSTEM SET DISPATCHERS='(INDEX=0)(PROTOCOL=TCP)(DISPATCHERS=4)';

    SQL> SELECT CONF_INDX, NAME, NETWORK FROM V$DISPATCHER;

    CONF_INDX NAME NETWORK
    --------- ---- ----------------------------------------------------------------
            0 D000 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=1500))
            1 D001 (ADDRESS=(PROTOCOL=tcps)(HOST=anrique.us.oracle.com)(PORT=1501))
            0 D002 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=48236))
            0 D003 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=48237))
            0 D004 (ADDRESS=(PROTOCOL=tcp)(HOST=anrique.us.oracle.com)(PORT=48248))

    Dispatchers: Shutting Down Dispatchers

    If the need is to shut down or reduce the number of Dispatchers by using the ALTER SYSTEM statement, the database can decide, or a specific Dispatchers can be chosen. To identify the name of the specific Dispatcher process to shut down, use the V$DISPATCHER view.


    SQL> SELECT CONF_INDX, NAME, NETWORK FROM V$DISPATCHER;

    CONF_INDX NAME NETWORK
    --------- ---- ----------------------------------------------------------------- 
            0 D000 (ADDRESS=(PROTOCOL=tcp) (HOST=anrique.us.oracle.com)(PORT=38049))
            0 D001 (ADDRESS=(PROTOCOL=tcp) (HOST=anrique.us.oracle.com)(PORT=38050))
            1 D002 (ADDRESS=(PROTOCOL=tcps)(HOST=anrique.us.oracle.com)(PORT=38051))
            1 D003 (ADDRESS=(PROTOCOL=tcps)(HOST=anrique.us.oracle.com)(PORT=38052))


    Each Dispatcher is uniquely identified by a name of the form Dnnn (where n is a number in the 0-9 range). In Unix, the Dispatcher process will have a name like ora_dnnn_sid. For Windows, the Dispatchers run as threads and are only visible using certain utilities, but the Oracle views will be the same. The Dispatchers are grouped by CONF_INDX based on the DESCRIPTION (or ADDRESS and PROTOCOL).

    To shut down Dispatcher D002, issue the following statement:

     

    SQL> ALTER SYSTEM SHUTDOWN 'D002';

     

    The Dispatcher stops accepting new connections and will wait until all of the sessions it handles are disconnected before shutting down.

    For a more "immediate" shutdown of the Dispatcher (it is in a bad state or it won't shutdown with the above command) issue this command:

     

    SQL> ALTER SYSTEM SHUTDOWN IMMEDIATE 'D002';

     

    The IMMEDIATE keyword stops the Dispatcher from accepting new connections and immediately terminates all existing connections through that Dispatcher. After all sessions are cleaned up, the Dispatcher process shuts down.

    When a Dispatcher is shut down, other Dispatchers will not inherit the name, so it is possible to see some Dispatchers missing. When starting up a new Dispatcher, it will obtain the next open Dispatcher name. In the case where TCPS D002 Dispatcher was shut down, and a new Dispatcher for TCP was started, the new Dispatcher will be called D002. 

    Dispatchers: Monitoring Performance

    In general, Dispatchers will not be very busy because their tasks are relatively quick to complete. In the example below, Dispatchers are less than 1% busy.


    SQL> SELECT NAME "NAME", SUBSTR(NETWORK,1,23) "PROTOCOL", OWNED,
       2 STATUS "STATUS", (BUSY/(BUSY + IDLE)) * 100 "%TIME BUSY"
       3 FROM V$DISPATCHER;

    NAME PROTOCOL                OWNED   STATUS %TIME BUSY
    ---- ----------------------- ------- ------ --------------
    D000 (ADDRESS=(PROTOCOL=tcp)      26   SEND .358392479
    D001 (ADDRESS=(PROTOCOL=tcp)       3   WAIT .251346468
    D002 (ADDRESS=(PROTOCOL=tcp)       5   WAIT .230378452
    D003 (ADDRESS=(PROTOCOL=tcp)       5   WAIT .563705148
    D004 (ADDRESS=(PROTOCOL=tcp)       0   WAIT 0


     The OWNED column of V$DISPATCHER view shows the number of clients currently connected to each Dispatcher. In the above example, a D000 has 26 clients connected. D000 is in the process of sending a message to a client as is shown by the SEND status. D004 has OWNED = 0 because it has just been started using the following command:

     

    SQL> ALTER SYSTEM SET DISPATCHERS='(PROTOCOL=TCP)(DISPATCHERS=5)';

     

    Dispatchers: Performance

    One perspective for interpreting Dispatcher performance is measuring the wait times in the various queues by querying the view V$QUEUE.


    SQL> SELECT D.NAME, Q.QUEUED, Q.WAIT, Q.TOTALQ,
       2 DECODE(Q.TOTALQ,0,0,(Q.WAIT/Q.TOTALQ)/100) "AVG WAIT"
       3 FROM V$QUEUE Q, V$DISPATCHER D
       4 WHERE D.PADDR = Q.PADDR;

    NAME QUEUED   WAIT TOTALQ AVG WAIT
    ---- ------ ------ ------ ------------
    D000      0  27800  28152 .00987496448
    D001      0  14304  10158 .01408151210
    D002      0  33390  12366 .02700145560
    D003      0  10833   9217 .01175328198

     


    SQL> SELECT Q.TYPE, Q.QUEUED, Q.WAIT, Q.TOTALQ,
    2 DECODE(Q.TOTALQ,0,0,(Q.WAIT/Q.TOTALQ)/100) "AVG WAIT"
    3 FROM V$QUEUE Q
    4 WHERE TYPE = 'COMMON'; 

    TYPE    QUEUED WAIT   TOTALQ AVG WAIT
    ------- ------ ------ ------ ------------
    COMMON       0 222657 43395  .05130936743

    In the above example, the WAIT column is the total amount of time all requests have waited in the particular queue. The TOTALQ column is the total number of requests in a queue since the startup of the database. The AVG WAIT denotes the average wait (in seconds) per queued request.

    The row with the TYPE of COMMON represents the Common Queue. The CQ holds all client requests to be processed by the Shared Servers. Please note that V$QUEUE view is not related to the Oracle Streams Advance Queuing feature. 

    Shared Servers: Setting the Quantity of Shared Servers

    The quantity of Shared Server processes will vary between INIT.ORA parameters SERVERS and MAX_SERVERS. Initially, the MAX_SERVERS value should be set to some estimated maximum number. For the initial setting, it can be set to the maximum number of expected sessions on the database (this is just a suggestion as it could also be set to far less). The effect of setting this parameter to a large value only affects the size of the Common Queue. This parameter can be changed dynamically by issuing the command:

     

    SQL> ALTER SYSTEM SET MAX_SHARED_SERVERS = {number}; 

     

    Setting the initial value for SERVERS is also estimated. It can be set to some number under the setting of MAX_SHARED_SERVERS. But once the system is running under production load, the parameter SERVERS can be changed to accommodate the load. The Oracle Database Performance Tuning Guide explains how to monitor V$QUEUE to determine if SERVERS should be increased:  


    SQL> SELECT DECODE(TOTALQ, 0, 'No Requests',
       2 WAIT/TOTALQ || ' HUNDREDTHS OF SECONDS') "AVERAGE WAIT TIME PER REQUESTS"
       3 FROM V$QUEUE
       4 WHERE TYPE = 'COMMON';

    AVERAGE WAIT TIME PER REQUEST
    -----------------------------
    .090909 HUNDREDTHS OF SECONDS

     If the system is suffering from high SYS load due to having to create and destroy many shared servers, then SERVERS might be set to one plus the number in SERVERS_HIGHWATER that is found in the V$SHARED_SERVER_MONITOR view (the name of the view is V$MTS in 8.1 and before).


    SQL> SELECT MAXIMUM_CONNECTIONS "MAX CONN", MAXIMUM_SESSIONS "MAX SESS",
       2 SERVERS_STARTED "STARTED", SERVERS_TERMINATED "TERMINATED",
       3 SERVERS_HIGHWATER "HIGHWATER"
       4 FROM V$SHARED_SERVER_MONITOR;

    MAX CONN MAX SESS STARTED TERMINATED HIGHWATER
    -------- -------- ------- ---------- ---------
         100      100       0          0        20


    Setting this parameter based on the SERVERS_HIGHWATER value will reduce the expense of process creation and match the known maximum of Shared Servers. These are just suggestions as to a starting point to configuring Shared Server. The Shared Server views should be monitored to make sure the settings are appropriate for this instance. Monitoring the instance initially to make sure the settings are correctly configured will assure a well-tuned system.

    Shared Server Performance

    Shared Servers are created by PMON. Upon instance startup, PMON will create them according to the value of the SHARED_SERVERS parameter. If more SHARED_SERVERS are needed, PMON will create them up to MAX_SHARED_SERVERS to meet the need. PMON will terminate idle Shared Servers until the number goes back to SHARED_SERVERS. When measuring the performance of the Shared Servers, it is normal to see the lower numbered Shared Servers to be busier then the higher numbered ones.


    SQL> SELECT NAME "NAME", PADDR, REQUESTS,
    2 (BUSY/(BUSY + IDLE)) * 100 "%TIME BUSY", STATUS
    3 FROM V$SHARED_SERVER;

    NAME PADDR              REQUESTS %TIME BUSY STATUS
    ---- ---------------- ---------- ---------- ----------------
    S000 000000030107D73B      51525 9.19084132 WAIT(RECEIVE)
    S001 000000030107B233      26817 5.07654792 WAIT(COMMON)
    S002 000000030107B3BE       6362 1.44008509 WAIT(RECEIVE)
    S006 000000030108574C         54 86.9953920 WAIT(RECEIVE)
    S008 000000030107B549          1 99.9994096 WAIT(ENQ)


     

    In the above example, all the Shared Servers are between 1% and 99% busy. Shared Server S008 is very busy processing a single client request and Shared Server S000 has been busy handling numerous smaller requests. In general, the S000 Shared Server will always be the busiest and could easily be 100% busy all the time. This is by design.

    The reason that S003-S005 and S007 are not listed is because the SHARED_SERVER parameter was set to 3 so PMON removed those Shared Servers because they went idle long enough to be removed. The idle interval cannot be set, nor does it need to be as it is more efficient to not have to create a Shared Server. S006 and S008 are not idle so they will exist as long as there is work for them to do.

    In the case where there is a gap in the %TIME BUSY, such as is illustrated above where higher numbered Shared Servers S006 and S008 are nearly 100% used. This could be due to some sessions having so much work to do that a Shared Server has been dedicated to that particular session. It is sessions like this that should be found and forced to connect with a Dedicated server processes. Such heavy sessions have enough continuous workload that the service time the Dispatcher adds may slow them down.

    The STATUS column of the V$SHARED_SERVER view provides useful information about WAIT status. In particular, the WAIT(ENQ) status tells the DBA that the user is waiting for a lock resource, and in rare cases, acts as an alert for a deadlock situation.

    An overview of server creation and termination and high-water mark is available from the V$SHARED_SERVER_MONITOR view.  


    SQL> SELECT MAXIMUM_CONNECTIONS "MAX CONN", MAXIMUM_SESSIONS "MAX SESS",
       2 SERVERS_STARTED "STARTED", SERVERS_TERMINATED "TERMINATED",
       3 SERVERS_HIGHWATER "HIGHWATER"
       4 FROM V$SHARED_SERVER_MONITOR;

    MAX CONN MAX_SESS STARTED TERMINATED HIGHWATER
    -------- -------- ------- ---------- ---------
          29       29       1          1         5

     

    The MAXIMUM_CONNECTIONS is the value of the maximum number of Virtual Circuits in use at one time.

    The MAXIMUM_SESSIONS is the highest number of Shared Server sessions in use at one time since the instance started.

    The SERVERS_STARTED and SERVERS_TERMINATED columns maintain a running total of Shared Server process creation and termination by PMON (but do not include the number set in the SHARED_SERVERS parameter).

    The SERVERS_HIGHWATER value holds the high-water mark for the Shared Server count since the instance startup.


    These statistics are useful indicators to check if SERVERS is set too low or too high. If the SERVERS_STARTED or SERVERS_TERMINATED are zero, this is an indication that too many Shared Servers may have been configured. Similarly, if the values of SERVERS_STARTED and SERVERS_TERMINATED grow quickly, the number for SHARED_SERVERS is likely to be too low and should be set to SERVERS_HIGHWATER + 1 (the "+ 1" is for good measure and has no intrinsic meaning).

     

    Virtual Circuits and Sessions

    The SERVER column in the V$SESSION view shows the type of Server that is currently servicing each session.


    SQL> SELECT SERVER, SUBSTR(USERNAME,1,15) "USERNAME",
       2 SUBSTR(OSUSER,1,8) "OS USER", SUBSTR(MACHINE,1,7) "MACHINE",
       3 SUBSTR(PROGRAM,1,35) "PROGRAM"
       4 FROM V$SESSION
       5 WHERE TYPE='USER';

    SERVER    USERNAME        OS USER  MACHINE PROGRAM
    --------- --------------- -------- ------- ---------------------------
    DEDICATED SYS             oracle   anrique sqlplus@anrique (TNS V1-V3)
    NONE      SCOTT           george   US-ORAC sqlplus.exe
    SHARED    SCOTT           bill     US-ORAC sqlplus.exe
    NONE      SCOTT           tina     US-ORAC sqlplus.exe
    NONE      BILL            harry    US-ORAC sqlplus.exe
    NONE      SCOTT           richard  US-ORAC sqlplus.exe
    NONE      SCOTT           kevin    US-ORAC sqlplus.exe
    NONE      SCOTT           andy     US-ORAC sqlplus.exe
    NONE      SCOTT           henry    US-ORAC sqlplus.exe
    NONE      SCOTT           jill     US-ORAC sqlplus.exe
    NONE      SCOTT           mary     US-ORAC sqlplus.exe
    DEDICATED                 oracle   anrique oracle@anrique (J000)
    NONE      SCOTT           sally    US-ORAC sqlplus.exe


    In the above example, DEDICATED means that client is connected with a dedicated server process. Shared Server connections appear as NONE or SHARED depending on whether a task is currently being serviced by a Shared Server or not. In this case only the OS User "bill" is being serviced by a Shared Server.

    The V$CIRCUIT view provides more detailed information about usage of circuits by each session.


    SQL> SELECT SADDR, CIRCUIT, DISPATCHER, SERVER, SUBSTR(QUEUE,1,8) "QUEUE",

       2 WAITER FROM V$CIRCUIT;

    SADDR            CIRCUIT          DISPATCHER       SERVER           QUEUE    WAITER
    ---------------- ---------------- ---------------- ---------------- -------- ----------------
    00000003010BC87B 00000003013CE6BC 000000030107B9EA 00               NONE     00
    00000003010BAA60 00000003013CEB88 000000030107BE8B 00               NONE     00
    00000003010C1198 00000003013CEDEE 000000030107B85F 00               NONE     00
    00000003010BD9AF 00000003013D05EA 000000030107B85F 000000030107B3BE SERVER   000000030107B3BE
    00000003010C04B1 00000003013D0D1C 000000030107B85F 00               NONE     00
    00000003010A5AEA 00000003013D5C42 000000030107B9EA 000000030107F92D SERVER   000000030107F92D


     The DISPATCHER column identifies the Oracle process ID for the Dispatcher Associated with the session. The SERVER column provides the Oracle process ID for the Shared Server currently servicing the client session, and zero if the session is not being serviced. For the QUEUE column, NONE represents the circuit is idle, SERVER means it is currently being serviced by a Shared Server, DISPATCHER means it is being serviced by a Dispatcher, and COMMON means it is on the Common Queue waiting to be picked up by a Shared Server.

    The WAITER column is the Oracle process ID of the process that is currently waiting for data to appear in the Circuit. It will contain "00" when no database operation is in progress, otherwise it will list the Oracle process id for the Dispatcher or a Shared Server. Dispatchers are very quick to complete their work, so quick that it is rare to catch a glimpse of a Dispatcher in the WAITER queue.

    References

    http://www.oracle.com/pls/db102/to_toc?pathname=server.102%2Fb14220%2Ftoc.htm&remark=portal+%28Books%29
    http://www.oracle.com/pls/db102/to_toc?pathname=server.102%2Fb14231%2Ftoc.htm&remark=portal+%28Books%29
    http://www.oracle.com/pls/db102/to_toc?pathname=server.102%2Fb14211%2Ftoc.htm&remark=portal+%28Books%29
    http://www.oracle.com/pls/db102/to_toc?pathname=network.102%2Fb14212%2Ftoc.htm&remark=portal+%28Books%29
    Previous versions of the above manuals

    첨부 파일 표시 첨부 파일


    Shared_Server.jpg (62.28 KB)

    관련 정보 표시 관련 자료


    제품
    • Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition
    • Oracle Database Products > Oracle Database > Net Services > Oracle Net Services
    키워드
    DISPATCHER; DISPATCHERS; MTS; PERFORMANCE; SHARED SERVER

    반응형

    'ORACLE > ADMIN' 카테고리의 다른 글

    oracle inactive session 정리  (0) 2011.12.15
    oracle Shared Server 와 Dedicate Server 의 접속 방식  (0) 2011.12.13
    oracle MTS  (0) 2011.12.08
    오라클 패치 후 다시 원복 하기  (0) 2011.12.08
    oracle shared pool size얼마나 남았나?  (0) 2011.11.22
    Posted by [PineTree]