楼主: eygle

[精华] 关于HWM的一点研究!

[复制链接]
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
11#
发表于 2003-3-15 13:22 | 只看该作者

o

LMT 存在  segment header ,保留一个块

从第二个块开始

字典管理表空间从第二个块开始

如果设置了 freelist  group ,假设为 n

则从 n + 2 个块开始


对于 ASSM管理方式又有区别了

使用道具 举报

回复
招聘 : 数据库管理员
论坛徽章:
66
ITPUB元老
日期:2005-07-16 18:49:11授权会员
日期:2005-10-30 17:05:33ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44现任管理团队成员
日期:2011-05-07 01:45:08版主3段
日期:2012-05-15 15:24:11
12#
发表于 2003-3-15 22:59 | 只看该作者
呵呵,楼主果然是做学问的,有点不明白,
似乎初始分配的两个块就没有被使用,为什么?

使用道具 举报

回复
论坛徽章:
117
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20版主7段
日期:2012-05-15 15:24:11ITPUB 11周年纪念徽章
日期:2012-09-28 17:34:42ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:32紫蛋头
日期:2013-03-04 17:00:07优秀写手
日期:2013-12-18 09:29:09
13#
 楼主| 发表于 2003-3-16 22:27 | 只看该作者
最初由 xzh2000 发布
[B]似乎初始分配的两个块就没有被使用,为什么? [/B]


不是没用而是用作管理了,你想,如果都用来存放用户数据
Oracle岂不是连这个文件都找不到了么?

以下是测试结果,在没有freelist group的情况下

对于DMT

SQL> alter system dump datafile 10 block 1;

系统已更改。

SQL> alter system dump datafile 10 block 2;

系统已更改。

以下是内容:

*** 2003-03-16 00:19:41.255
*** SESSION ID9.14) 2003-03-16 00:19:41.245
Start dump data blocks tsn: 14 file#: 10 minblk 1 maxblk 1
Block 1 (file header) [/COLOR] not dumped: use dump file header command
End dump data blocks tsn: 14 file#: 10 minblk 2 maxblk 1
Start dump data blocks tsn: 14 file#: 10 minblk 2 maxblk 2
buffer tsn: 14 rdba: 0x02800002 (10/2)
scn: 0x0000.000c5f94 seq: 0x02 flg: 0x00 tail: 0x5f941002
frmt: 0x02 chkval: 0x0000 type: 0x10=DATA SEGMENT HEADER - UNLIMITED

  Extent Control Header
  -----------------------------------------------------------------
  Extent Header:: spare1: 0      space2: 0      #extents: 2      #blocks: 9     
                  last map  0x00000000  #maps: 0      offset: 4128  
      Highwater::  0x02800003  ext#: 0      blk#: 0      ext size: 4     
  #blocks in seg. hdr's freelists: 0     
  #blocks below: 0     
  mapblk  0x00000000  offset: 0     
      Disk Lock:: Locked by scn:  0x0002.042.00000188
     Map Header:: next  0x00000000  #extents: 2    obj#: 17601  flag: 0x40000000
  Extent Map
  -----------------------------------------------------------------
   0x02800003  length: 4     
   0x02800007  length: 5     
  
  nfl = 1, nfb = 1 typ = 1 nxf = 0 ccnt = 0
  SEG LST:: flg: UNUSED lhd: 0x00000000 ltl: 0x00000000
End dump data blocks tsn: 14 file#: 10 minblk 2 maxblk 2

第一块是文件头
第二块是头块

也就是Oracle的管理空间:

使用道具 举报

回复
论坛徽章:
117
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20版主7段
日期:2012-05-15 15:24:11ITPUB 11周年纪念徽章
日期:2012-09-28 17:34:42ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:32紫蛋头
日期:2013-03-04 17:00:07优秀写手
日期:2013-12-18 09:29:09
14#
 楼主| 发表于 2003-3-16 22:32 | 只看该作者
对于LMT

SQL> create tablespace LMT
  2  datafile 'C:\ORACLE\ORADATA\VILEN\LMT.DBF' size 10m
  3  extent management local uniform size 64k;

表空间已创建。

SQL> create user lmt identified by lmt
  2  default tablespace lmt
  3  temporary tablespace temp;

用户已创建

SQL> grant connect,resource,dba to lmt;

授权成功。

SQL> connect lmt/lmt
已连接。

SQL> select tablespace_name,file_id,block_id,bytes from  user_free_space where tablespace_name='LMT';

TABLESPACE    FILE_ID   BLOCK_ID      BYTES
---------- ---------- ---------- ----------
LMT                11          9   10420224

SQL> alter system dump datafile 11 block 1;

