教你如何设置Oracle表空间数据文件大小

Oracle数据文件默认大小上限是32G,如果要数据文件大于32G,需要在数据库创建之初就设置好。
表空间数据文件容量与DB_BLOCK_SIZE有关,在初始建库时,DB_BLOCK_SIZE要根据实际需要,设置为 4K,8K、16K、32K、64K等几种大小,ORACLE的物理文件最大只允许4194304个数据块(由操作系统决定),表空间数据文件的最大值为 4194304×DB_BLOCK_SIZE/1024M。
即:

  • 4k最大表空间为:16384M=16G
  • 8K最大表空间为:32768M=32G
  • 16k最大表空间为:65536M=64G
  • 32K最大表空间为:131072M=128G
  • 64k最大表空间为:262144M=256G

在windows下只能使用2K,4K,8K,16K的块大小,在文档中的描述如下。

Oracle Database Administrator’s Guide
10g Release 2 (10.2)
Part Number B14231-02
/B19306_01/server.102/b14231/create.htm#sthref372中有如下描述:
Tablespaces of nonstandard block sizes can be created using the CREATE TABLESPACE statement and specifying the BLOCKSIZE clause. These nonstandard block sizes can have any of the following power-of-two values: 2K, 4K, 8K, 16K or 32K. Platform-specific restrictions regarding the maximum block size apply, so some of these sizes may not be allowed on some platforms.
To use nonstandard block sizes, you must configure subcaches within the buffer cache area of the SGA memory for all of the nonstandard block sizes that you intend to use. The initialization parameters used for configuring these subcaches are described in the next section, “Managing the System Global Area (SGA)”.

前一段说明了某些块大小在某些平台上是不可用的,具体情况受操作系统限制。比如windows下就有块大小2048字节到16384字节的限制,不管是非标准块还是标准块。据http://www.ningoo.net/html/2007/can_not_use_32k_block_size_on_windows.html的说明,如果Windows下使用32K作为db_block_size创建数据库,会报ORA-00374错误。

后一段说明使用非标准块要设置相应的内存参数。

Oracle是SGA自动共享内存管理,初始化参数db_4k_cache_size=0、db_8k_cache_size=0、db_16k_cache_size=0、

db_32k_cache_size = 0、db_64k_cache_size = 0,使用

如果要创建表空间并指定其文件大小(由创建表空间的BLOCK_SIZE决定),需重新设置db_4k_cache_size、db_8k_cache_size、db_16k_cache_size、db_32k_cache_size、db_64k_cache_size的值。

db_4k_cache_size:
alter system set db_4k_cache_size = 4M scope=both;
db_8k_cache_size:
alter system set db_8k_cache_size = 8M scope=both;

db_16k_cache_size:
alter system set db_16k_cache_size = 16M scope=both;
db_32k_cache_size:
alter system set db_32k_cache_size = 32M scope=both;
db_64k_cache_size:
alter system set db_64k_cache_size = 64M scope=both;

其中windows系统只支持4k、8k、16k的设置。

设置好上述参数的值后,创建表空间:

CREATE TABLESPACE TEST DATAFILE ‘E:\TEST.DBF’
SIZE 60G
AUTOEXTEND ON
BLOCKSIZE 16K
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 2M
SEGMENT SPACE MANAGEMENT AUTO;

SIZE:数据文件大小,不能超过BLOCKSIZE 16k(对应db_16k_cache_size)的大小16M*4194304/1024M=65536M=64G的值。

Oracle数据文件默认大小上限是32G,如果要数据文件大于32G,需要在数据库创建之初就设置好。
表空间数据文件容量与DB_BLOCK_SIZE有关,在初始建库时,DB_BLOCK_SIZE要根据实际需要,设置为 4K,8K、16K、32K、64K等几种大小,ORACLE的物理文件最大只允许4194304个数据块(由操作系统决定),表空间数据文件的最大值为 4194304×DB_BLOCK_SIZE/1024M。
即:

  • 4k最大表空间为:16384M=16G
  • 8K最大表空间为:32768M=32G
  • 16k最大表空间为:65536M=64G
  • 32K最大表空间为:131072M=128G
  • 64k最大表空间为:262144M=256G

在windows下只能使用2K,4K,8K,16K的块大小,在文档中的描述如下。

Oracle Database Administrator’s Guide
10g Release 2 (10.2)
Part Number B14231-02
/B19306_01/server.102/b14231/create.htm#sthref372中有如下描述:
Tablespaces of nonstandard block sizes can be created using the CREATE TABLESPACE statement and specifying the BLOCKSIZE clause. These nonstandard block sizes can have any of the following power-of-two values: 2K, 4K, 8K, 16K or 32K. Platform-specific restrictions regarding the maximum block size apply, so some of these sizes may not be allowed on some platforms.
To use nonstandard block sizes, you must configure subcaches within the buffer cache area of the SGA memory for all of the nonstandard block sizes that you intend to use. The initialization parameters used for configuring these subcaches are described in the next section, “Managing the System Global Area (SGA)”.

前一段说明了某些块大小在某些平台上是不可用的,具体情况受操作系统限制。比如windows下就有块大小2048字节到16384字节的限制,不管是非标准块还是标准块。据http://www.ningoo.net/html/2007/can_not_use_32k_block_size_on_windows.html的说明,如果Windows下使用32K作为db_block_size创建数据库,会报ORA-00374错误。

后一段说明使用非标准块要设置相应的内存参数。

Oracle是SGA自动共享内存管理,初始化参数db_4k_cache_size=0、db_8k_cache_size=0、db_16k_cache_size=0、

db_32k_cache_size = 0、db_64k_cache_size = 0,使用

如果要创建表空间并指定其文件大小(由创建表空间的BLOCK_SIZE决定),需重新设置db_4k_cache_size、db_8k_cache_size、db_16k_cache_size、db_32k_cache_size、db_64k_cache_size的值。

db_4k_cache_size:
alter system set db_4k_cache_size = 4M scope=both;
db_8k_cache_size:
alter system set db_8k_cache_size = 8M scope=both;

db_16k_cache_size:
alter system set db_16k_cache_size = 16M scope=both;
db_32k_cache_size:
alter system set db_32k_cache_size = 32M scope=both;
db_64k_cache_size:
alter system set db_64k_cache_size = 64M scope=both;

其中windows系统只支持4k、8k、16k的设置。

设置好上述参数的值后,创建表空间:

CREATE TABLESPACE TEST DATAFILE ‘E:\TEST.DBF’
SIZE 60G
AUTOEXTEND ON
BLOCKSIZE 16K
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 2M
SEGMENT SPACE MANAGEMENT AUTO;

SIZE:数据文件大小,不能超过BLOCKSIZE 16k(对应db_16k_cache_size)的大小16M*4194304/1024M=65536M=64G的值。

以上就是教你如何设置Oracle表空间数据文件大小的详细内容,更多关于oracle表空间数据文件的资料请关注其它相关文章!

我想要获取技术服务或软件
服务范围:MySQL、ORACLE、SQLSERVER、MongoDB、PostgreSQL 、程序问题
服务方式:远程服务、电话支持、现场服务,沟通指定方式服务
技术标签:数据恢复、安装配置、数据迁移、集群容灾、异常处理、其它问题
沟通购买:QQ咨询 淘宝咨询 微信咨询 淘宝店铺
版权申明及联系
本站部分文章参考或来源于网络,如有侵权请联系站长。本站提供相关远程技术服务,有需要可联系QQ
数据库远程运维 » 教你如何设置Oracle表空间数据文件大小