DBMS_ROWID
SQL> col obj_no new_value obj_no
SQL> col file_no new_value file_no
SQL> col block_no new_value block_no
SQL> col row_no new_value row_no
SQL> select sid, row_wait_obj# as obj_no, row_wait_file# as file_no,
row_wait_block# as block_no, row_wait_row# as row_no
from v$session
where event = 'enq: TX - row lock contention';
rowid_type
1값은 DBMS_ROWID.ROWID_TYPE_EXTENDED
을 말한다.DBMS_ROWID.ROWID_TYPE_RESTRICTED
가 있고 이 값은 0이다.
SQL> col rid new_value rid
SQL> select dbms_rowid.rowid_create(rowid_type => 1,
object_number => &obj_no, relative_fno => &file_no,
block_number => &block_no, row_number => &row_no) as rid
from dual;
위에서 추출한 값을 기반으로 어떤 로우에 해당하는지 검색할 수 있다.
SQL> select * from t1 where rowid = '&rid';
SQL> select
dbms_rowid.rowid_type('&rid') as rtype,
dbms_rowid.rowid_object('&rid') as obj_no,
dbms_rowid.rowid_relative_fno('&rid') as file_no,
dbms_rowid.rowid_block_number('&rid') as block_no,
dbms_rowid.rowid_row_number('&rid') as row_no
from dual;
SQL >col obj_no new_value obj_no
SQL >col file_no new_value file_no
SQL >col block_no new_value block_no
SQL >col row_no new_value row_no
SQL >select sid, row_wait_obj# as obj_no, row_wait_file# as file_no,
row_wait_block# as block_no, row_wait_row# as row_no
from v$session
where event = 'enq: TX - row lock contention';
SID OBJ_NO FILE_NO BLOCK_NO ROW_NO
---------- ---------- ---------- ---------- ----------
1149 65277 7 83 0
SQL >col rid new_value rid
SQL >select dbms_rowid.rowid_create(rowid_type => 1,
object_number => &obj_no, relative_fno => &file_no,
block_number => &block_no, row_number => &row_no) as rid
from dual;
old 2: object_number => &obj_no, relative_fno => &file_no,
new 2: object_number => 65277, relative_fno => 7,
old 3: block_number => &block_no, row_number => &row_no) as rid
new 3: block_number => 83, row_number => 0) as rid
RID
------------------
AAAP79AAHAAAABTAAA
SQL >select * from oracle.t1 where rowid = '&rid';
old 1: select * from oracle.t1 where rowid = '&rid'
new 1: select * from oracle.t1 where rowid = 'AAAP79AAHAAAABTAAA'
C1 C2
---------- ----
1 many
SQL >select
dbms_rowid.rowid_type('&rid') as rtype,
dbms_rowid.rowid_object('&rid') as obj_no,
dbms_rowid.rowid_relative_fno('&rid') as file_no,
dbms_rowid.rowid_block_number('&rid') as block_no,
dbms_rowid.rowid_row_number('&rid') as row_no
from dual;
old 2: dbms_rowid.rowid_type('&rid') as rtype,
new 2: dbms_rowid.rowid_type('AAAP79AAHAAAABTAAA') as rtype,
old 3: dbms_rowid.rowid_object('&rid') as obj_no,
new 3: dbms_rowid.rowid_object('AAAP79AAHAAAABTAAA') as obj_no,
old 4: dbms_rowid.rowid_relative_fno('&rid') as file_no,
new 4: dbms_rowid.rowid_relative_fno('AAAP79AAHAAAABTAAA') as file_no,
old 5: dbms_rowid.rowid_block_number('&rid') as block_no,
new 5: dbms_rowid.rowid_block_number('AAAP79AAHAAAABTAAA') as block_no,
old 6: dbms_rowid.rowid_row_number('&rid') as row_no
new 6: dbms_rowid.rowid_row_number('AAAP79AAHAAAABTAAA') as row_no
RTYPE OBJ_NO FILE_NO BLOCK_NO ROW_NO
---------- ---------- ---------- ---------- ----------
1 65277 7 83 0
SQL >
- 강좌 URL : http://www.gurubee.net/lecture/4280
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.