[20171206]设置db_2k_cache_size的疑问.txt

[20171206]设置db_2k_cache_size的疑问.txt

--//上午测试最小的数据文件,我想看看2k数据块能建议多小的数据文件,我的测试最小10K,但是遇到1个无法理解的问题.

1.环境:
SYS@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SYS@book> alter system set db_2k_cache_size=1M scope=spfile;
System altered.

2.测试:
--//重启数据库:

SYS@book> startup
ORACLE instance started.
Total System Global Area  734949376 bytes
Fixed Size                  2256752 bytes
Variable Size             197132432 bytes
Database Buffers          528482304 bytes
Redo Buffers                7077888 bytes
Database mounted.
Database opened.

SYS@book> show parameter db_2k
NAME             TYPE        VALUE
---------------- ----------- ------
db_2k_cache_size big integer 96M

SYS@book> show spparameter db_2k
SID      NAME             TYPE        VALUE
-------- ---------------- ----------- -----
*        db_2k_cache_size big integer 1M

SYS@book> show parameter sga_
NAME         TYPE        VALUE
------------ ----------- -----
sga_max_size big integer 704M
sga_target   big integer 0

--//为什么这么大,按照我的理解至少一个Granule Size.

SYS@book> select * from v$sgainfo;
NAME                                  BYTES RES
-------------------------------- ---------- ---
Fixed SGA Size                      2256752 No
Redo Buffers                        7077888 No
Buffer Cache Size                 528482304 Yes
Shared Pool Size                  180355072 Yes
Large Pool Size                    12582912 Yes
Java Pool Size                      4194304 Yes
Streams Pool Size                         0 Yes
Shared IO Pool Size                       0 Yes
Granule Size                        4194304 No
Maximum SGA Size                  734949376 No
Startup overhead in Shared Pool   133977368 No
Free SGA Memory Available                 0
12 rows selected.

--//Granule Size=4194304 ,而实际db_2k_cache_size占用96M.

SYS@book> @ &r/memalloc
MIN(BASEADDR)    MAX(BASEADDR)      GRANULES         MB  GRANFLAGS COMPONENT                        GRANSTATE
---------------- ---------------- ---------- ---------- ---------- -------------------------------- ----------------
0000000060C00000 0000000066800000         24         96          4 DEFAULT 2K buffer cache          ALLOC
0000000066C00000 0000000080000000        102        408          4 DEFAULT buffer cache             ALLOC
0000000080400000 0000000080400000          1          4          4 java pool                        ALLOC
0000000080800000 0000000081000000          3         12          4 large pool                       ALLOC
0000000081400000 000000008BC00000         43        172          4 shared pool                      ALLOC

press enter .....

