- 最后登录
- 2014-9-5
- 在线时间
- 20 小时
- 威望
- -2
- 金钱
- 128
- 注册时间
- 2013-4-9
- 阅读权限
- 0
- 帖子
- 21
- 精华
- 0
- 积分
- -2
- UID
- 1030
|
1#
发表于 2013-12-12 09:45:05
|
查看: 6437 |
回复: 4
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
1、查询等待事件
SQL> select w.inst_id,w.sid,w.p1,w.p2,w.p3,w.event from gv$session_wait w where event like '%enq%';
INST_ID SID P1 P2 P3 EVENT
---------- ---------- ---------- ---------- ---------- ----------------------------------------------------------------
2 12 1414725635 996 2 enq: TS - contention
2 106 1414725635 996 2 enq: TS - contention
2 505 1414725635 996 2 enq: TS - contention
2 595 1414725635 996 2 enq: TS - contention
2、查询lock
SQL> SELECT DECODE (request, 0, 'Holder: ', 'Waiter: ') status, SID, inst_id,ctime, id1, id2, lmode, request, TYPE
2 FROM gv$lock WHERE (id1, id2, TYPE) IN (SELECT id1, id2, TYPE FROM gv$lock WHERE request > 0);
STATUS SID INST_ID CTIME ID1 ID2 LMODE REQUEST TYPE
-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
Waiter: 12 2 7045 996 2 0 3 TS
Waiter: 106 2 7045 996 2 0 3 TS
Holder: 296 2 2346382 996 2 3 0 TS
Waiter: 505 2 7045 996 2 0 3 TS
Waiter: 595 2 7045 996 2 0 3 TS
3、查询等待进程
SQL> select inst_id,sid,username,type,PROCESS,PROGRAM,EVENT from gv$session where sid=296 and inst_id=2;
INST_ID SID USERNAME TYPE PROCESS PROGRAM EVENT
---------- ---------- ------------------------------ ---------- ------------------------ ------------------------------------------------ ----------------------------------------------------------------
2 296 BACKGROUND 28518 oracle@xsjrac02 (SMON) smon timer
4、查询临时表空间大小
SQL> SELECT A.tablespace_name tablespace, D.mb_total,
2 SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
3 D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
4 FROM v$sort_segment A,
5 (
6 SELECT B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 mb_total
7 FROM v$tablespace B, v$tempfile C
8 WHERE B.ts#= C.ts#
9 GROUP BY B.name, C.block_size
10 ) D
11 WHERE A.tablespace_name = D.name
12 GROUP by A.tablespace_name, D.mb_total;
TABLESPACE MB_TOTAL MB_USED MB_FREE
------------------------------- ---------- ---------- ----------
TEMP01 163839.921 1955 161884.921
SQL> select ts# from sys.ts$ where name = 'TEMP01' and online$ != 3;
TS#
----------
996
5、手动触发SMON进程回收临时段
SQL> ALTER SESSION SET events 'immediate trace name DROP_SEGMENTS level 997';
Session altered
6、等待事件依然存在
SQL> select w.inst_id,w.sid,w.p1,w.p2,w.p3,w.event from gv$session_wait w where event like '%enq%';
INST_ID SID P1 P2 P3 EVENT
---------- ---------- ---------- ---------- ---------- ----------------------------------------------------------------
2 12 1414725635 996 2 enq: TS - contention
2 106 1414725635 996 2 enq: TS - contention
2 505 1414725635 996 2 enq: TS - contention
2 595 1414725635 996 2 enq: TS - contention
6、临时表空间的使用情况
SQL> select INST_ID,TABLESPACE_NAME TSNAME,TOTAL_EXTENTS TOTAL,USED_EXTENTS USED,FREE_EXTENTS FREE from gv$sort_segment order by inst_id;
INST_ID TSNAME TOTAL USED FREE
---------- ------------------------------- ---------- ---------- ----------
1 TEMP01 31915 57 31858
2 TEMP01 29903 711 29192
问题:
1、临时表空间的空间大小是没问题。
2、两个节点分配临时表空间大小几乎相等,而且USED < FREE 。
按照这样来分析的话那就不应该有enq: TS - contention等待事件。
3、假如以上分析不正确的话,按照Oracle提供解决enq: TS - contention的方法ALTER SESSION SET events 'immediate trace name DROP_SEGMENTS level tablespace#';
执行完后enq: TS - contention并没有消失,一直存在。
请教高手指点。
谢谢! |
|