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表空間數據文件的資料請關注腳本之家其它相關文章!
您可能感興趣的文章:- Oracle如何更改表空間的數據文件位置詳解
- Oracle表空間數據文件移動的方法
- Oracle7.X 回滾表空間數據文件誤刪除處理方法
- Oracle7.X 回滾表空間數據文件誤刪除處理方法
- Oracle7.X 回滾表空間數據文件誤刪除處理方法