BASEADDR           GRANSIZE  GRANFLAGS COMPONENT                        GRANSTATE
---------------- ---------- ---------- -------------------------------- ----------------
0000000060C00000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000061000000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000061400000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000061800000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000061C00000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000062000000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000062400000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000062800000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000062C00000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000063000000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000063400000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000063800000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000063C00000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000064000000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000064400000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000064800000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000064C00000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000065000000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000065400000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000065800000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000065C00000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000066000000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000066400000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000066800000    4194304          4 DEFAULT 2K buffer cache          ALLOC
0000000066C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000067000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000067400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000067800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000067C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000068000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000068400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000068800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000068C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000069000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000069400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000069800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000069C00000    4194304          4 DEFAULT buffer cache             ALLOC
000000006A000000    4194304          4 DEFAULT buffer cache             ALLOC
000000006A400000    4194304          4 DEFAULT buffer cache             ALLOC
000000006A800000    4194304          4 DEFAULT buffer cache             ALLOC
000000006AC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000006B000000    4194304          4 DEFAULT buffer cache             ALLOC
000000006B400000    4194304          4 DEFAULT buffer cache             ALLOC
000000006B800000    4194304          4 DEFAULT buffer cache             ALLOC
000000006BC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000006C000000    4194304          4 DEFAULT buffer cache             ALLOC
000000006C400000    4194304          4 DEFAULT buffer cache             ALLOC
000000006C800000    4194304          4 DEFAULT buffer cache             ALLOC
000000006CC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000006D000000    4194304          4 DEFAULT buffer cache             ALLOC
000000006D400000    4194304          4 DEFAULT buffer cache             ALLOC
000000006D800000    4194304          4 DEFAULT buffer cache             ALLOC
000000006DC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000006E000000    4194304          4 DEFAULT buffer cache             ALLOC
000000006E400000    4194304          4 DEFAULT buffer cache             ALLOC
000000006E800000    4194304          4 DEFAULT buffer cache             ALLOC
000000006EC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000006F000000    4194304          4 DEFAULT buffer cache             ALLOC
000000006F400000    4194304          4 DEFAULT buffer cache             ALLOC
000000006F800000    4194304          4 DEFAULT buffer cache             ALLOC
000000006FC00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000070000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000070400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000070800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000070C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000071000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000071400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000071800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000071C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000072000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000072400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000072800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000072C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000073000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000073400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000073800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000073C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000074000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000074400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000074800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000074C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000075000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000075400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000075800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000075C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000076000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000076400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000076800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000076C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000077000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000077400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000077800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000077C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000078000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000078400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000078800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000078C00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000079000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000079400000    4194304          4 DEFAULT buffer cache             ALLOC
0000000079800000    4194304          4 DEFAULT buffer cache             ALLOC
0000000079C00000    4194304          4 DEFAULT buffer cache             ALLOC
000000007A000000    4194304          4 DEFAULT buffer cache             ALLOC
000000007A400000    4194304          4 DEFAULT buffer cache             ALLOC
000000007A800000    4194304          4 DEFAULT buffer cache             ALLOC
000000007AC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000007B000000    4194304          4 DEFAULT buffer cache             ALLOC
000000007B400000    4194304          4 DEFAULT buffer cache             ALLOC
000000007B800000    4194304          4 DEFAULT buffer cache             ALLOC
000000007BC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000007C000000    4194304          4 DEFAULT buffer cache             ALLOC
000000007C400000    4194304          4 DEFAULT buffer cache             ALLOC
000000007C800000    4194304          4 DEFAULT buffer cache             ALLOC
000000007CC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000007D000000    4194304          4 DEFAULT buffer cache             ALLOC
000000007D400000    4194304          4 DEFAULT buffer cache             ALLOC
000000007D800000    4194304          4 DEFAULT buffer cache             ALLOC
000000007DC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000007E000000    4194304          4 DEFAULT buffer cache             ALLOC
000000007E400000    4194304          4 DEFAULT buffer cache             ALLOC
000000007E800000    4194304          4 DEFAULT buffer cache             ALLOC
000000007EC00000    4194304          4 DEFAULT buffer cache             ALLOC
000000007F000000    4194304          4 DEFAULT buffer cache             ALLOC
000000007F400000    4194304          4 DEFAULT buffer cache             ALLOC
000000007F800000    4194304          4 DEFAULT buffer cache             ALLOC
000000007FC00000    4194304          4 DEFAULT buffer cache             ALLOC
0000000080000000    4194304          4 DEFAULT buffer cache             ALLOC
0000000080400000    4194304          4 java pool                        ALLOC
0000000080800000    4194304          4 large pool                       ALLOC
0000000080C00000    4194304          4 large pool                       ALLOC
0000000081000000    4194304          4 large pool                       ALLOC
0000000081400000    4194304          4 shared pool                      ALLOC
0000000081800000    4194304          4 shared pool                      ALLOC
0000000081C00000    4194304          4 shared pool                      ALLOC
0000000082000000    4194304          4 shared pool                      ALLOC
0000000082400000    4194304          4 shared pool                      ALLOC
0000000082800000    4194304          4 shared pool                      ALLOC
0000000082C00000    4194304          4 shared pool                      ALLOC
0000000083000000    4194304          4 shared pool                      ALLOC
0000000083400000    4194304          4 shared pool                      ALLOC
0000000083800000    4194304          4 shared pool                      ALLOC
0000000083C00000    4194304          4 shared pool                      ALLOC
0000000084000000    4194304          4 shared pool                      ALLOC
0000000084400000    4194304          4 shared pool                      ALLOC
0000000084800000    4194304          4 shared pool                      ALLOC
0000000084C00000    4194304          4 shared pool                      ALLOC
0000000085000000    4194304          4 shared pool                      ALLOC
0000000085400000    4194304          4 shared pool                      ALLOC
0000000085800000    4194304          4 shared pool                      ALLOC
0000000085C00000    4194304          4 shared pool                      ALLOC
0000000086000000    4194304          4 shared pool                      ALLOC
0000000086400000    4194304          4 shared pool                      ALLOC
0000000086800000    4194304          4 shared pool                      ALLOC
0000000086C00000    4194304          4 shared pool                      ALLOC
0000000087000000    4194304          4 shared pool                      ALLOC
0000000087400000    4194304          4 shared pool                      ALLOC
0000000087800000    4194304          4 shared pool                      ALLOC
0000000087C00000    4194304          4 shared pool                      ALLOC
0000000088000000    4194304          4 shared pool                      ALLOC
0000000088400000    4194304          4 shared pool                      ALLOC
0000000088800000    4194304          4 shared pool                      ALLOC
0000000088C00000    4194304          4 shared pool                      ALLOC
0000000089000000    4194304          4 shared pool                      ALLOC
0000000089400000    4194304          4 shared pool                      ALLOC
0000000089800000    4194304          4 shared pool                      ALLOC
0000000089C00000    4194304          4 shared pool                      ALLOC
000000008A000000    4194304          4 shared pool                      ALLOC
000000008A400000    4194304          4 shared pool                      ALLOC
000000008A800000    4194304          4 shared pool                      ALLOC
000000008AC00000    4194304          4 shared pool                      ALLOC
000000008B000000    4194304          4 shared pool                      ALLOC
000000008B400000    4194304          4 shared pool                      ALLOC
000000008B800000    4194304          4 shared pool                      ALLOC
000000008BC00000    4194304          4 shared pool                      ALLOC
173 rows selected.

