左右v$datafile和v$tempfile中间file#
v$datafile关于存储在文件中的数据视图的信息,v$tempfile查看存储在一个临时文件中的信息。
有两种观点file#现场,首先来看看官方文件的定义:
V$DATAFILE
This view contains datafile information from the control file.
See Also:
"V$DATAFILE_HEADER", which displays information from datafile headers
Column | Datatype | Description |
---|---|---|
FILE# |
NUMBER |
File identification number |
CREATION_CHANGE# |
NUMBER |
Change number at which the datafile was created |
CREATION_TIME |
DATE |
Timestamp of the datafile creation |
TS# |
NUMBER |
Tablespace number |
RFILE# |
NUMBER |
Tablespace relative datafile number |
STATUS |
VARCHAR2(7) |
Type of file (system or user) and its status. Values: OFFLINE , ONLINE , SYSTEM , RECOVER , SYSOFF (anoffline file from the SYSTEM tablespace) |
ENABLED |
VARCHAR2(10) |
Describes how accessible the file is from SQL:
|
CHECKPOINT_CHANGE# |
NUMBER |
SCN at last checkpoint |
CHECKPOINT_TIME |
DATE |
Timestamp of the checkpoint# |
UNRECOVERABLE_CHANGE# |
NUMBER |
Last unrecoverable change number made to this datafile. If the database is in ARCHIVELOG mode, then this column is updated when an unrecoverable operationcompletes. If the database is not in ARCHIVELOG mode, this column does not get updated. |
UNRECOVERABLE_TIME |
DATE |
Timestamp of the last unrecoverable change. This column is updated only if the database is in ARCHIVELOG mode. |
LAST_CHANGE# |
NUMBER |
Last change number made to this datafile (null if the datafile is being changed) |
LAST_TIME |
DATE |
Timestamp of the last change |
OFFLINE_CHANGE# |
NUMBER |
Offline change number of the last offline range. This column is updated only when the datafile is brought online. |
ONLINE_CHANGE# |
NUMBER |
Online change number of the last offline range |
ONLINE_TIME |
DATE |
Online timestamp of the last offline range |
BYTES |
NUMBER |
Current datafile size (in bytes); 0 if inaccessible |
BLOCKS |
NUMBER |
Current datafile size (in blocks); 0 if inaccessible |
CREATE_BYTES |
NUMBER |
Size when created (in bytes) |
BLOCK_SIZE |
NUMBER |
Block size of the datafile |
NAME |
VARCHAR2(513) |
Name of the datafile |
PLUGGED_IN |
NUMBER |
Describes whether the tablespace is plugged in. The value is 1 if the tablespace is plugged in and has not been made read/write, 0 ifnot. |
BLOCK1_OFFSET |
NUMBER |
Offset from the beginning of the file to where the Oracle generic information begins. The exact length of the file can be computed as follows:BYTES + BLOCK1_OFFSET . |
AUX_NAME |
VARCHAR2(513) |
Auxiliary name that has been set for this file via CONFIGURE AUXNAME |
FIRST_NONLOGGED_SCN |
NUMBER |
First nonlogged SCN |
FIRST_NONLOGGED_TIME |
DATE |
First nonlogged time |
V$TEMPFILE
This view displays tempfile information.
Column | Datatype | Description |
---|---|---|
FILE# |
NUMBER |
Absolute file number |
CREATION_CHANGE# |
NUMBER |
Creation System Change Number (SCN) |
CREATION_TIME |
DATE |
Creation time |
TS# |
NUMBER |
Tablespace number |
RFILE# |
NUMBER |
Relative file number in the tablespace |
STATUS |
VARCHAR2(7) |
Status of the file (OFFLINE |ONLINE ) |
ENABLED |
VARCHAR2(10) |
Enabled for read and/or write |
BYTES |
NUMBER |
Size of the file in bytes (from the file header) |
BLOCKS |
NUMBER |
Size of the file in blocks (from the file header) |
CREATE_BYTES |
NUMBER |
Creation size of the file (in bytes) |
BLOCK_SIZE |
NUMBER |
Block size for the file |
NAME |
VARCHAR2(513) |
Name of the file |
从上面的文档能够看出。在v$tempfile和v$datafile中file#均代表绝对文件好,而rfile#代表相对文件号,以下来验证一下:
SQL> l
1* select file#,name from v$tempfile
SQL> / FILE# NAME
---------- ------------------------------------------------------------
1 /home/app/oraten/oradata/oraten/temp01.dbf
SQL> select file#,name from v$datafile; FILE# NAME
---------- ------------------------------------------------------------
1 /home/app/oraten/oradata/oraten/system01.dbf
2 /home/app/oraten/oradata/oraten/undotbs01.dbf
3 /home/app/oraten/oradata/oraten/sysaux01.dbf
4 /home/app/oraten/oradata/oraten/users01.dbf
5 /home/app/oraten/oradata/oraten/test01.dbf
在v$datafile和v$tempfile中都存在绝对文件号为1的文件。这显然是不正确的。
我们知道在文件无法訪问时,oracle会报错并在错误信息中显示有关文件的信息,以下我们来模拟暂时文件的故障
[oraten@yue oraten]$ chmod 000 temp01.dbf
[oraten@yue oraten]$ ll
总用量 932180
-rw-r----- 1 oraten dba 7061504 11月 7 13:59 control01.ctl
-rw-r----- 1 oraten dba 7061504 11月 7 13:59 control02.ctl
-rw-r----- 1 oraten dba 7061504 11月 7 13:59 control03.ctl
-rw-r----- 1 oraten dba 52429312 11月 7 13:44 redo01.log
-rw-r----- 1 oraten dba 52429312 11月 7 13:54 redo02.log
-rw-r----- 1 oraten dba 52429312 11月 7 13:44 redo03.log
-rw-r----- 1 oraten dba 272637952 11月 7 13:49 sysaux01.dbf
-rw-r----- 1 oraten dba 461381632 11月 7 13:49 system01.dbf
---------- 1 oraten dba 20979712 11月 7 13:39 temp01.dbf
-rw-r----- 1 oraten dba 10493952 11月 7 13:44 test01.dbf
-rw-r----- 1 oraten dba 26222592 11月 7 13:49 undotbs01.dbf
-rw-r----- 1 oraten dba 5251072 11月 7 13:44 users01.dbf
强制启动数据库
SQL> startup force
ORACLE instance started. Total System Global Area 134217728 bytes
Fixed Size 2094544 bytes
Variable Size 88082992 bytes
Database Buffers 37748736 bytes
Redo Buffers 6291456 bytes
Database mounted.
Database opened.
SQL>
创建暂时表。并插入数据
SQL> insert into t1 select * from user_tables;
insert into t1 select * from user_tables
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 101 - see DBWR trace file
ORA-01110: data file 101: '/home/app/oraten/oradata/oraten/temp01.dbf'
呵呵,暂时文件无法訪问,在这里显示的文件号为101,为什么那?
我们将參数 db_files改动为200,继续实验
SQL> show parameter db_files NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_files integer 100
SQL> alter system set db_files=200 scope=spfile; System altered. SQL> startup force
ORACLE instance started. Total System Global Area 134217728 bytes
Fixed Size 2094544 bytes
Variable Size 88082992 bytes
Database Buffers 37748736 bytes
Redo Buffers 6291456 bytes
Database mounted.
Database opened.
SQL> insert into t1 select * from user_tables;
insert into t1 select * from user_tables
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/home/app/oraten/oradata/oraten/temp01.dbf'
原来,v$tempfile中的file#并非绝对文件号。暂时文件的绝对文件号是file#+db_files參数。
打完手工!
!
版权声明:本文博主原创文章。博客,未经同意不得转载。
左右v$datafile和v$tempfile中间file#的更多相关文章
- oracle 批量改temp/data/redo file的路径
批量生成修改路径的脚本.select 'alter database rename file ''' || name ||'''' || ' to '''|| substr(name,0,instr( ...
- Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1)
Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1) AP ...
- 临时文件相关的v$tempfile v$sort_usage与V$tempseg_usage
SQL> select username,user,segtype,segfile#,segblk#,extents,segrfno# from v$sort_usage; SEGFILE#代表 ...
- 使用asmcmdcp命令把datafile从文件系统移动(move)到asm磁盘组中 针对11gR2
使用asmcmd cp命令 把datafile从文件系统移动(move)到asm磁盘组中--针对11gR2 参考原文:How to Move a Datafile from Filesystem to ...
- ORA-00245: control file backup failed; target is likely on a local file system (转载)
环境:DB VERSION: 11.2.0.4.0RAC 2 nodes 问题:邮件显示rman备份失败,查看rman备份日志 Starting Control File and SPFILE Aut ...
- Oracle bbed 实用示例-----File Header Reset
一.查看当前环境 1.1 当前控制文件中的SCN号 [oracle@ora10 ~]$ sqlplus /nolog SQL :: Copyright (c) , , Oracle. All righ ...
- dump datafile block
Oracle dump datafile block有两种方式: 然后根据block id执行dump 命令: SQL> alter system dump datafile 4 block 2 ...
- 什么时候会刷新备库控制文件refresh the standby database control file?
通过合理的设置,对于Primary的绝大数操作,都是可以传递到Physical Standby,datafile的操作是通过STANDBY_FILE_MANAGEMENT参数来控制的,但是即使STAN ...
- Rename Oracle Managed File (OMF) datafiles in ASM(ZT)
Recently I was asked to rename a tablespace. The environment was Oracle version 11.2.0.3 (both datab ...
随机推荐
- 高性能 TCP & UDP 通信框架 HP-Socket v3.2.2 正式公布
HP-Socket 是一套通用的高性能 TCP/UDP 通信框架,包括服务端组件.client组件和 Agent 组件,广泛适用于各种不同应用场景的 TCP/UDP 通信系统,提供 C/C++.C#. ...
- C++ 中的比較函数
在敲代码的时候,排序是一种和经常使用的算法.在排序中.比較又是当中最经常使用的操作.这里,我们来分析一下C++中的比較问题. 当中,基本数据类型int. float.string等已经提供了默认的比較 ...
- SoccerLeagueDB
create table if not exists League ( lid int primary key auto_increment, lyear int not null, s ...
- linux下查找某个文件
参考http://blog.csdn.net/gray13/article/details/6365654 一.通过文件名查找法: 举例说明,假设你忘记了httpd.conf这个文件在系统的哪个目录 ...
- MQTT学习笔记——Yeelink MQTT维修 采用mqtt.js和paho-mqtt
0 前言 2014年8月yeelink推出基于MQTT协议的开关类型设备控制API.相比于基于HTTP RESTful的轮训方式,通过订阅相关主题消息,能够远程控制类应用实时性更好. 本文使用 ...
- composite template 组合模式
1. 主要优点 组合模式的主要优点如下: (1) 组合模式可以清楚地定义分层次的复杂对象,表示对象的全部或部分层次,它让客户端忽略了层次的差异,方便对整个层次结构进行控制. (2) 客户端可以一致 ...
- centos安装和卸载软件
==如何卸载: 1.打开一个SHELL终端 2.因为Linux下的软件名都包括版本号,所以卸载前最好先确定这个软件的完整名称. 查找RPM包软件:rpm -qa ×××* 注意:×××指软件名称开头的 ...
- SqlServer service broker 分布式系统(赵松桃)跳水 2005 数据库编程
1.创建一个测试数据库 create database ServerbrokerTest on primary( name=ServerbrokerTest_data, filename='C:\Pr ...
- Shell在大数据的魅力时代:从一点点思路百度大数据面试题
供Linux开发中的同学们,Shell这可以说是一个基本功. 对于同学们的操作和维护.Shell也可以说是一种必要的技能,Shell.对于Release Team,软件配置管理的同学来说.Shell也 ...
- 认识Backbone (三)
Backbone.Collection(集合) collection是model对象的一个有序的组合,我们可以在集合上绑定 "change" 事件,从而当集合中的模型发生变化时f ...