今天在做塊的實驗時發現一個奇怪的問題。
以scott用戶登錄,創建表test_gdf,並插入4條數據,但不提交。
SQL> conn scott/tiger
Connected.
SQL> drop table test purge;
Table dropped.
SQL> create table test_gdf(a int,b varchar(4));
Table created.
SQL> insert into test_gdf values(0,'a');
1 row created.
SQL> insert into test_gdf values(0,'a');
1 row created.
SQL> insert into test_gdf values(0,'a');
1 row created.
SQL> insert into test_gdf values(0,'a');
1 row created.
SQL>
另起一個會話,以sysdba登錄
SQL*Plus: Release 10.2.0.4.0 - Production on Fri May 10 12:51:52 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> conn / as sysdba
Connected.
SQL> select owner,segment_name,extent_id,file_id,block_id,blocks from dba_extents where owner='SCOTT' and segment_name='TEST_GDF';
OWNER
------------------------------
SEGMENT_NAME
--------------------------------------------------------------------------------
EXTENT_ID FILE_ID BLOCK_ID BLOCKS
---------- ---------- ---------- ----------
SCOTT
TEST_GDF
0 4 401 8
SQL> ALTER system dump datafile 4 block min 401 block max 409;
System altered.
進入udump目錄:
[oracle@edhatGRA udump]$ ls -lt
total 2452
-rw-r-----. 1 oracle oinstall 16403 May 10 12:52 gdf_ora_2462.trc
-rw-r-----. 1 oracle oinstall 16250 May 10 12:47 gdf_ora_2439.trc
-rw-r-----. 1 oracle oinstall 446444 May 10 12:18 gdf_ora_2069.trc
-rw-r-----. 1 oracle oinstall 17133 May 10 11:59 gdf_ora_1997.trc
-rw-r-----. 1 oracle oinstall 1448 May 10 11:50 gdf_ora_1969.trc
-rw-r-----. 1 oracle oinstall 590 May 10 11:49 gdf_ora_1938.trc
-rw-r-----. 1 oracle oinstall 2851 May 9 10:09 gdf_ora_3086.trc
-rw-r-----. 1 oracle oinstall 618 May 9 10:04 gdf_ora_3056.trc
-rw-r-----. 1 oracle oinstall 4503 May 5 18:46 gdf_ora_2198.trc
-rw-r-----. 1 oracle oinstall 419362 May 5 18:11 gdf_ora_1961.trc
[oracle@edhatGRA udump]$vi gdf_ora_2462.trc 打開該文件,我們可以發現數據塊已經有內容了:
"gdf_ora_2462.trc" 415L, 16403C 1,1 Top
block_row_dump:
tab 0, row 0, @0x1f91
tl: 7 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [ 1] 80
col 1: [ 1] 61
tab 0, row 1, @0x1f8a
tl: 7 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [ 1] 80
col 1: [ 1] 61
tab 0, row 2, @0x1f83
tl: 7 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [ 1] 80
col 1: [ 1] 61
tab 0, row 3, @0x1f7c
tl: 7 fb: --H-FL-- lb: 0x1 cc: 2
col 0: [ 1] 80
col 1: [ 1] 61
end_of_block_dump
但是,當我再起一個會話,以scott用戶查詢test_gdf表,但什麼也查不到。
Last login: Fri May 10 11:49:36 2013 from 192.168.0.1
[oracle@edhatGRA ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Fri May 10 12:55:26 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> conn / as sysdba
Connected.
SQL> conn scott/tiger
Connected.
SQL> select * from test_gdf;
no rows selected
SQL>
疑問:我dump出來的是內存中的數據塊?還是數據文件的塊?