联系:QQ(5163721)
标题:贫民电脑(8G mem)玩12c standalone需要的配置多大内存的vm呢?
作者:Lunar©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]
12c官方文档要求,对于单机的数据库,要求如下:
Server Memory Minimum Requirements
Ensure that your system meets the following memory requirements:
Minimum: 1 GB of RAM
Recommended: 2 GB of RAM or more
这说明,我们完全可以使用很小的memory来玩12c的。。。。。。
看下当前的配置(使用了ASMM):
shared_pool_size=160M db_cache_size=30M log_buffer=6594560 MEMORY_MAX_TARGET=0 MEMORY_TARGET=0 sga_max_size=330M sga_target=3300M
关于9i开始的sga介绍,请参考: http://blog.csdn.net/lunar2000/article/details/49437
启动一下数据库:
[oracle@lunar ~]$ ss SQL*Plus: Release 12.1.0.1.0 Production on Sat Aug 24 22:43:04 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SYS% lunarbb> show sga Total System Global Area 346562560 bytes 这里看到sga确实是最大330M Fixed Size 2288240 bytes Variable Size 188745104 bytes Database Buffers 146800640 bytes 但是这里并不是我设置的30M,而是140M Redo Buffers 8728576 bytes SYS% lunarbb> SYS% lunarbb> show parameter cache_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ client_result_cache_size big integer 0 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 32M db_flash_cache_size big integer 0 db_keep_cache_size big integer 0 db_recycle_cache_size big integer 0 SYS% lunarbb> SYS% lunarbb> col KSPPINM for a30 SYS% lunarbb> col ksppstvl format a15 SYS% lunarbb> col KSPPDESC for a55 SYS% lunarbb> select ksppinm, ksppstvl, KSPPDESC 2 from x$ksppi pi, x$ksppcv cv 3 where cv.indx=pi.indx and pi.ksppinm like '\_%' escape '\' 4 and pi.ksppinm like '%cache%'; KSPPINM KSPPSTVL KSPPDESC ------------------------------ --------------- ------------------------------------------------------- _number_cached_attributes 10 maximum number of cached attributes per instance _number_cached_group_membershi 32 maximum number of cached group membershipsps _number_group_memberships_per_ 3 maximum number of group memberships per cache linecache_line _blocking_sess_graph_cache_siz blocking session graph cache size in bytese _hang_delay_resolution_for_lib TRUE Hang Management delays hang resolution for library cach cache e _lm_cache_res_cleanup 25 percentage of cached resources should be cleanup _lm_cache_allocated_res_ratio 50 ratio of cached over allocated resources _lm_cache_res_skip_cleanup 20 multiple of iniital res cache below which cleanup is skipped _lm_cache_res_cleanup_tries 10 max number of batches of cached resources to free per c leanup _lm_cache_res_type TMHWHVDI cache resource: string of lock types(s) _lm_cache_lvl0_cleanup 0 how often to cleanup level 0 cache res (in sec) _lm_cache_res_options 0 ges resource cache options _blocks_per_cache_server 16 number of consecutive blocks per global cache server _db_block_cache_protect FALSE protect database blocks (true only when debugging) _db_block_cache_protect_intern 0 protect database blocks (for strictly internal use only al ) _db_block_cache_num_umap 0 number of unmapped buffers (for tracking swap calls on blocks) __db_cache_size 134217728 Actual size of DEFAULT buffer pool for standard block size buffers 注意这里,这个就是ASMM中,会自动设置的buffer cache的尺寸,也就是sga动态调整后的值,他会被记录到alert中 _db_percpu_create_cachesize 2 size of cache created per cpu in deferred cache create _db_initial_cachesize_create_m 256 size of cache created at startupb ......
过几分钟再次查询,发现buffer cache 已经被动态调整:
SYS% lunarbb> col KSPPINM for a30 SYS% lunarbb> col ksppstvl format a15 SYS% lunarbb> col KSPPDESC for a55 SYS% lunarbb> select ksppinm, ksppstvl, KSPPDESC 2 from x$ksppi pi, x$ksppcv cv 3 where cv.indx=pi.indx and pi.ksppinm like '\_%' escape '\' 4 and pi.ksppinm like '%db_cache_size%'; KSPPINM KSPPSTVL KSPPDESC ------------------------------ --------------- ------------------------------------------------------- __db_cache_size 125829120 Actual size of DEFAULT buffer pool for standard block s 动态调整后为125M ize buffers Elapsed: 00:00:00.05 SYS% lunarbb> select COMPONENT,CURRENT_SIZE, GRANULE_SIZE from V$SGA_DYNAMIC_COMPONENTS; SYS% lunarbb> select COMPONENT,CURRENT_SIZE, 2 GRANULE_SIZE 3 from V$SGA_DYNAMIC_COMPONENTS; COMPONENT CURRENT_SIZE GRANULE_SIZE ---------------------------------------------------------------- ------------ ------------ shared pool 184549376 4194304 large pool 8388608 4194304 java pool 4194304 4194304 streams pool 0 4194304 DEFAULT buffer cache 125829120 4194304 KEEP buffer cache 0 4194304 RECYCLE buffer cache 0 4194304 DEFAULT 2K buffer cache 0 4194304 DEFAULT 4K buffer cache 0 4194304 DEFAULT 8K buffer cache 0 4194304 DEFAULT 16K buffer cache 0 4194304 DEFAULT 32K buffer cache 0 4194304 Shared IO Pool 12582912 4194304 Data Transfer Cache 0 4194304 ASM Buffer Cache 0 4194304 15 rows selected. Elapsed: 00:00:00.02 SYS% lunarbb> SYS% lunarbb> select COMPONENT,CURRENT_SIZE,MIN_SIZE,MAX_SIZE,GRANULE_SIZE from V$SGA_DYNAMIC_COMPONENTS; COMPONENT CURRENT_SIZE MIN_SIZE MAX_SIZE GRANULE_SIZE ---------------------------------------------------------------- ------------ ---------- ---------- ------------ shared pool 184549376 167772160 184549376 4194304 large pool 8388608 8388608 125829120 4194304 java pool 4194304 4194304 4194304 4194304 streams pool 0 0 0 4194304 DEFAULT buffer cache 125829120 37748736 155189248 4194304 KEEP buffer cache 0 0 0 4194304 RECYCLE buffer cache 0 0 0 4194304 DEFAULT 2K buffer cache 0 0 0 4194304 DEFAULT 4K buffer cache 0 0 0 4194304 DEFAULT 8K buffer cache 0 0 0 4194304 DEFAULT 16K buffer cache 0 0 0 4194304 DEFAULT 32K buffer cache 0 0 0 4194304 Shared IO Pool 12582912 0 12582912 4194304 Data Transfer Cache 0 0 0 4194304 ASM Buffer Cache 0 0 0 4194304 15 rows selected. Elapsed: 00:00:00.01 SYS% lunarbb> 再次手工设置buffer cache的值来看看: SYS% lunarbb> alter system set "__db_cache_size"=30M scope=spfile; System altered. Elapsed: 00:00:00.27 SYS% lunarbb> SYS% lunarbb> shutdown abort ORACLE instance shut down. SYS% lunarbb> startup ORACLE instance started. Total System Global Area 346562560 bytes Fixed Size 2288240 bytes Variable Size 297797008 bytes Database Buffers 37748736 bytes Redo Buffers 8728576 bytes Database mounted. Database opened. SYS% lunarbb> !free total used free shared buffers cached Mem: 1495512 1402960 92552 0 2208 879872 我的vm目前给了这个oracle 12c standalone (asm+db)共1.4G内存,目前free的是92M -/+ buffers/cache: 520880 974632 Swap: 4095992 183452 3912540 SYS% lunarbb> show parameter cache_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ client_result_cache_size big integer 0 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 32M db_flash_cache_size big integer 0 db_keep_cache_size big integer 0 db_recycle_cache_size big integer 0 SYS% lunarbb> SYS% lunarbb> select COMPONENT,CURRENT_SIZE,MIN_SIZE,MAX_SIZE,GRANULE_SIZE from V$SGA_DYNAMIC_COMPONENTS; COMPONENT CURRENT_SIZE MIN_SIZE MAX_SIZE GRANULE_SIZE ---------------------------------------------------------------- ------------ ---------- ---------- ------------ shared pool 176160768 167772160 176160768 4194304 large pool 8388608 8388608 125829120 4194304 java pool 4194304 4194304 4194304 4194304 streams pool 0 0 0 4194304 DEFAULT buffer cache 146800640 37748736 155189248 4194304 我们看到这里还是140M KEEP buffer cache 0 0 0 4194304 RECYCLE buffer cache 0 0 0 4194304 DEFAULT 2K buffer cache 0 0 0 4194304 DEFAULT 4K buffer cache 0 0 0 4194304 DEFAULT 8K buffer cache 0 0 0 4194304 DEFAULT 16K buffer cache 0 0 0 4194304 DEFAULT 32K buffer cache 0 0 0 4194304 Shared IO Pool 0 0 0 4194304 Data Transfer Cache 0 0 0 4194304 ASM Buffer Cache 0 0 0 4194304 15 rows selected. Elapsed: 00:00:00.09 SYS% lunarbb> show parameter cache_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ client_result_cache_size big integer 0 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 32M db_flash_cache_size big integer 0 db_keep_cache_size big integer 0 db_recycle_cache_size big integer 0 SYS% lunarbb> show sga Total System Global Area 346562560 bytes Fixed Size 2288240 bytes Variable Size 188745104 bytes Database Buffers 146800640 bytes Redo Buffers 8728576 bytes SYS% lunarbb>
好吧,我现在手工设置sga,ASMM和AMM都不用了,回归到8i的sga的设置方法,o(∩_∩)o 哈哈
shared_pool_size=160M db_cache_size=25M java_pool_size=5M large_pool_size=10M log_buffer=6594560 streams_pool_size=5M MEMORY_MAX_TARGET=0 MEMORY_TARGET=0 sga_max_size=0 sga_target=0
再次启动数据库:
[oracle@lunar ~]$ ss SQL*Plus: Release 12.1.0.1.0 Production on Sat Aug 24 23:36:32 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SYS% lunarbb> startup ORACLE instance started. Total System Global Area 238055424 bytes 这次太平了,sga只有230M左右了,我想如果你有耐心,还可以再次调整,不过share pool不建议太小,从11.2开始,如果share pool太小,数据库跑一会就报ORA-4031错误了 Fixed Size 2286840 bytes Variable Size 197135112 bytes Database Buffers 29360128 bytes buffer cache只有我设置的25M,由于自己测试,用到25M buffer cache的时候也不算多,因此,我感觉目前的配置够用了,o(∩_∩)o 哈哈 Redo Buffers 9273344 bytes Database mounted. Database opened. SYS% lunarbb> SYS% lunarbb> select COMPONENT,CURRENT_SIZE,MIN_SIZE,MAX_SIZE,GRANULE_SIZE from V$SGA_DYNAMIC_COMPONENTS; COMPONENT CURRENT_SIZE MIN_SIZE MAX_SIZE GRANULE_SIZE ---------------------------------------------------------------- ------------ ---------- ---------- ------------ shared pool 167772160 167772160 167772160 4194304 large pool 12582912 12582912 12582912 4194304 java pool 8388608 8388608 8388608 4194304 streams pool 8388608 8388608 8388608 4194304 DEFAULT buffer cache 29360128 29360128 29360128 4194304 KEEP buffer cache 0 0 0 4194304 RECYCLE buffer cache 0 0 0 4194304 DEFAULT 2K buffer cache 0 0 0 4194304 DEFAULT 4K buffer cache 0 0 0 4194304 DEFAULT 8K buffer cache 0 0 0 4194304 DEFAULT 16K buffer cache 0 0 0 4194304 DEFAULT 32K buffer cache 0 0 0 4194304 Shared IO Pool 0 0 0 4194304 Data Transfer Cache 0 0 0 4194304 ASM Buffer Cache 0 0 0 4194304 15 rows selected. Elapsed: 00:00:00.04 SYS% lunarbb> 现在看下asm: [grid@lunar ~]$ ss SQL*Plus: Release 12.1.0.1.0 Production on Sat Aug 24 23:55:07 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Automatic Storage Management option SQL> SQL> startup ASM instance started Total System Global Area 313159680 bytes 300M就可以了(以后会不会遇到性能问题或者其他限制,还不知道,o(∩_∩)o 哈哈) Fixed Size 2287856 bytes Variable Size 285706000 bytes ASM Cache 25165824 bytes ASM diskgroups mounted SQL>
关于12c中asm的内存的设置请参考 http://www.lunar2013.com/2013/08/ora-00443-background-process-mmnl-did-not-start.html
可以了,环境基本ready,db的sga只有230M,asm的sga 只有300M(从11.2以后,oracle对asm实例的最低大小是256M).
后面可以跟小伙伴儿们一起在简陋的小本本上玩那些个 12c flex NF了,o(∩_∩)o 哈哈