还是上次查询报错的例子:
ERROR:
ORA-01114: IO error writing block to file 201 (block # 1048178)
ORA-27069: skgfdisp: attempt to do I/O beyond the range of the file
OSD-04026: Invalid parameter passed. (OS 1048192)
ORA-01114: IO error writing block to file 201 (block # 1048178)
ORA-27069: skgfdisp: attempt to do I/O beyond the range of the file
OSD-04026: Invalid parameter passed. (OS 1048192)
我们看这里出现一个file 201,而查找数据字典就是找不到这个文件:
SQL> select file#,name from v$datafile;
FILE# NAME
———- ————————————————–
1 E:\ORADATA\DINSIGHT\SYSTEM01.DBF
2 D:\ oracle \ORADATA\DINSIGHT\UNDOTBS01.DBF
3 G:\DINSIGHT\INDX01.DBF
4 E:\ORADATA\DINSIGHT\TOOLS01.DBF
5 E:\ORADATA\DINSIGHT\USERS01.DBF
6 E:\ORADATA\DINSIGHT\PERFSTAT.DBF
已选择6行。
SQL> select file#,name from v$tempfile;
FILE# NAME
———- ————————————————–
1 F:\DINSIGHT\TEMP01.DBF
2 G:\DINSIGHT\TEMP02.DBF
3 G:\DINSIGHT\TEMP03.ORA
那这个201是怎么来的呢?查了一些资料,发现临时文件的文件号跟一般的文件是不一样的,临时文件有文件顺序号和绝对文件号(temp file absolute file number):
文件顺序号:v$tempfile.file#
绝对文件号:db_files+v$tempfile.file#(db_files在初始化参数中设定)
我们来验证一下:
SQL> show parameter db_files
NAME TYPE VALUE
———————————— ———– ——————————
db_files integer 200
SQL> select file#,name from v$tempfile;
FILE# NAME
———- ————————————————–
1 F:\DINSIGHT\TEMP01.DBF
2 G:\DINSIGHT\TEMP02.DBF
3 G:\DINSIGHT\TEMP03.ORA
这两个加起来刚好就是201
总结一下,查找临时文件的绝对文件号有两种方法:
1。db_files+v$tempfile.file#
SELECT file#+value AS file_id,t.name
FROM v$tempfile t,v$parameter p
WHERE p.name = ‘db_files’;
2。查找x$kcctf
select tfnum,tfafn,t.name
from x$kcctf x,v$tempfile t
where x.tfnum = t.file#;
SQL> desc x$kcctf;
名称 是否为空? 类型
—————————————– ——– ———————–
ADDR RAW(4)
INDX NUMBER
INST_ID NUMBER
TFNUM NUMBER
TFAFN NUMBER
TFCSZ NUMBER
TFBSZ NUMBER
TFSTA NUMBER
TFCRC_SCN VARCHAR2(16)
TFCRC_TIM VARCHAR2(20)
TFFNH NUMBER
TFFNT NUMBER
TFDUP NUMBER
TFTSN NUMBER
TFTSI NUMBER
TFRFN NUMBER
TFPFT NUMBER
SQL> select tfnum,tfafn,t.name
2 from x$kcctf x,v$tempfile t
3 where x.tfnum = t.file#;
TFNUM TFAFN NAME
———- ———- ————————————————–
1 201 F:\DINSIGHT\TEMP01.DBF
2 202 G:\DINSIGHT\TEMP02.DBF
3 203 G:\DINSIGHT\TEMP03.ORA
其中x$kcctf.tfnum为文件顺序号,而x$kcctf.tfafn为绝对文件号。
参考文档:
1。http://www.eygle.com/archives/2006/03/tempfile_and_sort_usage.html
No Comments
Be the first to comment on this entry.
Leave a comment
Fields in bold are required. Email addresses are never published or distributed.
Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>URLs must be fully qualified (eg: http://www.dbifan.com),and all tags must be properly closed.
Line breaks and paragraphs are automatically converted.
Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.