View memory command under Aix -- turn

1. # lsdev -Cc memory
View
the configured physical memory device, the following is an example of the output:
L2cache0 Available L2 Cache
mem0 Available Memory

# lsattr -El mem0 The
output is similar to the following: goodsize 7936 Amount of usable physical memory in Mbytes False size 7936 Total amount of physical memory in Mbytes False This example shows that the physical memory of the machine is 5888MB . If there is a device name mem1 in the output of lsdev earlier , use the same command to see its corresponding size and so on.


2.
# bootinfo -r
8126464
This example shows that the physical memory of the machine is 8126464kB .

 

3. The output of
# prtconf
is similar to the following:
----
----
Memory Size: 7936 MB
----
----

This command will print the detailed configuration information of the current host, and the output has the Memory Size attribute, indicating its current physical memory size

 

4. The output of
# svmon -G
is similar to the following:
size inuse free pin virtual
memory 2031616 1474504 557112 210251 440972
pg space 131072 1555

work pers clnt
pin 210251 0 0
in use 440972 0 1033532

PageSize PoolSize inuse pgsp pin virtual
s 4 KB - 1426984 1555 187531 393452
m 64 KB - 2970 0 1420 2970
Among them: size represents the size of the real physical memory, the unit is 4k. Therefore, the current physical memory size is 4k*2031616=8126464kB

 

以上命令在Aix5.3版本实验通过 [@more@]

转自:http://javafun.javaeye.com/blog/139228

----

SQL> select 1 - ((physical.value - direct.value - lobs.value) / logical.value) 2 "Buffer Cache Hit Ratio"
3 from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
4 where physical.name = 'physical reads'
5 and direct.name='physical reads direct'
6 and lobs.name='physical reads direct (lob)'
7 and logical.name='session logical reads';

Buffer Cache Hit Ratio
----------------------
.971388642

其中,session logical reads为读的总量.physical reads 为从数据文件读.physical reads direct 为从缓冲区读(不含LOBS).physical reads direct (LOBS)为从缓冲区读(含LOBS)

 

转:

.我们可以通过配置Shared Pool(保证用户在内存中查找到已经缓存的语句)改进性能;还有一个重要的方法就是:使用户可以在内存找到他们所请求的数据! 这就需要通过Database Buffer Cache(数据库缓冲区的高速缓存区)来实现。
Buffer Cache
SGA的一个组件,用来缓存用户最近在数据库中访问过的段数据块的副本。这些副本和它们在磁盘上的对应块是同步的! 如果不同步,就是所谓的脏缓冲区! Cache往磁盘上写,我们称之为写盘。管理脏缓冲区的机制叫做Dirty List(脏列表)Write List(写列表)。这个列表里面跟踪已经insert,update,delete但是还没有写盘的语句。最终的写盘工作由ORACLE后台进程Database Writer(DBW0)完成。
Buffer Cache
也是由一LRU算法来管理。*FTS(全表扫描期间)表缓冲区直接放在LRU的最近最少使用那端。

.测量Database Buffer Cache的性能
select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
"Buffer Cache Hit Ratio"
from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
where physical.name = 'physical reads'
and direct.name='physical reads direct'
and lobs.name='physical reads direct (lob)'
and logical.name='session logical reads';
上述语句当>90%实说明调整充分的。命中率是高的!