--//我的测试库内存参数都是手动设置的,没有使用动态管理.你看到的分配都是连续的区域.

SYS@book> alter system reset db_2k_cache_size sid='*';
System altered.

SYS@book> drop tablespace t03 including contents and datafiles;
Tablespace dropped.
--//删除2K的数据文件.

SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@book> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.

SYS@book> show parameter sga_
NAME         TYPE        VALUE
------------ ----------- ------
sga_max_size big integer 608M
sga_target   big integer 0

SYS@book> @ &r/memalloc
MIN(BASEADDR)    MAX(BASEADDR)      GRANULES         MB  GRANFLAGS COMPONENT                        GRANSTATE
---------------- ---------------- ---------- ---------- ---------- -------------------------------- ----------------
0000000060C00000 000000007A000000        102        408          4 DEFAULT buffer cache             ALLOC
000000007A400000 000000007A400000          1          4          4 java pool                        ALLOC
000000007A800000 000000007B000000          3         12          4 large pool                       ALLOC
000000007B400000 0000000085C00000         43        172          4 shared pool                      ALLOC
//后面省略....

//才明白一个oracle内存分配的一个问题,我以前一直以为不同块大小的内存分配是从DEFAULT buffer cache分配的,而实际上不是,
//而是单独定义,单独使用.
//如果你对比前面show sga的输出就明白了(或者看show parameter sga_的显示).包括分配内存的基地址.
//前面sga_max_size=704M,后面sga_max_size=608M.
//704-608=96M