系统已更改。

SQL> alter system dump datafile 11 block 2;

系统已更改。

SQL> alter system dump datafile 11 block 3;

系统已更改。
Dump文件:

*** 2003-03-16 00:09:50.585
Start dump data blocks tsn: 15 file#: 11 minblk 1 maxblk 1
Block 1 (file header) [/COLOR] not dumped: use dump file header command
End dump data blocks tsn: 15 file#: 11 minblk 2 maxblk 1
*** 2003-03-16 00:10:14.690
Start dump data blocks tsn: 15 file#: 11 minblk 2 maxblk 2
buffer tsn: 15 rdba: 0x02c00002 (11/2)
scn: 0x0000.000c6074 seq: 0x01 flg: 0x00 tail: 0x60741d01
frmt: 0x02 chkval: 0x0000 type: 0x1d=KTFB Bitmapped File Space Header

File Space Header Block:
Header Control:
RelFno: 11, Unit: 8, Size: 1280, Flag: 1
AutoExtend: NO, Increment: 0, MaxSize: 0
Initial Area: 7, Tail: 1280, First: 0, Free: 159
Header Opcode:
Save: No Pending Op
End dump data blocks tsn: 15 file#: 11 minblk 2 maxblk 2

Start dump data blocks tsn: 15 file#: 11 minblk 3 maxblk 3
buffer tsn: 15 rdba: 0x02c00003 (11/3)
scn: 0x0000.000c606e seq: 0x01 flg: 0x00 tail: 0x606e1e01
frmt: 0x02 chkval: 0x0000 type: 0x1e=KTFB Bitmapped File Space Bitmap

File Space Bitmap Block:
BitMap Control:
RelFno: 11, BeginBlock: 9, Flag: 0, First: 0, Free: 63488
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000000
...............
End dump data blocks tsn: 15 file#: 11 minblk 3 maxblk 3

LMT多用了一个块来作为bitmap管理空间

使用道具 举报

回复
论坛徽章:
26
ITPUB元老
日期:2005-02-28 12:57:00生肖徽章:兔
日期:2006-09-26 21:29:55生肖徽章:兔
日期:2006-09-07 17:01:32生肖徽章:兔
日期:2006-09-07 17:02:25生肖徽章:兔
日期:2006-09-07 17:02:46生肖徽章:兔
日期:2006-09-07 17:06:29生肖徽章:兔
日期:2006-09-18 05:26:00生肖徽章:狗
日期:2006-10-06 13:28:27生肖徽章:狗
日期:2006-10-08 05:28:34生肖徽章2007版:鸡
日期:2008-01-02 17:35:53
15#
发表于 2003-3-18 10:38 | 只看该作者
Up.........

使用道具 举报

回复
论坛徽章:
0
16#
发表于 2003-3-18 15:04 | 只看该作者
收益非千

使用道具 举报

回复
论坛徽章:
3
授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34ITPUB元老
日期:2006-09-11 15:36:37
17#
发表于 2003-3-19 10:35 | 只看该作者
eygle 樓主﹕為何我依葫蘆畫出的結果卻大相徑庭﹐我Dump文件中的HWM值只有一次改變﹐即從 0x03000003 變成了0x03000005.再就一直沒有變過﹐是否和版本有關我的是8.1.7.0.0.
而后我truncate表也沒有改變其hwm回到 0x03000003。請問這是為什么﹖
還想問一下利用Alter system dump datafile xxx block xxx 生成的跟蹤文件是怎么樣的一原則﹐當我改變文件ID時它的跟蹤內容還是會放在上面的同一文件中。跟蹤文件是按會話存放的嗎﹖
謝謝您﹗

使用道具 举报

回复
论坛徽章:
11
授权会员
日期:2005-10-30 17:05:33BLOG每日发帖之星
日期:2010-06-27 01:01:02BLOG每日发帖之星
日期:2010-03-27 01:01:04BLOG每日发帖之星
日期:2009-06-18 01:01:02BLOG每日发帖之星
日期:2009-06-07 01:01:02BLOG每日发帖之星
日期:2009-01-22 01:01:06生肖徽章2007版:猴
日期:2008-01-02 17:35:53生肖徽章2007版:鸡
日期:2008-01-02 17:35:53参与2007年甲骨文全球大会(中国上海)纪念
日期:2007-08-06 15:19:01会员2006贡献徽章
日期:2006-04-17 13:46:34
18#
发表于 2003-3-19 20:05 | 只看该作者
不錯謝謝

使用道具 举报

回复
招聘 : 数据架构师
论坛徽章:
68
2012新春纪念徽章
日期:2012-01-04 11:49:54林肯
日期:2014-01-07 22:06:452014年新春福章
日期:2014-02-18 16:41:11马上有车
日期:2014-02-18 16:41:11马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上加薪
日期:2014-02-19 11:55:14夏利
日期:2013-12-27 14:27:00
19#
发表于 2003-4-2 18:14 | 只看该作者
请问一下,是不是hwm只有在9i里面才可以用。
我怎么在oracle7.3.4上做的时候它提示如下错误

SVRMGR> alter system dump datafile 10 block 2;

alter system dump datafile 10 block 2
                  *
ORA-01961: Invalid dump option

使用道具 举报

回复
论坛徽章:
4
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34ITPUB技术丛书作者
日期:2010-09-26 15:24:56
20#
发表于 2003-4-4 14:05 | 只看该作者
我也补充一个检查文件的hwm的方法(主要用于resize 的时候):
SQL> declare
  2 cursor c_dbfile is
  3 select tablespace_name
  4 ,file_name
  5 ,file_id
  6 ,bytes
  7 from sys.dba_data_files
  8 where status !='INVALID'
  9 order by tablespace_name,file_id;
10 cursor c_space(v_file_id in number) is
11 select block_id,blocks
12 from sys.dba_free_space
13 where file_id=v_file_id
14 order by block_id desc;
15 blocksize binary_integer;
16 filesize binary_integer;
17 extsize binary_integer;
18 begin
19 select value
20 into blocksize
21 from v$parameter
22 where name = 'db_block_size';
23 for c_rec1 in c_dbfile
24 loop
25 filesize := c_rec1.bytes;
26 <<outer>>
27 for c_rec2 in c_space(c_rec1.file_id)
28 loop
29 extsize := ((c_rec2.block_id - 1)*blocksize + c_rec2.blocks*blocksize);
30 if extsize = filesize
31 then
32 filesize := (c_rec2.block_id - 1)*blocksize;
33 else
34 exit outer;
35 end if;
36 end loop outer;
37 if filesize = c_rec1.bytes
38 then
39 dbms_output.put_line('Tablespace: '
40 ||' '||c_rec1.tablespace_name||' Datafile: '||c_rec1.file_name);
41 dbms_output.put_line('Can not be resized, no free space at end of file.')
42 ;
43 dbms_output.put_line('.');
44 else
45 if filesize < 2*blocksize
46 then
47 dbms_output.put_line('Tablespace: '
48 ||' '||c_rec1.tablespace_name||' Datafile: '||c_rec1.file_name);
49 dbms_output.put_line('Can be resized uptil: '||2*blocksize
50 ||' Bytes, Actual size: '||c_rec1.bytes||' Bytes');
51 dbms_output.put_line('.');
52 else
53 dbms_output.put_line('Tablespace: '
54 ||' '||c_rec1.tablespace_name||' Datafile: '||c_rec1.file_name);
55 dbms_output.put_line('Can be resized uptil: '||filesize
56 ||' Bytes, Actual size: '||c_rec1.bytes);
57 dbms_output.put_line('.');
58 end if;
59 end if;
60 end loop;
61 end;
62 /

Tablespace: DRSYS Datafile: /usr/oracle/data/oradata/cint208/drsys01.dbf
Can be resized uptil: 4333568 Bytes, Actual size: 5242880
.
Tablespace: INDX Datafile: /usr/oracle/data/oradata/cint208/indx01.dbf
Can be resized uptil: 16384 Bytes, Actual size: 5242880 Bytes
.
Tablespace: RBS Datafile: /usr/oracle/data/oradata/cint208/rbs01.dbf
Can be resized uptil: 57155584 Bytes, Actual size: 57671680
.
Tablespace: SYSTEM Datafile: /usr/oracle/data/oradata/cint208/system01.dbf
Can be resized uptil: 280182784 Bytes, Actual size: 283115520
.
Tablespace: TEMP Datafile: /usr/oracle/data/oradata/cint208/temp01.dbf
Can be resized uptil: 16384 Bytes, Actual size: 5242880 Bytes
.
Tablespace: TESTSPACE Datafile: /usr/oracle/data/oradata/cint208/testspace1.dbf
Can be resized uptil: 16384 Bytes, Actual size: 5242880 Bytes
.
Tablespace: TOOLS Datafile: /usr/oracle/data/oradata/cint208/tools01.dbf
Can be resized uptil: 16384 Bytes, Actual size: 5242880 Bytes
.
Tablespace: USERS Datafile: /usr/oracle/data/oradata/cint208/users01.dbf
Can be resized uptil: 23076864 Bytes, Actual size: 23592960
.

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL>

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表