溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle設(shè)置表空間數(shù)據(jù)文件大小的方法

發(fā)布時間:2020-07-22 13:43:15 來源:億速云 閱讀:267 作者:小豬 欄目:開發(fā)技術(shù)

這篇文章主要講解了Oracle設(shè)置表空間數(shù)據(jù)文件大小的方法,內(nèi)容清晰明了,對此有興趣的小伙伴可以學習一下,相信大家閱讀完之后會有幫助。

Oracle數(shù)據(jù)文件默認大小上限是32G,如果要數(shù)據(jù)文件大于32G,需要在數(shù)據(jù)庫創(chuàng)建之初就設(shè)置好。
表空間數(shù)據(jù)文件容量與DB_BLOCK_SIZE有關(guān),在初始建庫時,DB_BLOCK_SIZE要根據(jù)實際需要,設(shè)置為 4K,8K、16K、32K、64K等幾種大小,ORACLE的物理文件最大只允許4194304個數(shù)據(jù)塊(由操作系統(tǒng)決定),表空間數(shù)據(jù)文件的最大值為 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)".

前一段說明了某些塊大小在某些平臺上是不可用的,具體情況受操作系統(tǒng)限制。比如windows下就有塊大小2048字節(jié)到16384字節(jié)的限制,不管是非標準塊還是標準塊。據(jù)http://www.ningoo.net/html/2007/can_not_use_32k_block_size_on_windows.html的說明,如果Windows下使用32K作為db_block_size創(chuàng)建數(shù)據(jù)庫,會報ORA-00374錯誤。

后一段說明使用非標準塊要設(shè)置相應的內(nèi)存參數(shù)。

Oracle是SGA自動共享內(nèi)存管理,初始化參數(shù)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,使用

如果要創(chuàng)建表空間并指定其文件大?。ㄓ蓜?chuàng)建表空間的BLOCK_SIZE決定),需重新設(shè)置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系統(tǒng)只支持4k、8k、16k的設(shè)置。

設(shè)置好上述參數(shù)的值后,創(chuàng)建表空間:

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

SIZE:數(shù)據(jù)文件大小,不能超過BLOCKSIZE 16k(對應db_16k_cache_size)的大小16M*4194304/1024M=65536M=64G的值。

看完上述內(nèi)容,是不是對Oracle設(shè)置表空間數(shù)據(jù)文件大小的方法有進一步的了解,如果還想學習更多內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI