[20150113]关于oracle的存储结构.txt
--这阵子在看vage写的>,里面第一章提到:
--P2
--每个文件的前128个块,都是文件头,被Oracle留用了。在oracle 10g中是0-8号块被oracle留用。而从oracle 11GR2开始,一下就留用
-- 128个块。
而实际的情况呢?自己做一个测试:
1.测试环境:
--我的测试环境:数据块大小8K。
SCOTT@test> @ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.3.0 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
CREATE TABLESPACE TOOLSX DATAFILE
'/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE 1M AUTOEXTEND OFF
LOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;
2.测试:
SCOTT@test> create table emp2 tablespace toolsx as select * from emp;
Table created.
SCOTT@test> column PARTITION_NAME noprint
SCOTT@test> select * from dba_extents where owner=user and segment_name='EMP2';
OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
------ ------------- ------------- -------------------------- ---------- ---------- ---------- ---------- ------------
SCOTT EMP2 TABLE TOOLSX 0 12 8 65536 8 12
alter system dump datafile 12 block min 2 block max 8;
$ egrep 'type: 0x|buffer tsn' test_ora_2245_127_0_0_1.trc
buffer tsn: 1065 rdba: 0x03000002 (12/2)
frmt: 0x02 chkval: 0x2500 type: 0x1d=KTFB Bitmapped File Space Header
buffer tsn: 1065 rdba: 0x03000003 (12/3)
frmt: 0x02 chkval: 0x8608 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000004 (12/4)
frmt: 0x02 chkval: 0x49f7 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000005 (12/5)
frmt: 0x02 chkval: 0x09fe type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000006 (12/6)
frmt: 0x02 chkval: 0xc9e5 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000007 (12/7)
frmt: 0x02 chkval: 0x89ec type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000008 (12/8)
frmt: 0x02 chkval: 0xc84e type: 0x20=FIRST LEVEL BITMAP BLOCK
--很明显block_id=8,也就是前面0-7块保留。0=>os块头,1=>文件头,2=>KTFB Bitmapped File Space Header,
--3-7块=>KTFB Bitmapped File Space Bitmap。
--8 块=> FIRST LEVEL BITMAP BLOCK. 属于emp2.
--更正: 在前面的测试中
# grep "file#=53" /u01/app/oracle/admin/XXXXX/udump/XXXXX_ora_27286.trc
WAIT #3: nam='db file sequential read' ela= 22629 file#=53 block#=2 blocks=1 obj#=-1 tim=1387739800835263
WAIT #3: nam='db file sequential read' ela= 32533 file#=53 block#=3 blocks=1 obj#=-1 tim=1387739800867833
WAIT #3: nam='db file sequential read' ela= 8026 file#=53 block#=4 blocks=1 obj#=-1 tim=1387739800876024
WAIT #3: nam='db file sequential read' ela= 13044 file#=53 block#=5 blocks=1 obj#=-1 tim=1387739800889224
WAIT #3: nam='db file sequential read' ela= 8026 file#=53 block#=6 blocks=1 obj#=-1 tim=1387739800897403
WAIT #3: nam='db file sequential read' ela= 278 file#=53 block#=7 blocks=1 obj#=-1 tim=1387739800897835
WAIT #3: nam='db file sequential read' ela= 121 file#=53 block#=8 blocks=1 obj#=-1 tim=1387739800898104
WAIT #3: nam='db file sequential read' ela= 15648 file#=53 block#=4194297 blocks=1 obj#=-1 tim=1387739800913902
WAIT #3: nam='db file sequential read' ela= 9974 file#=53 block#=4194298 blocks=1 obj#=-1 tim=1387739800924029
WAIT #3: nam='db file sequential read' ela= 527 file#=53 block#=4194299 blocks=1 obj#=-1 tim=1387739800924709
--block#=8 不是位图块,实际上从block#=2开始扫描,到block#=8发现不是停止。在扫描tail+1的数据块。
3.删除数据文件,重新建立:
SCOTT@test> drop table emp2 purge;
Table dropped.
SCOTT@test> drop tablespace toolsx;
Tablespace dropped.
CREATE TABLESPACE TOOLSX DATAFILE
'/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE 2M reuse AUTOEXTEND OFF
LOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;
SCOTT@test> create table emp2 tablespace toolsx as select * from emp;
Table created.
SCOTT@test> select * from dba_extents where owner=user and segment_name='EMP2';
OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
------ ------------- ------------- --------------------------- ---------- ---------- ---------- ---------- ------------
SCOTT EMP2 TABLE TOOLSX 0 12 128 65536 8 12
SCOTT@test> alter system checkpoint ;
System altered.
SCOTT@test> alter system dump datafile 12 block min 2 block max 128;
System altered.
$ egrep 'type: 0x|buffer tsn' test_ora_3208_127_0_0_1.trc
buffer tsn: 1065 rdba: 0x03000002 (12/2)
frmt: 0x02 chkval: 0x24f1 type: 0x1d=KTFB Bitmapped File Space Header
buffer tsn: 1065 rdba: 0x03000003 (12/3)
frmt: 0x02 chkval: 0x8680 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000004 (12/4)
frmt: 0x02 chkval: 0x497f type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000005 (12/5)
frmt: 0x02 chkval: 0x0976 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000006 (12/6)
frmt: 0x02 chkval: 0xc96d type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000007 (12/7)
frmt: 0x02 chkval: 0x8964 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000008 (12/8)
frmt: 0x02 chkval: 0x4952 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000009 (12/9)
frmt: 0x02 chkval: 0x095b type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300000a (12/10)
frmt: 0x02 chkval: 0xc940 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300000b (12/11)
frmt: 0x02 chkval: 0x8949 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300000c (12/12)
frmt: 0x02 chkval: 0x4935 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300000d (12/13)
frmt: 0x02 chkval: 0x093c type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300000e (12/14)
frmt: 0x02 chkval: 0xc927 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300000f (12/15)
frmt: 0x02 chkval: 0x892e type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000010 (12/16)
frmt: 0x02 chkval: 0x4908 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000011 (12/17)
frmt: 0x02 chkval: 0x0901 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000012 (12/18)
frmt: 0x02 chkval: 0xc91a type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000013 (12/19)
frmt: 0x02 chkval: 0x8913 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000014 (12/20)
frmt: 0x02 chkval: 0x49eb type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000015 (12/21)
frmt: 0x02 chkval: 0x09e2 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000016 (12/22)
frmt: 0x02 chkval: 0xc9f9 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000017 (12/23)
frmt: 0x02 chkval: 0x89f0 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000018 (12/24)
frmt: 0x02 chkval: 0x49c6 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000019 (12/25)
frmt: 0x02 chkval: 0x09cf type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300001a (12/26)
frmt: 0x02 chkval: 0xc9d4 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300001b (12/27)
frmt: 0x02 chkval: 0x89dd type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300001c (12/28)
frmt: 0x02 chkval: 0x49a1 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300001d (12/29)
frmt: 0x02 chkval: 0x09a8 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300001e (12/30)
frmt: 0x02 chkval: 0xc9b3 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300001f (12/31)
frmt: 0x02 chkval: 0x89ba type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000020 (12/32)
frmt: 0x02 chkval: 0x49bc type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000021 (12/33)
frmt: 0x02 chkval: 0x09b5 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000022 (12/34)
frmt: 0x02 chkval: 0xc9ae type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000023 (12/35)
frmt: 0x02 chkval: 0x89a7 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000024 (12/36)
frmt: 0x02 chkval: 0x49a7 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000025 (12/37)
frmt: 0x02 chkval: 0x085e type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000026 (12/38)
frmt: 0x02 chkval: 0xc855 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000027 (12/39)
frmt: 0x02 chkval: 0x884c type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000028 (12/40)
frmt: 0x02 chkval: 0x484a type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000029 (12/41)
frmt: 0x02 chkval: 0x0873 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300002a (12/42)
frmt: 0x02 chkval: 0xc878 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300002b (12/43)
frmt: 0x02 chkval: 0x8861 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300002c (12/44)
frmt: 0x02 chkval: 0x486d type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300002d (12/45)
frmt: 0x02 chkval: 0x0814 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300002e (12/46)
frmt: 0x02 chkval: 0xc81f type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300002f (12/47)
frmt: 0x02 chkval: 0x8806 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000030 (12/48)
frmt: 0x02 chkval: 0x4810 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000031 (12/49)
frmt: 0x02 chkval: 0x0829 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000032 (12/50)
frmt: 0x02 chkval: 0xc822 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000033 (12/51)
frmt: 0x02 chkval: 0x883b type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000034 (12/52)
frmt: 0x02 chkval: 0x4833 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000035 (12/53)
frmt: 0x02 chkval: 0x08ca type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000036 (12/54)
frmt: 0x02 chkval: 0xc8c1 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000037 (12/55)
frmt: 0x02 chkval: 0x88d8 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000038 (12/56)
frmt: 0x02 chkval: 0x48de type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000039 (12/57)
frmt: 0x02 chkval: 0x08e7 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300003a (12/58)
frmt: 0x02 chkval: 0xc8ec type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300003b (12/59)
frmt: 0x02 chkval: 0x88f5 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300003c (12/60)
frmt: 0x02 chkval: 0x48f9 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300003d (12/61)
frmt: 0x02 chkval: 0x0880 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300003e (12/62)
frmt: 0x02 chkval: 0xc88b type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300003f (12/63)
frmt: 0x02 chkval: 0x8892 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000040 (12/64)
frmt: 0x02 chkval: 0x48e4 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000041 (12/65)
frmt: 0x02 chkval: 0x08dd type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000042 (12/66)
frmt: 0x02 chkval: 0xc8d6 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000043 (12/67)
frmt: 0x02 chkval: 0x88cf type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000044 (12/68)
frmt: 0x02 chkval: 0x48cf type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000045 (12/69)
frmt: 0x02 chkval: 0x08c6 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000046 (12/70)
frmt: 0x02 chkval: 0xcb3d type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000047 (12/71)
frmt: 0x02 chkval: 0x8b34 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000048 (12/72)
frmt: 0x02 chkval: 0x4b22 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000049 (12/73)
frmt: 0x02 chkval: 0x0b2b type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300004a (12/74)
frmt: 0x02 chkval: 0xcb10 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300004b (12/75)
frmt: 0x02 chkval: 0x8b19 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300004c (12/76)
frmt: 0x02 chkval: 0x4b05 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300004d (12/77)
frmt: 0x02 chkval: 0x0b0c type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300004e (12/78)
frmt: 0x02 chkval: 0xcb77 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300004f (12/79)
frmt: 0x02 chkval: 0x8b7e type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000050 (12/80)
frmt: 0x02 chkval: 0x4b78 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000051 (12/81)
frmt: 0x02 chkval: 0x0b71 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000052 (12/82)
frmt: 0x02 chkval: 0xcb4a type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000053 (12/83)
frmt: 0x02 chkval: 0x8b43 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000054 (12/84)
frmt: 0x02 chkval: 0x4b5b type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000055 (12/85)
frmt: 0x02 chkval: 0x0b52 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000056 (12/86)
frmt: 0x02 chkval: 0xcba9 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000057 (12/87)
frmt: 0x02 chkval: 0x8ba0 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000058 (12/88)
frmt: 0x02 chkval: 0x4bb6 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000059 (12/89)
frmt: 0x02 chkval: 0x0bbf type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300005a (12/90)
frmt: 0x02 chkval: 0xcb84 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300005b (12/91)
frmt: 0x02 chkval: 0x8b8d type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300005c (12/92)
frmt: 0x02 chkval: 0x4b91 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300005d (12/93)
frmt: 0x02 chkval: 0x0b98 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300005e (12/94)
frmt: 0x02 chkval: 0xcbe3 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300005f (12/95)
frmt: 0x02 chkval: 0x8bea type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000060 (12/96)
frmt: 0x02 chkval: 0x4bcc type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000061 (12/97)
frmt: 0x02 chkval: 0x0bc5 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000062 (12/98)
frmt: 0x02 chkval: 0xcbfe type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000063 (12/99)
frmt: 0x02 chkval: 0x8bf7 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000064 (12/100)
frmt: 0x02 chkval: 0x4bf7 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000065 (12/101)
frmt: 0x02 chkval: 0x0bee type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000066 (12/102)
frmt: 0x02 chkval: 0xcbe5 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000067 (12/103)
frmt: 0x02 chkval: 0x8a1c type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000068 (12/104)
frmt: 0x02 chkval: 0x4a1a type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000069 (12/105)
frmt: 0x02 chkval: 0x0a03 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300006a (12/106)
frmt: 0x02 chkval: 0xca08 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300006b (12/107)
frmt: 0x02 chkval: 0x8a31 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300006c (12/108)
frmt: 0x02 chkval: 0x4a3d type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300006d (12/109)
frmt: 0x02 chkval: 0x0a24 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300006e (12/110)
frmt: 0x02 chkval: 0xca2f type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300006f (12/111)
frmt: 0x02 chkval: 0x8a56 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000070 (12/112)
frmt: 0x02 chkval: 0x4a40 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000071 (12/113)
frmt: 0x02 chkval: 0x0a59 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000072 (12/114)
frmt: 0x02 chkval: 0xca52 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000073 (12/115)
frmt: 0x02 chkval: 0x8a6b type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000074 (12/116)
frmt: 0x02 chkval: 0x4a63 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000075 (12/117)
frmt: 0x02 chkval: 0x0a7a type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000076 (12/118)
frmt: 0x02 chkval: 0xca71 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000077 (12/119)
frmt: 0x02 chkval: 0x8a88 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000078 (12/120)
frmt: 0x02 chkval: 0x4a8e type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000079 (12/121)
frmt: 0x02 chkval: 0x0a97 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300007a (12/122)
frmt: 0x02 chkval: 0xca9c type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300007b (12/123)
frmt: 0x02 chkval: 0x8aa5 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300007c (12/124)
frmt: 0x02 chkval: 0x4aa9 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300007d (12/125)
frmt: 0x02 chkval: 0x0ab0 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300007e (12/126)
frmt: 0x02 chkval: 0xcabb type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x0300007f (12/127)
frmt: 0x02 chkval: 0x8ac2 type: 0x1e=KTFB Bitmapped File Space Bitmap
buffer tsn: 1065 rdba: 0x03000080 (12/128)
frmt: 0x02 chkval: 0xd430 type: 0x20=FIRST LEVEL BITMAP BLOCK
--很明显block_id=128,也就是前面0-127块保留。0=>os块头,1=>文件头,2=>KTFB Bitmapped File Space Header,
--3-127块=>KTFB Bitmapped File Space Bitmap。
--128 块=> FIRST LEVEL BITMAP BLOCK. 属于emp2.
--仅仅数据文件大于一定程度(我这里是2M),建立的数据文件0-127才是文件头,被oracle留用。
4.确定一下边界是那里,就是建立的数据文件是多少才会保留前面0-127块:
--估计一下,至少存在1个区,64k(对于8k的数据块),也就是建立文件大小1024+64=1088K就出现这种情况,
--因为建立的数据文件不计算OS块头,所以建立的数据文件大小还有减少8k,也就是建立1080K就可以实现,验证看看:
$ cat guess_keep_128.sql
drop table emp2 purge ;
drop tablespace toolsx;
CREATE TABLESPACE TOOLSX DATAFILE
'/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE &1 k reuse AUTOEXTEND OFF
LOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;
create table emp2 tablespace toolsx as select * from emp where rownumcolumn PARTITION_NAME noprint
select * from dba_extents where owner=user and segment_name='EMP2';
SCOTT@test> @ guess_keep_128.sql 1072
Table dropped.
Tablespace dropped.
old 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE &1 k reuse AUTOEXTEND OFF
new 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE 1072 k reuse AUTOEXTEND OFF
Tablespace created.
Table created.
OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
------ -------------------- ------------------ ------------------------------ ---------- ---------- ---------- ---------- ---------- ------------
SCOTT EMP2 TABLE TOOLSX 0 12 8 65536 8 12
SCOTT@test> @ guess_keep_128.sql 1080
Table dropped.
Tablespace dropped.
old 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE &1 k reuse AUTOEXTEND OFF
new 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE 1080 k reuse AUTOEXTEND OFF
Tablespace created.
Table created.
OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
------ -------------------- ------------------ ------------------------------ ---------- ---------- ---------- ---------- ---------- ------------
SCOTT EMP2 TABLE TOOLSX 0 12 128 65536 8 12
--可以发现当建立的数据文件大小等于1080K时,保留前面的0-127块。
5.补充测试,也说明建立的数据文件(系统管理的表空间),最小是64+64-8=120k.真的吗?
-- 测试是最好的证明。
SCOTT@test> @guess_keep_128.sql 112
Table dropped.
Tablespace dropped.
old 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE &1 k reuse AUTOEXTEND OFF
new 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE 112 k reuse AUTOEXTEND OFF
Tablespace created.
Table created.
OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
------ -------------------- ------------------ ------------------------------ ---------- ---------- ---------- ---------- ---------- ------------
SCOTT EMP2 TABLE TOOLSX 0 12 4 65536 8 12
--^_^,不对,很明显block_id=4,也就是前面0-3块保留。
--32+64-8 = 88K. 这样最小是88k。
SCOTT@test> @guess_keep_128.sql 88
Table dropped.
Tablespace dropped.
old 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE &1 k reuse AUTOEXTEND OFF
new 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE 88 k reuse AUTOEXTEND OFF
Tablespace created.
Table created.
OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS RELATIVE_FNO
------ -------------------- ------------------ ------------------------------ ---------- ---------- ---------- ---------- ---------- ------------
SCOTT EMP2 TABLE TOOLSX 0 12 4 65536 8 12
SCOTT@test> @guess_keep_128.sql 80
Table dropped.
Tablespace dropped.
old 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE &1 k reuse AUTOEXTEND OFF
new 2: '/u01/app/oracle11g/oradata/test/tools01x.dbf' SIZE 80 k reuse AUTOEXTEND OFF
CREATE TABLESPACE TOOLSX DATAFILE
*
ERROR at line 1:
ORA-03214: File Size specified is smaller than minimum required
create table emp2 tablespace toolsx as select * from emp where rownum *
ERROR at line 1:
ORA-00959: tablespace 'TOOLSX' does not exist
no rows selected
--总结:
--实际上这个测试并没有什么实际的意义,很少建立这么小的数据文件。仅仅说明特定的情况下会出现这种情况。