当前位置:数据库 > Oracle >>

Oracle中数据文件大小的限制

Oracle中数据文件大小的限制
 
Oracle数据文件的大小存在一个内部限制,这个限制是:
每个数据文件最多只能包含2^22-1个数据块。
 
这个限制也就直接导致了每个数据文件的最大允许大小。
在2K Block_size下,数据文件最大只能达到约8G
在32K的Block_size下,数据文件最大只能达到约16*8G的大小。
 
这个限制是由于Oracle的Rowid中使用22位来代表Block号,这22位最多只能代表2^22-1个数据块。
 
为了扩展数据文件的大小,Oracle10g中引入了大文件表空间,在大文件表空间下,Oracle使用32位来代表Block号,也就是说,在新的技术下,大文件表空间下每个文件最多可以容纳4G个Block。
那么也就是说当Block_size为2k时,数据文件可以达到8T 。
当block_size为32K时,数据文件可以达到128T。
 
做2K block_size测试时,第一次遇到了这个限制:
SQL> alter tablespace eygle add datafile 'f:\eygle02.dbf' size 8192M;
alter tablespace eygle add datafile 'f:\eygle02.dbf' size 8192M
*
ERROR 位于第 1 行:
ORA-01144: 文件大小 (4194304 块) 超出 4194303 块的最大数
 
缩减一点,最后创建成功:
SQL> alter tablespace eygle add datafile 'f:\eygle02.dbf' size 8191M reuse;
表空间已更改。
 
autoextend_clause
The autoextend_clause is valid for datafiles and tempfiles but not for redo log files. Use this clause to enable or disable the automatic extension of a new or existing datafile or tempfile. If you omit this clause:
 
  For Oracle-managed files:
    If you specify SIZE, then Oracle Database creates a file of the specified size with AUTOEXTEND disabled.
    If you do not specify SIZE, then the database creates a 100M file with AUTOEXTEND enabled. When autoextension is required, the database extends the file by its original size or 100MB, whichever is smaller. You can override this default behavior by specifying the NEXT clause.
  For user-managed files, with or without SIZE specified, Oracle creates a file with AUTOEXTEND disabled.
 
ON 
Specify ON to enable autoextend.
 
OFF 
Specify OFF to turn off autoextend if is turned on. When you turn off autoextend, the values of NEXT and MAXSIZE are set to zero. If you turn autoextend back on in a subsequent statement, you must reset these values.
 
NEXT 
Use the NEXT clause to specify the size in bytes of the next increment of disk space to be allocated automatically when more extents are required. The default is the size of one data block.
 
MAXSIZE 
Use the MAXSIZE clause to specify the maximum disk space allowed for automatic extension of the datafile.
 
UNLIMITED 
Use the UNLIMITED clause if you do not want to limit the disk space that Oracle can allocate to the datafile or tempfile.
 
Restriction on the autoextend_clause 
You cannot specify this clause as part of the datafile_tempfile_spec in a CREATE CONTROLFILE statement or in an ALTER DATABASE CREATE DATAFILE clause.
 
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,