默认情况下创建的表空间使用的数据块大小是8K,数据库默认的数据块大小由db_block_size参数决定。
如果我们想要创建的表空间超过8K,首先需要调整数据库的参数db_nk_cache_size。
实验:
SQL> show parameter db_block_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_block_size integer 8192
查看16k默认值为0
SQL> show parameter db_16k_cache_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_16k_cache_size big integer 0
创建数据库高速缓冲区
SQL> alter system set db_16k_cache_size=1m scope=both;
System altered.
SQL> show parameter db_16K_cache_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_16k_cache_size big integer 4M
添加数据块为16k的非标准块表空间
SQL> create tablespace scott datafile '/u01/oradata/test/scott1.dbf' size 10m blocksize 16k;
Tablespace created.
SQL> select DBMS_METADATA.GET_DDL('TABLESPACE','SCOTT') from dual;
DBMS_METADATA.GET_DDL('TABLESPACE','SCOTT')
--------------------------------------------------------------------------------
CREATE TABLESPACE "SCOTT" DATAFILE
'/u01/oradata/test/scott1.dbf' SIZE 104
官方文档说明DB_nK_CACHE_SIZE
DB_nK_CACHE_SIZE
Property | Description |
---|---|
Parameter type | Big integer |
Syntax | DB_[2 | 4 | 8 | 16 | 32]K_CACHE_SIZE = integer [K | M | G] |
Default value | 0 (additional block size caches are not configured by default) |
Modifiable | ALTER SYSTEM |
Range of values | Minimum: 0 (values greater than zero are automatically modified to be either the granule size * number of processor groups, or 4 MB * number of CPUs, whichever is greater) Maximum: operating system-dependent |
Basic | No |
SQL> select component,granule_size from v$sga_dynamic_components;
COMPONENT GRANULE_SIZE
---------------------------------------------------------------- ------------
shared pool 4194304
large pool 4194304
java pool 4194304
streams pool 4194304
DEFAULT buffer cache 4194304
KEEP buffer cache 4194304
RECYCLE buffer cache 4194304
DEFAULT 2K buffer cache 4194304
DEFAULT 4K buffer cache 4194304
DEFAULT 8K buffer cache 4194304
DEFAULT 16K buffer cache 4194304
COMPONENT GRANULE_SIZE
---------------------------------------------------------------- ------------
DEFAULT 32K buffer cache 4194304
Shared IO Pool 4194304
ASM Buffer Cache 4194304
14 rows selected.