datafile autoextend 的信息记录在哪了呢

[复制链接]
查看11 | 回复9 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
datafile autoextend 的信息记录在哪了呢
设置数据文件autoextend on,数据文件会自动扩展;
这个扩展时数据库的内部动作是怎样的呢?
信息记录在什么地方了呢?
1. Auto extend 与 resize数据文件类似,但是:
alter database datafile 'path/file' resize N m;
这个会记录在alert日志中。
2.看v$datafile的bytes/create_bytes的变化,不过数据库创建时的文件create_bytes为0
SQL> select name,bytes/1024/1024,create_bytes/1024/1024 from v$datafile;
NAME
BYTES/1024/1024CREATE_BYTES/1024/1024
---------------------------------------- --------------- ----------------------
E:\ORACLE\ORADATA\O9I\SYSTEM01.DBF410 0
E:\ORACLE\ORADATA\O9I\UNDOTBS01.DBF 200 0
E:\ORACLE\ORADATA\O9I\CWMLITE01.DBF 20 0
E:\ORACLE\ORADATA\O9I\DRSYS01.DBF 20 0
E:\ORACLE\ORADATA\O9I\EXAMPLE01.DBF 149.375 0
E:\ORACLE\ORADATA\O9I\INDX01.DBF25 0
E:\ORACLE\ORADATA\O9I\ODM01.DBF 20 0
E:\ORACLE\ORADATA\O9I\TOOLS01.DBF 10 0
E:\ORACLE\ORADATA\O9I\USERS01.DBF 30 0
E:\ORACLE\ORADATA\O9I\XDB01.DBF38.125 0
E:\ORACLE\ORADATA\O9I\TEST1.DBF9 1
E:\ORACLE\ORADATA\O9I\TEST2.DBF4 1
已选择12行。
也就没法比较了...
3.我做了两个测试,针对这两次测试都做了
alter session set events '10046 trace name context forever,level 12';
测试1:创建了一个1m的表空间,创建一个大表把这个表空间撑大。
测试2:手工指定表空间更大的size.
分析这两个trace文件,看不太懂,只是能看到几个等待事件:
db file single write等
obj$,file$,seg$,tab$,col$,x$什么的
附录1:
当设置表空间resize/read only/read write时;
当alter table allocate extent (size 10M)/或者表把表空间撑大(auto extend)时;
都会有一个等待事件:“db file single write”
(
Oracle9i
Database Reference
Part No. A96536-02
Oracle Wait Events A-25
db file single write
This event is used to wait for the writing of the file headers.
Wait Time: The wait time is the actual time it takes to do the I/O
Parameters:
file#See "file#" on page A-15
block# See "block#" on page A-15
blocks This is the number of blocks that the session is
trying to write in file# starting at block#
)
在10G下,还会有一个“Data file init write”(这个没查到)
但是也不能说看到v$system_event里有上述等待事件就说数据文件是auto extend 了
附录2:
where can I find resized datafiles metadata
http://www.dba-village.com/dba/v ... read?ThreadIdA=9291
附录3:oracledba建议用:
_enable_tablespace_alerts ,参数怎么用还没看,首先这是个10G的参数,9I的怎么弄?
http://www.orafaq.com/parms/parm433.htm
说的不是很清楚,归结到一句话:
数据文件设置为自动扩展,怎么看数据文件扩展过了?
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
调整数据文件的大小是通过async disk io来实现的..
另外数据文件大小是在控制文件中记录的, file$记录的是数据文件创建的时候的大小..
db file single write 时间修改的数据文件头, control file parallel write修改的是对应的数据文件项的信息..
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
那么实际上比较file$和v$datafile的blocks数目就知道数据文件是否扩展过了。
多谢!!~
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
Subject:SYS.FILE$ Does not Display the Correct Size for Locally Managed Tablespace files
Doc ID:Note:182097.1 Type:PROBLEM
Last Revision Date:29-AUG-2002 Status:PUBLISHED
Explanation
-----------
For datafiles of dictionary managed tablespaces, column file$.blocks shows the
current size in blocks of the datafile.
For files in locally managed tablespaces, column file$.blocks shows the size
of the datafile at creation time. This column is never updated.
If the datafile extends for any reason (autoextend on or manual datafile resize),
the new size is stored in another table SYS.X$KTFBHC.
Column SYS.X$KTFBHC.KTFBHCSZ shows the current size in blocks of datafiles in
locally managed tablespaces.
SQL> select f.file#, f.blocks create_blocks, k.ktfbhcsz current_blocks
2from sys.file$ f, sys.x$ktfbhc k
3where f.file# = k.ktfbhcafno ;
FILE# CREATE_BLOCKS CURRENT_BLOCKS
---------- ------------- --------------

2 51200
51200

3
25
50
所以还有点遗留问题,就是字典管理表空间及TEMPFILE是否扩展的判断,继续研究... ...
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
create_bytes的信息怎么来的呢?
如果能得到这个就好办了
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
create_bytes 0的原因找到了。
如果是
1. cloned database
2. create database using template
是否有 其他原因 还不知道
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
总结下:
1、首先比较v$datafile/v$tempfiel : bytes/ create_bytes区别;
2、create_bytes=0(clone/template方式建的库)
a. lmt本地管理表空间 比较file$ /v$datafile blocks
b. dmt字典管理表空间,没法。
reference:
Subject: SYS.FILE$ Does not Display the Correct Size for Locally Managed Tablespace files
Doc ID: Note:182097.1 Type: PROBLEM
Last Revision Date: 29-AUG-2002 Status: PUBLISHED
Explanation
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
1、首先比较v$datafile/v$tempfiel : bytes/ create_bytes区别;
最初由 strongliq 发布
[B]总结下:
2、create_bytes=0(clone/template方式建的库)
[/B]

修改下:
create_bytes 为0的原因:
clone不是关键因素,重建控制文件是关键。普通数据库重建下控制文件时create_bytes就会变成0.
另一个原因create db 使用template没什么要解释的。还是否有别的原因不得而知。
a. lmt本地管理表空间 比较file$ /v$datafile blocks
b. dmt字典管理表空间,没法。
reference:
Subject: SYS.FILE$ Does not Display the Correct Size for Locally Managed Tablespace files
Doc ID: Note:182097.1 Type: PROBLEM
Last Revision Date: 29-AUG-2002 Status: PUBLISHED
Explanation
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
应该是在控制文件中吧。
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
呵呵,能否说说细节呢?
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行