Oracle下绝对文件号和相对文件号区别
Oracle下绝对文件号和相对文件号区别 一:Oracle官方给出的描述 Oracle Database assigns each datafile two associated file numbers, an absolute file number and a relative file number, that are used to uniquely identify it Absolute:Uniquely ide
Oracle下绝对文件号和相对文件号区别
一:Oracle官方给出的描述
Oracle Database assigns each datafile two associated file numbers, an absolute file
number and a relative file number, that are used to uniquely identify it
Absolute:Uniquely identifies a datafile in the database. This file number can be used in many SQL statements that reference datafiles in place of using the file name. The absolute file number can be found in the FILE# column of the V$DATAFILE or V$TEMPFILE
view, or in the FILE_ID column of the DBA_DATA_FILES or DBA_TEMP_FILES view
Relative:Uniquely identifies a datafile within a tablespace. For small and medium size databases, relative file numbers usually have the same value as the absolute file number. However, when the
number of datafiles in a database exceeds a threshold (typically 1023), the relative file number differs from the absolute file number. In a bigfile tablespace, the relative file number is always
1024 (4096 on OS/390 platform).
二:总结如下
总述:oracle数据库会给每一个新创建的datafile分配一个绝对文件号和相对文件号,两者都用于唯一性标识该数据文件,只不过标识范围不一样。
绝对文件号:
1 绝对文件号数据库范围内唯一标识一个数据文件
2 sql语句中常常用绝对文件号代替该数据文件名字。
3 绝对文件号可通过查询视图v$datafile|v$tempfile|dba_data_files|dba_temp_files相关字段file#|file_id 获得
例如:v$datafile 的file#字段
select file#,name,status from v$datafile
FILE# NAME STATUS
---------- ---------------------------------------- -------
1 /oracle/CRM2/system1.dbf SYSTEM
2 /oracle/CRM2/zxb.dbf ONLINE
3 /oracle/CRM2/CRM/sysaux01.dbf ONLINE
4 /oracle/CRM2/CRM/users01.dbf ONLINE
5 /oracle/CRM2/zxa.dbf ONLINE
6 /oracle/CRM2/CRM/test1.dbf ONLINE
7 /oracle/CRM2/zxc.dbf ONLINE
8 /oracle/CRM2/CRM/undotbs1.dbf ONLINE
相当文件号:
1 相对文件号在表空间范围内唯一标识一个数据文件。
2 数据库内数据文件没有超过1023个时,相对文件号和绝对文件号是相等的;数据文件若超出1023个,则会不同。
3 在大表空间中数据文件相对文件号总是1024
4 查询v$datafile|v$tempfile字段RFILE# ,dba_data_files|dba_temp_files字段RELATIVE_FNO等,可查出相对文件号。
例1如 v$datafile的字段rfile#
SQL> Select file#,rfile#,name,status from v$datafile;
FILE# RFILE# NAME STATUS
---------- ---------- ---------------------------------------- -------
1 1 /oracle/CRM2/system1.dbf SYSTEM
2 2 /oracle/CRM2/zxb.dbf ONLINE
3 3 /oracle/CRM2/CRM/sysaux01.dbf ONLINE
4 4 /oracle/CRM2/CRM/users01.dbf ONLINE
5 5 /oracle/CRM2/zxa.dbf ONLINE
6 6 /oracle/CRM2/CRM/test1.dbf ONLINE
7 7 /oracle/CRM2/zxc.dbf ONLINE
8 8 /oracle/CRM2/CRM/undotbs1.dbf ONLINE
8 rows selected.
例2 大表空间绝对文件号和相对文件号情况
SQL> select file#,rfile#,name,status from v$datafile;
FILE# RFILE# NAME STATUS
---------- ---------- ---------------------------------------- -------
1 1 /oracle/CRM2/system1.dbf SYSTEM
2 2 /oracle/CRM2/zxb.dbf ONLINE
3 3 /oracle/CRM2/CRM/sysaux01.dbf ONLINE
4 4 /oracle/CRM2/CRM/users01.dbf ONLINE
5 5 /oracle/CRM2/zxa.dbf ONLINE
6 6 /oracle/CRM2/CRM/test1.dbf ONLINE
7 7 /oracle/CRM2/zxc.dbf ONLINE
8 8 /oracle/CRM2/CRM/undotbs1.dbf ONLINE
9 1024 /oracle/CRM2/CRM/zxbig.dbf ONLINE
SQL>select file_id,relative_fno,file_name from dba_data_files order by 1
FILE_ID RELATIVE_FNO FILE_NAME
---------- ------------ ----------------------------------------
1 1 /oracle/CRM2/system1.dbf
2 2 /oracle/CRM2/zxb.dbf
3 3 /oracle/CRM2/CRM/sysaux01.dbf
4 4 /oracle/CRM2/CRM/users01.dbf
5 5 /oracle/CRM2/zxa.dbf
6 6 /oracle/CRM2/CRM/test1.dbf
7 7 /oracle/CRM2/zxc.dbf
8 8 /oracle/CRM2/CRM/undotbs1.dbf
9 1024 /oracle/CRM2/CRM/zxbig.dbf
www.linuxidc.comhttp://www.linuxidc.com/Linux/2012-12/75509.htm
上一篇: php curl模拟post请求简单示例
下一篇: PHP字符函数大全第1/2页