.改进Database Buffer Cache的性能
1.
最简单的方法就是加大它的大小。占SGA45%比较合适!几个参数
(1).DB_BLOCK_SIZE
主数据库块大小默认是8K 在建立完数据库之后就不能改变
(2).DB_CACHE_SIZE (
默认缓冲区池) 默认48M我们主要修改这个参数提高性能
alter system set db_cache_advice=on;
使用oracle推荐的统计顾问,在正常操作数据库半小时之后
select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from v$db_cache_advice where block_size='8192' and advice_status='ON';
得到推荐的大小
select obj.owner,obj.object_name,obj.object_type,count(distinct bh.BLOCK#) "NUM. Buffers"
from dba_objects obj,v$bh bh
where obj.object_id=bh.OBJD
and owner != 'SYS'
group by obj.owner,obj.object_name,obj.object_type
上述这段语句可以查看哪些对象正缓存再Buffer Cache中,正使用了多少个Buffer Cache缓冲区。
(3).
使用多个缓冲池
alter system set db_cache_size=300M;
alter system set db_keep_cache_size=150M;
保持区
alter system set db_recycle_cache_size=50M;
回收区将表分配给保持区
alter table col_cust storage (buffer_pool keep);
使用语句
select owner,segment_type,segment_name,buffer_pool
from dba_segments
where buffer_pool != 'DEFAULT';
可以查看分配情况
select name,block_size,current_size
from v$buffer_pool;
可以查看每个Buffer Pool的大小
select name "Buffer Pool",1 - (physical_reads / (db_block_gets + consistent_gets)) "Buffer Pool Hit Ratio"
from v$buffer_pool_statistics order by name;
可以查看每个Buffer Pool的命中率 KEEP越大越好,Recycle越小越好
(4).
在内存中缓存表虽然表可以放在保持区,但是由于Keep Pool也是由LRU控制的,所以当FTS(全表扫描)时,该表还是被放在LRU的最近最少使用那端。这样就有可能被移出。所以我们可以使用
alter table col_cust cache;
的方法把表变成一个高速缓存区表
select owner,table_name from dba_tables where ltrim(cache)='Y'
可以查看高速缓存区表的信息

转自:http://blog.csdn.net/luoyanqing119/archive/2008/10/30/3183099.aspx

---

Oracle命中率查询,SGA调优

---

--数据高速缓存区命中率
  --计算公式:1-(physical reads / (db block gets + consistent gets))
  --命中率应大于0.90最好
  
  select name,value
  from v$sysstat
  where name in ('physical reads','db block gets','consistent gets')
  /
  
  --共享区库缓存区命中率
  --计算公式:SUM(pins - reloads) / SUM(pins)
  --命中率应大于0.99
  
  select sum(pins-reloads)/sum(pins)
  from v$librarycache
  /
  
  --共享区字典缓存区命中率
  --计算公式:SUM(gets - getmisses - usage -fixed) / SUM(gets)
  --命中率应大于0.85
  
  select sum(gets-getmisses-usage-fixed)/sum(gets)
  from v$rowcache
  /
  
  --检测回滚段的争用
  --SUM(waits)值应小于SUM(gets)值的1%
  
  select sum(gets),sum(waits),sum(waits)/sum(gets)
  from v$rollstat
  /
  
  --检测回滚段收缩次数
  
  select name,shrinks
  from v$rollstat, v$rollname
  where v$rollstat.usn = v$rollname.usn
  /
  
  --关于SGA的调优
  
  (****) : OS 使用内存+ SGA + session*(sort_area_size + hash_area_size + 2M) < 总物理RAM 为好
  log_buffer : 128K ---- 1M 之间通常问题不大,不应该太大
  large_pool_size :如果不设置MTS,通常在 RMAN 、OPQ 会使用到,但是在10M --- 50M 应该差不多了。
  java_pool_size : 若不使用java,给30M通常就够了
  data buffer ,在做了前面的设置后,凡可以提供给oracle的内存,都应该给data buffer = (db_block_size * db_block_buffers)
  不能设置 shared_pool_size 过大,通常应该控制在200M--300M
  
  再具体化,注意满足上面(****) 的原则的基础上可以参考如下设置
  如果512M RAM
  建议 shared_pool_size = 50M, data buffer = 200M
  
  如果1G RAM
  shared_pool_size = 100M , data buffer = 500M
  
  如果2G
  shared_pool_size = 150M ,data buffer = 1.2G
  
  物理内存再大已经跟参数没有关系了
  假定64 bit ORACLE
  内存4G
  shared_pool_size = 200M , data buffer = 2.5G
  
  内存8G
  shared_pool_size = 300M , data buffer = 5G
  
  内存 12G
  shared_pool_size = 300M-----800M , data buffer = 8G

转自:http://oracle.chinaitlab.com/optimize/38281.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326784546&siteId=291194637