[转帖]oracle db_nk_cache_size_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
2
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2967 | 回复: 1   主题: [转帖]oracle db_nk_cache_size        上一篇   下一篇 
yzaosa
注册用户
等级:新兵
经验:71
发帖:1
精华:0
注册:2018-10-9
状态:离线
发送短消息息给yzaosa 加好友    发送短消息息给yzaosa 发消息
发表于: IP:您无权察看 2019-9-12 15:38:18 | [全部帖] [楼主帖] 楼主

1.查看数据库默认的块大小

sys@ora10g> show parameter db_block_size
NAME                      TYPE                 VALUE
------------------------- -------------------- -------------
db_block_size             integer              8192


此处显示,数据库的默认块大小是8K。

11.非标准块支持几种 .什么参数来制定,

查看所有与cache size相关的参数

sys@ora10g> show parameter cache_size
NAME                      TYPE                 VALUE
------------------------- -------------------- -------------
db_16k_cache_size         big integer          0
db_2k_cache_size          big integer          0
db_32k_cache_size         big integer          0
db_4k_cache_size          big integer          0
db_8k_cache_size          big integer          0
db_cache_size             big integer          0
db_keep_cache_size        big integer          0
db_recycle_cache_size     big integer          0


这里列出了2k、4k、8k、16k、32k多种可设置的参数信息。

尝试调整非数据库默认块大小对应的参数

sys@ora10g> alter system set db_16k_cache_size=1m ;
System altered.
sys@ora10g> show parameter cache_size
NAME                      TYPE                 VALUE
------------------------- -------------------- -------------
db_16k_cache_size         big integer          16M
db_2k_cache_size          big integer          0
db_32k_cache_size         big integer          0
db_4k_cache_size          big integer          0
db_8k_cache_size          big integer          0
db_cache_size             big integer          0
db_keep_cache_size        big integer          0
db_recycle_cache_size     big integer          0


调整成功,注意这里的一个现象,设置的是1M大小,系统会自动将这个数值进行调整,调整的依据是:values greater than zero are automatically modified to be either the user-specified-size rounded up to granule size or 4MB * number of CPUs * granule size, whichever is greater

4.尝试调整数据库默认块大小对应的参数

这里我们数据库的默认块大小是8k,因此,这里我们尝试调整“db_8k_cache_size”这个参数。

sys@ora10g> alter system set db_8k_cache_size=1m;
alter system set db_8k_cache_size=1m
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-00380: cannot specify db_8k_cache_size since 8K is the standard block size


此处便遇到了“ORA-00380”错误提示。

5.小结

当数据库使用非标准块表空间时,“DB_nK_CACHE_SIZE”参数将会派上用场,正所谓特殊场合特殊设置,因此在默认块尺寸下我们毋须设置与之对应的cache参数。

不同块尺寸的数据缓冲区的大小就由相应参数db_nk_cache_size来指定,其中n可以是2,4,8,16或32。

如须创建一个大小为2K的非标准尺寸的表空间,则须先指定db_2k_cache_size为这个表空间指定缓存区的大小。

注意:db_nk_cache_size不能设置默认标准块大小的缓冲区,如默认块大小为8K,

    则不能设置参数db_8k_cache_size,因为这个是用来设置非标准块的。

12.
SQL> create tablespace ts_16k datafile '/u01/oracle/oradata/ora10g/ts_16k01.dbf' size 1M blocksize 16K;
create tablespace ts_16k datafile '/u01/oracle/oradata/ora10g/ts_16k01.dbf' size 1M blocksize 16K
*
ERROR at line 1:
ORA-29339: tablespace block size 16384 does not match configured block sizes
Elapsed: 00:00:00.02
Note:
(1)32-bit operating systems support a maximum DB_BLOCK_SIZE value of16384(16k)--32位系统,db_block_size最大16k
(2)64-bit operating systems support a maximum DB_BLOCK_SIZE value of32768(32k)--64位系统,db_block_size最大32k
DB_nK_CACHE_SIZE (where n = 2, 4, 8, 16, 32) specifies thesize of the cache for the nK buffers. You can set this parameter onlywhen DB_BLOCK_SIZE has a value other than nK. For example, ifDB_BLOCK_SIZE=4096, then it is illegal to specify the parameterDB_4K_CACHE_SIZE (because the size for the 4 KB block cache is alreadyspecified by DB_CACHE_SIZE).
-- DB_nK_CACHE_SIZE 参数指定nK 的buffer,在指定cache时,要确保有足够的空间。 不能和DB_BLOCK_SIZE参数冲突,n 可以取2,4,8,16,32.
Donot set this parameter to zero if there are any online tablespaces with an nKblock size.
Operating system-specific block size restrictions apply.For example, you cannot set DB_32K_CACHE_SIZE if the operating system's maximumblock size is less than 32 KB. Also, you cannot set DB_2K_CACHE_SIZE if theminimum block size is greater than 2 KB.
-- DB_nK_CACHE_SIZE要操作系统支持,如果n=32,但操作系统支持,也是不行的。
See Also:
Youroperating system-specific Oracle documentation for more information on blocksize restrictions


二. 测试

--查看db_block_size
SYS@anqing2(rac2)> show parameterdb_block_size
NAME                                 TYPE        VALUE
------------------------------------ -----------------------------------------
db_block_size                        integer     8192
--查看操作系统位数
[root@rac2 ~]# cat /proc/cpuinfo | grepflags | grep 'lm' | wc -l
1


结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit。

有关CPU的更多信息参考:

Linux CPU 信息查看

http://blog.csdn.net/tianlesoftware/article/details/5970500
--查看db_32k_cache_size值
SYS@anqing2(rac2)> show parameterdb_32k_cache_size
NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
db_32k_cache_size                    big integer 0
-- 指定32k 时,报错,提示系统不支持,看来只能用16k了
SYS@anqing1(rac1)> alter system setdb_32k_cache_size=1M scope=both sid='anqing1';
alter system set db_32k_cache_size=1Mscope=both sid='anqing1'
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-00382: 32768 not a valid block size,valid range [..]
--指定16k 的cachebuffer
SYS@anqing1(rac1)> alter system set db_16k_cache_size=1M scope=bothsid='anqing1';
System altered.
SYS@anqing2(rac2)> alter system set db_16k_cache_size=1M scope=bothsid='anqing2';
System altered.
-- 因为我的测试环境是RAC,所以在2个节点上都指定了参数
--查看cache,虽然指定了1M,但系统使用了默认的最小值
SYS@anqing1(rac1)> show parameter db_16k_cache_size
NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
db_16k_cache_size                    big integer 4M
SYS@anqing2(rac2)> show parameter db_16k_cache_size
NAME                                 TYPE        VALUE
----------------------------------------------- ------------------------------
db_16k_cache_size                    big integer 4M
-- 这个最小的默认值,上面的官网说明有解释:
--values greater thanzero are automatically modified to be either the granule size * number ofprocessor groups, or 4 MB * number of CPUs, whichever is greater
--指定了16kcache,我们就可以创建block 为16k的表空间了
SYS@anqing1(rac1)> CREATE TABLESPACETest DATAFILE
2   '+DATA/anqing/datafile/test01.dbf' SIZE 50M AUTOEXTEND ON NEXT 10MMAXSIZE 100M BLOCKSIZE 16K;
Tablespace created.
-- 注意这里指定了Blocksize为16k,和我们之前创建的Cache 大小相对应。
--为了验证不指定cache报的错误,我们创建一个4k的tablespace
SYS@anqing1(rac1)> CREATE TABLESPACE TTDATAFILE '+DATA/anqing/datafile/TT01.dbf' SIZE 50M AUTOEXTEND ON NEXT 10MMAXSIZE 100M BLOCKSIZE 4K;
CREATE TABLESPACE TT DATAFILE'+DATA/anqing/datafile/TT01.dbf' SIZE 50M AUTOEXTEND ON NEXT 10M MAXSIZE 100MBLOCKSIZE 4K
*
ERROR at line 1:
ORA-29339: tablespaceblock size 4096 does not match configured block sizes
-- 这里提示了我们:ORA-29339的错误,所以在创建Multiple Block Sizes 之前,必须指定对应的Cache buffer。
--创建一个测试表,放到16k的test 表空间
SYS@anqing1(rac1)> create table tt16k tablespace test as select * from dba_objects;
Table created.
--验证一下表tt16k的block 大小
SYS@anqing1(rac1)> selectsegment_name,blocks from dba_segments where segment_name='TT16K';
SEGMENT_NAME     BLOCKS
--------------- ----------
TT16K                  384
--当表的每个block越大时,那么它里面就能够存放更多的block
--我们使用8k的block 来创建一个相同的表,来查看它使用blocks,从而进行对比
SYS@anqing1(rac1)> create table tt8k as select * from dba_objects;
Table created.
SYS@anqing1(rac1)> select segment_name,blocks from dba_segments wheresegment_name='TT8K';
SEGMENT_NAME        BLOCKS
--------------- ----------
TT8K                   768
--看到,使用16k是384个blocks,使用8k是768个blocks。
-- 将tt8kmove 到 test(16k)
SYS@anqing1(rac1)> alter table tt8k move tablespace test;
Table altered.
SYS@anqing1(rac1)>select segment_name,blocks from dba_segments wheresegment_name='TT8K';
SEGMENT_NAME        BLOCKS
--------------- ----------
TT8K                   384