//至于为什么要分配这么大,我就不清楚了,那位知道???

3.附上memalloc的脚本:
col component format a32
select min(BASEADDR), max(BASEADDR), count(1) Granules, sum(a.gransize)/1048576 MB, a.GRANFLAGS, component, a.GRANSTATE
from x$ksmge a, x$kmgsct b
where a.grantype = b.grantype (+)
group by a.GRANFLAGS, component, a.GRANSTATE
order by 1,2;

pause press enter .....

select a.BASEADDR, a.gransize, a.GRANFLAGS, b.component, a.GRANSTATE
from x$ksmge a, x$kmgsct b
where a.grantype = b.grantype (+)
order by 1,2;

时间: 2024-07-29 06:42:20

[20171206]设置db_2k_cache_size的疑问.txt的相关文章

[20171130]关于rman备份疑问.txt

[20171130]关于rman备份疑问.txt --//前面测试太乱,重新做一些rman as copy相关测试. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- --------------------------------------------------------------

[20171115]关于逻辑读的疑问.txt

[20171115]关于逻辑读的疑问.txt --//有网友指出[20150209]为什么少1个逻辑读.txt,链接:http://blog.itpub.net/267265/viewspace-1430902/ --//如何验证是这样操作的. 1.环境: SCOTT@test> @ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ----

[20170407]关于增量检查点的一个疑问.txt

[20170407]关于增量检查点的一个疑问.txt --//oracle现在写脏块基本采用增量检查点,除非执行alter system checkpoint,或者shutdown immediate(normal)正常关闭数据库. --//别人的疑问,如果如果写增量检查点时,current log tail at RBA=Incremental checkpoint up to RBA时,如下情况 1.环境: SYS@book> @ &r/ver1 PORT_STRING         

[20160527]快速提交的一个疑问.txt

[20160527]快速提交的一个疑问.txt --这个是我前几天恢复update没有加where条件的恢复,记录不多,但是我发现一个"奇怪"的问题,或者讲我以前没有注意的问题, --我在itpub上问了,没人解答.链接http://www.itpub.net/thread-2060064-1-2.html Block header dump:  0x0180239c Object id on Block? Y seg/obj: 0x1da20  csc: 0x03.8fc12309 

[20161114]rman备份的疑问.txt

[20161114]rman备份的疑问.txt --这个是我前几天做测试时遇到的疑问,不知道为什么rman 备份要修改数据块的dba地址. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ---------------------------------------------------

[20160516]SQL共享光标的测试疑问.txt

[20160516]SQL共享光标的测试疑问.txt --昨天我看了链接http://blog.itpub.net/17203031/viewspace-754994/,感觉他的测试有问题,不可能相同的sql语句,而sql_id会不一样 --的.我自己测试看看. 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ ------

[20170515]数据库启动的一个疑问.txt

[20170515]数据库启动的一个疑问.txt --//别人问的问题我自己以前也没有注意,做一个记录. 1.环境: SYS@book> startup   mount ORACLE instance started. Total System Global Area  634732544 bytes Fixed Size                  2255792 bytes Variable Size             197133392 bytes Database Buffe

[20150112]系统管理表空间的疑问.txt

[20150112]系统管理表空间的疑问.txt http://www.itpub.net/thread-1903121-1-1.html 10g下每个数据文件3-8块为位图区. 6个块=48K(假设数据块大小8k) 48*8*1024=393216 区 对于系统表空间管理.1区=64K. SCOTT@test> set numw 20 SCOTT@test> select 48*8*1024*64*1024 from dual;    48*8*1024*64*1024 ----------

[20161220]rman恢复时间点的疑问.txt

[20161220]rman恢复时间点的疑问.txt --昨天在恢复时遇到缺少归档的问题,自己开始感觉奇怪,做一点分析记录. RMAN> list backupset summary ; List of Backups =============== Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag ------- -- -- - ----------- -----------------