... lob (COL_NAME) store as basicfile | securefile "SEG_NAME" (...);
... lob (COL_NAME) store as basicfile "SEG_NAME" (enable | disable storage in row);
... lob (COL_NAME) store as basicfile "SEG_NAME" (chunk 8192);
... lob (COL_NAME) store as basicfile "SEG_NAME" (retention | pctversion 50);
22924, 00000, "snapshot too old"
*Cause: The version of the LOB value needed for the consistent read was
already overwritten by another writer.
*Action: Use a larger version pool.
... lob (COL_NAME) store as securefile "SEG_NAME" ( ... retention auto) ;
... lob (COL_NAME) store as securefile "SEG_NAME" ( ... retention min 900) ;
... lob (COL_NAME) store as securefile "SEG_NAME" ( ... retention none) ;
... lob (COL_NAME) store as securefile "SEG_NAME" ( ... retention max (storage maxsize 400M)) ;
... lob (COL_NAME) store as basicfile "SEG_NAME" (cache | nocache | cache reads);
SQL> create table lob_update_test (a clob);
-- Table segment, Lob segment Extent 확장
insert into lob_update_test select substr(a, 1, 1981) from lob_raw;
insert into lob_update_test select substr(a, 1, 1983) from lob_raw;
delete lob_update_test;
-- 테스트 데이터 삽입
insert into lob_update_test select substr(a, 1, 1981) from lob_raw;
-- 1981 -> 1982자: in row update
SQL> update lob_update_test set a=a||'a';
-- 1982 -> 1983자: in -> out row update
SQL> update lob_update_test set a=a||'a';
-- 1983 -> 1984자: out -> out row update
SQL> update lob_update_test set a=a||'a';
-- 1984 -> 1981자: out -> in row update
SQL> update lob_update_test set a=substr(a, 1, 1981); -- out --> in row update
-- 1981 -> 1982자: in row update
SQL> update lob_update_test set a=a||'a';
8192 rows updated.
Elapsed: 00:00:12.58
-- 1982 -> 1983자: in -> out row update
SQL> update lob_update_test set a=a||'a';
8192 rows updated.
Elapsed: 00:00:20.37
-- 1983 -> 1984자: out -> out row update
SQL> update lob_update_test set a=a||'a';
8192 rows updated.
Elapsed: 00:00:24.15
-- 1984 -> 1981자: out -> in row update
SQL> update lob_update_test set a=substr(a, 1, 1981);
8192 rows updated.
Elapsed: 00:00:13.21
SQL> create table lob_direct_test (a clob) lob(a) store as basicfile (disable storage in row);
Table created.
SQL> insert into lob_direct_test select a from lob_raw_small;
3000 rows created.
-- Buffer 에 캐싱
SQL> select * from lob_direct_test;
...
A
--------------------------------------------------------------------------------
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
3000 rows selected.
SQL> alter session set events '10046 trace name context forever, level 12' ;
Session altered.
SQL> select * from lob_direct_test;
...
A
--------------------------------------------------------------------------------
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
3000 rows selected.
-- 10046 trace --> tkprof 변환
********************************************************************************
SQL ID: gu15dbd8v74zk Plan Hash: 4217871914
select *
from
lob_direct_test
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 17 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 3001 0.02 0.07 0 3005 0 3000
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3003 0.02 0.07 0 3022 0 3000
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 84
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
---------- ---------- ---------- ---------------------------------------------------
3000 3000 3000 TABLE ACCESS FULL LOB_DIRECT_TEST (cr=3005 pr=0 pw=0 time=12426 us cost=5 size=6006000 card=3000)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 3002 0.00 0.00
SQL*Net message from client 3002 0.74 0.84
********************************************************************************
********************************************************************************
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 17 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 3001 0.02 0.07 0 3005 0 3000
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3003 0.02 0.07 0 3022 0 3000
Misses in library cache during parse: 1
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 6003 0.00 0.00
SQL*Net message from client 6003 15.44 16.43
Disk file operations I/O 2 0.00 0.00
direct path read 6000 0.00 0.05
log file sync 1 0.12 0.12
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 1 2 1
Fetch 1 0.00 0.00 0 16 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 5 0.00 0.00 0 17 2 2
Misses in library cache during parse: 1
Misses in library cache during execute: 1
2 user SQL statements in session.
1 internal SQL statements in session.
3 SQL statements in session.
********************************************************************************
Trace file: lob_direct_test.trc
Trace file compatibility: 11.1.0.7
Sort options: default
1 session in tracefile.
2 user SQL statements in trace file.
1 internal SQL statements in trace file.
3 SQL statements in trace file.
3 unique SQL statements in trace file.
24195 lines in trace file.
1 elapsed seconds in trace file.
=====================
PARSING IN CURSOR #140502644297648 len=29 dep=0 uid=84 oct=3 lid=84 tim=1384572185091261 hv=1370723314 ad='783d7a60' sqlid='gu15dbd8v74zk'
select * from lob_direct_test
END OF STMT
PARSE #140502644297648:c=3000,e=3710,p=0,cr=17,cu=0,mis=1,r=0,dep=0,og=1,plh=4217871914,tim=1384572185091260
EXEC #140502644297648:c=0,e=12,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=4217871914,tim=1384572185091308
WAIT #140502644297648: nam='SQL*Net message to client' ela= 7 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1384572185091360
WAIT #140502644297648: nam='SQL*Net message from client' ela= 130 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1384572185091496
WAIT #140502644297648: nam='SQL*Net message to client' ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1384572185091554
FETCH #140502644297648:c=0,e=52,p=0,cr=4,cu=0,mis=0,r=1,dep=0,og=1,plh=4217871914,tim=1384572185091570
WAIT #140502644297648: nam='SQL*Net message from client' ela= 61 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1384572185091647
WAIT #0: nam='Disk file operations I/O' ela= 52 FileOperation=2 fileno=5 filetype=2 obj#=79315 tim=1384572185091921
WAIT #0: nam='direct path read' ela= 19 file number=5 first dba=435500 block cnt=1 obj#=79315 tim=1384572185091970
WAIT #0: nam='direct path read' ela= 5 file number=5 first dba=435500 block cnt=1 obj#=79315 tim=1384572185092022
.
.
.
WAIT #0: nam='SQL*Net message from client' ela= 39 driver id=1650815232 #bytes=1 p3=0 obj#=79315 tim=1384572186011006
FETCH #140502644297648:c=0,e=4,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=4217871914,tim=1384572186011028
STAT #140502644297648 id=1 cnt=3000 pid=0 pos=1 obj=79314 op='TABLE ACCESS FULL LOB_DIRECT_TEST (cr=3005 pr=0 pw=0 time=12426 us cost=5 size=6006000 card=3000)'
WAIT #140502644297648: nam='SQL*Net message to client' ela= 2 driver id=1650815232 #bytes=1 p3=0 obj#=79315 tim=1384572186011095
SQL> select segment_name, blocks from dba_segments where segment_name in (
2 'LOB_DIRECT_TEST','SYS_LOB0000079317C00001$$','SYS_IL0000079317C00001$$'
3 );
SEGMENT_NAME BLOCKS
--------------------------------------------------------------------------------- ----------
SYS_LOB0000079317C00001$$ 3072
SYS_IL0000079317C00001$$ 32
LOB_DIRECT_TEST 16
-- Test Table 생성
SQL> create table lob_qb_test2 (id number, a clob) lob(a) store as QBSEG2 (disable storage in row);
SQL> create table lob_qb_test3 (
val1 varchar(4000),
val2 varchar(4000),
val3 varchar(4000),
val4 varchar(4000),
val5 varchar(4000),
val6 varchar(4000),
val7 varchar(4000),
val8 varchar(4000),
a clob
) lob(a) store as QBSEG3 (disable storage in row);
-- Test 데이터 입력
SQL> insert into lob_qb_test2 select rownum id, a from lob_raw_small;
SQL> insert into lob_qb_test3 select a, a, a, a, a, a, a, a, a from lob_raw_small;
SQL> commit;
- Size 확인
SEGMENT_NAME BLOCKS
------------------------------- ----------
LOB_QB_TEST2 16 -- Table2
QBSEG2 3072 -- Lob Segment2
SYS_IL0000079299C00002$$ 32 -- Lob Index2
LOB_QB_TEST3 6144 -- Table3
QBSEG3 3072 -- Lob Segment3
SYS_IL0000079305C00009$$ 32 -- Lob Index3
SQL> alter session set events '10046 trace name context forever, level 12' ;
SQL> select /*+ full(t) noparallel(t) */ id from lob_qb_test2 t;
SQL> select /*+ full(t) noparallel(t) */ id, a from lob_qb_test2 t;
SQL> select /*+ full(t) noparallel(t) */ * from lob_qb_test3 t;
********************************************************************************
SQL ID: ct1cryakrby3n Plan Hash: 3454962022
select /*+ full(t) noparallel(t) */ id
from
lob_qb_test2 t
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 17 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 201 0.00 0.00 0 216 0 3000
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 203 0.00 0.00 0 233 0 3000
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 84
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
---------- ---------- ---------- ---------------------------------------------------
3000 3000 3000 TABLE ACCESS FULL LOB_QB_TEST2 (cr=216 pr=0 pw=0 time=1434 us cost=5 size=39000 card=3000)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 201 0.00 0.00
SQL*Net message from client 201 2.60 2.63
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 17 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 201 0.00 0.00 0 216 0 3000
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 203 0.00 0.00 0 233 0 3000
Misses in library cache during parse: 1
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 202 0.00 0.00
SQL*Net message from client 202 12.28 14.92
log file sync 1 0.03 0.03
********************************************************************************
SQL ID: 538uyahv081gc Plan Hash: 3454962022
select /*+ full(t) noparallel(t) */ id, a
from
lob_qb_test2 t
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.05 14 17 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 3001 0.02 0.07 0 3003 0 3000
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3003 0.03 0.13 14 3020 0 3000
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 84
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
---------- ---------- ---------- ---------------------------------------------------
3000 3000 3000 TABLE ACCESS FULL LOB_QB_TEST2 (cr=3003 pr=0 pw=0 time=14151 us cost=5 size=603000 card=3000)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
Disk file operations I/O 1 0.00 0.00
db file sequential read 1 0.04 0.04
SQL*Net message to client 3002 0.00 0.00
SQL*Net message from client 3002 1.98 2.08
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.05 14 17 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 3001 0.02 0.07 0 3003 0 3000
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3003 0.03 0.13 14 3020 0 3000
Misses in library cache during parse: 1
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 6003 0.00 0.00
SQL*Net message from client 6003 23.53 25.78
Disk file operations I/O 1 0.00 0.00
db file sequential read 22 0.04 0.05
direct path read 6000 0.01 0.08
log file sync 1 0.04 0.04
********************************************************************************
h3.C. 기타
SQL> select ceil(c)+1 from lob_test_f;
,ceil(c)+1
*
ERROR at line 4:
ORA-00932: inconsistent datatypes: expected NUMBER got CLOB
SQL> select reverse(a) from lob_test1;
select reverse(a) from lob_test1
*
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected CHAR got CLOB
SQL> select vsize(a) from lob_test2;
select vsize(a) from lob_test2
*
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected - got CLOB
SQL> select initcap(a) from lob_test1;
select initcap(a) from lob_test1
*
ERROR at line 1:
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 12000, maximum: 4000)
SQL> select translate(a,'a','b') from lob_test1;
select translate(a,'a','b') from lob_test1
*
ERROR at line 1:
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 12000, maximum: 4000)
- 강좌 URL : http://www.gurubee.net/lecture/3837
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.