数据块头部以0x60开始,块头包含object_id信息
SQL> select OWNER,OBJECT_NAME,OBJECT_ID from dba_objects where (OBJECT_NAME = 'TEST' or OBJECT_NAME = 'TEST_01') and OWNER='SYS';
OWNER OBJECT_NAME OBJECT_ID
-------- -- ----------------------- - ---------
SYS TEST 69802
SYS TEST_01 69803
SQL> select HWMINCR,FILE#,BLOCK#,BLOCKS from seg$ where FILE#=7;
HWMINCR FILE# BLOCK# BLOCKS
---------- - --------- ---------- ----------
69802 7 11 256
69803 7 267 8
dul程序扫描就从FILE#的第BLOCK#+1块开始,扫描到BLOCKS结束即可。
---------------------------------------------------------------------------------------------------------------
SQL> alter tablespace LMT add datafile '/opt/oracle/oradata/duxiu/lmt02' size 50m;
Tablespace altered.
SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME from dba_data_files;
FILE_NAME FILE_ID TABLESPACE_NAME
-------------------------------------------------- ---------- ------------------------------
/opt/oracle/oradata/duxiu/sysaux01.dbf 3 SYSAUX
/opt/oracle/oradata/duxiu/undotbs01.dbf 2 UNDOTBS1
/opt/oracle/oradata/duxiu/system02.dbf 1 SYSTEM
/opt/oracle/oradata/duxiu/users01.dbf 4 USERS
/opt/oracle/oradata/duxiu/test01.dbf 5 TEST01
/opt/oracle/oradata/duxiu/dul.dbf 6 DUL
/opt/oracle/oradata/duxiu/lmt.dbf 7 LMT
/opt/oracle/oradata/duxiu/lmt02 8 LMT
8 rows selected.
SQL> select TS#,NAME from v$tablespace;
TS# NAME
---------- ------------------------------
0 SYSTEM
1 UNDOTBS1
2 SYSAUX
3 TEMP
4 USERS
9 TEST01
16 DUL
11 TEMP2
17 LMT
9 rows selected.
SQL> select OWNER,SEGMENT_NAME,TABLESPACE_NAME,EXTENT_ID,FILE_ID,BLOCK_ID,BLOCKS from dba_extents where SEGMENT_NAME='HELLO';
OWNER SEGMENT_NAME TABLESP EXTENT_ID FILE_ID BLOCK_ID BLOCKS
-------- --------------- ------- ---------- ---------- ---------- ----------
SYS HELLO LMT 0 7 273 8
SYS HELLO LMT 1 7 281 8
SYS HELLO LMT 2 7 289 8
SYS HELLO LMT 3 7 297 8
SYS HELLO LMT 4 7 305 8
SYS HELLO LMT 5 7 313 8
SYS HELLO LMT 6 7 321 8
SYS HELLO LMT 7 7 329 8
SYS HELLO LMT 8 7 337 8
SYS HELLO LMT 9 7 345 8
SYS HELLO LMT 10 7 353 8
SYS HELLO LMT 11 7 361 8
SYS HELLO LMT 12 7 369 8
SYS HELLO LMT 13 7 377 8
SYS HELLO LMT 14 7 385 8
SYS HELLO LMT 15 8 9 8
SYS HELLO LMT 16 7 393 128
17 rows selected.
SQL> select HWMINCR,FILE#,BLOCK#,BLOCKS from seg$ where TS#=17;
HWMINCR FILE# BLOCK# BLOCKS
---------- ---------- ---------- ----------
69802 7 11 256
69803 7 267 8
69806 7 275 256