使用的Blocks 就下降下来了。




赞(0)    操作        顶端 
联动大白
注册用户
等级:列兵
经验:91
发帖:0
精华:0
注册:2015-5-27
状态:离线
发送短消息息给联动大白 加好友    发送短消息息给联动大白 发消息
发表于: IP:您无权察看 2019-10-1 0:30:00 | [全部帖] [楼主帖] 2  楼

为了方便大家阅读,我对文章中错误号来解释一下吧!

Error Id: ORA-32017

Title: failure in updating SPFILE

Description:

failure in updating SPFILE

Action:

See associated errors.

Cause:

A failure occured while updating the SPFILE.


Error Id: ORA-29339

Title: tablespace block size string does not match configured block sizes

Description:

tablespace block size string does not match configured block sizes

Action:

Configure the appropriate cache for the block size of this tablespace using one of the various (db_2k_cache_size, db_4k_cache_size, db_8k_cache_size, db_16k_cache_size, db_32K_cache_size) parameters.

Cause:

The block size of the tablespace to be plugged in or created does not match the block sizes configured in the database.


Error Id: ORA-00380

Title: cannot specify db_stringk_cache_size since stringK is the standard block size

Description:

cannot specify db_stringk_cache_size since stringK is the standard block size

Action:

Specify the standard block size cache using db_cache_size (DEFAULT pool) (and db_recycle_cache_size, db_keep_cache_size if additional buffer pools are required). Do NOT use the corresponding db_nk_cache_size parameter for the standard block size.

Cause:

User specified the parameter db_nk_cache_size (where n is one of 2,4,8,16,32), while the standard block size for this database is equal to n Kbytes. This is illegal.


Error Id: ORA-00382

Title: %s not a valid block size, valid range [string..string]

Description:

%s not a valid block size, valid range [string..string]

Action:

Remove corresponding parameter from the "init.ora" file and restart the instance.

Cause:

User specified a value for db_nk_cache_size where n is one of {2, 4, 8, 16, 32}, but nk is not a valid block size for this platform.


也许你已明白,但对一个人有用也是我存在的理由!^_^ By:持之以恒的大白

-- 来自: 北京联动北方科技有限公司



赞(0)    操作        顶端 
总帖数
2
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论