Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1731327
  • 博文数量: 600
  • 博客积分: 10581
  • 博客等级: 上将
  • 技术积分: 6205
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-06 10:13
文章分类
文章存档

2016年(2)

2015年(9)

2014年(8)

2013年(5)

2012年(8)

2011年(36)

2010年(34)

2009年(451)

2008年(47)

分类: Oracle

2015-08-12 10:28:58

1.前言。 
  如题。 
2.如何常驻内存 
  摘自:http://blog.163.com/ouyangjie0002/blog/static/190709248201161644658941/  
  (create table 表名 (字段) storage (buffer_pool keep); --建表时把表缓存到KEEP中 

alter table 表名 storage(buffer_pool keep);--把已存在的表缓存至KEEP中 

create table 表名(字段..) storage (buffer_pool keep) cache;--创建缓存表 

ALTER TABLE Table_Name STORAGE ( BUFFER_POOL KEEP) ; 
oracle的db_buffer_pool由三部分组成: 
buffer_pool_defualt 
buffer_pool_keep 
buffer_pool_recycle 

如果要把表钉死在内存中,也就是把表钉在keep区。 

相关的命令为: 

alter table ..... storage(buffer_pool keep); 

这句命令把表示表如果缓存的话是缓存在keep区。 

可以通过语句: 

select table_name from dba_tables where buffer_pool='KEEP';查询到改表是放在keep区中的。 

但是不意味着表已经被缓存了。 

下面的语句把表缓存: 

alter table .... cache; 

可以通过 

select table_name from dba_ tables where rtrim(cache)='Y' 

查询到该表已经被缓存了。 

加入到keep区的表不是说不能被移出内存,不过是比较不容易移出内存。 

也可以手工来移出内存,命令如下: 

alter table ... nocache; 

实例 

--select *from sms_accounts 
--alter table sms_accounts storage(BUFFER_POOL KEEP) 
--alter table ECHOBASE20110515  storage(BUFFER_POOL KEEP) 
--select table_name from dba_tables where buffer_pool='KEEP' 
--alter table sms_accounts cache 
--alter table ECHOBASE20110515 cache 
--select table_name,cache from user_tables where table_name='ECHOBASE20110515' 
--select table_name,cache from user_tables where table_name='SMS_ACCOUNTS' 
阅读(1940) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~