`
nannan408
  • 浏览: 1753640 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

oracle如何让表常驻内存?

 
阅读更多
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'
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics