oracle cache table,Multiple-table cache group配置
1.准备测试表和数据
SQL> CREATE TABLE customer
2 (cust_num NUMBER(6) NOT NULL PRIMARY KEY,
3 name VARCHAR2(50)
4 );
Table created.
SQL> CREATE TABLE orders
2 (ord_num NUMBER(10) NOT NULL PRIMARY KEY,
3 cust_num NUMBER(6) NOT NULL
4 );
Table created.
SQL> insert into customer values(1,'wwww.xifenfei.com1');
1 row created.
SQL> insert into customer values(2,'wwww.xifenfei.com2');
1 row created.
SQL> insert into customer values(3,'wwww.xifenfei.com3');
1 row created.
SQL> insert into customer values(4,'wwww.xifenfei.com4');
1 row created.
SQL> insert into orders(cust_num,ord_num) values(1,1);
1 row created.
SQL> insert into orders (cust_num,ord_num) values(1,2);
1 row created.
SQL> insert into orders (cust_num,ord_num) values(3,5);
1 row created.
SQL> insert into orders (cust_num,ord_num) values(3,6);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from customer;
CUST_NUM NAME
---------- --------------------------------------------------
1 wwww.xifenfei.com1
2 wwww.xifenfei.com2
3 wwww.xifenfei.com3
4 wwww.xifenfei.com4
SQL> select * from orders;
ORD_NUM CUST_NUM
---------- ----------
1 1
2 1
5 3
6 3
SQL> grant select on oratt.customer to cacheuser;
Grant succeeded.
SQL> grant select on oratt.orders to cacheuser;
Grant succeeded.
2.创建cache group
[oracle@xifenfei ~]$ ttIsql "DSN=tt_1122;UID=cacheuser;PWD=timesten;OraclePWD=oracle"
Command> drop cache group cacheuser.customer_orders;
Command> CREATE READONLY CACHE GROUP customer_orders
> AUTOREFRESH INTERVAL 5 SECONDS
> STATE ON
> FROM oratt.customer
> (cust_num NUMBER(6) NOT NULL,
> name VARCHAR2(50),
> PRIMARY KEY(cust_num)),
> oratt.orders
> (ord_num NUMBER(10) NOT NULL,
> cust_num NUMBER(6) NOT NULL,
> PRIMARY KEY(ord_num),
> FOREIGN KEY(cust_num) REFERENCES oratt.customer(cust_num));
Command> cachegroups;
Cache Group CACHEUSER.CUSTOMER_ORDERS:
Cache Group Type: Read Only
Autorefresh: Yes
Autorefresh Mode: Incremental
Autorefresh State: On
Autorefresh Interval: 5 Seconds
Autorefresh Status: ok
Aging: No aging defined
Root Table: ORATT.CUSTOMER
Table Type: Read Only
Child Table: ORATT.ORDERS
Table Type: Read Only
1 cache groups found.
3.TT中表访问授权
[oracle@xifenfei ~]$ ttisql tt_1122
Command> grant select on oratt.customer to cacheuser;
Command> grant select on oratt.orders to cacheuser;
4.测试数据初始化
[oracle@xifenfei ~]$ ttIsql "DSN=tt_1122;UID=cacheuser;PWD=timesten;OraclePWD=oracle"
Command> select * from oratt.customer;
< 1, wwww.xifenfei.com1 >
< 2, wwww.xifenfei.com2 >
< 3, wwww.xifenfei.com3 >
< 4, wwww.xifenfei.com4 >
4 rows found.
Command> select * from oratt.orders;
< 1, 1 >
< 2, 1 >
< 5, 3 >
< 6, 3 >
4 rows found.
5.ORACLE修改数据
SQL> update customer set name='xifenfei' where cust_num=2;
1 row updated.
SQL> insert into customer values(5,'wwww.xifenfei.com5');
1 row created.
SQL> delete from customer where cust_num=1;
1 row deleted.
SQL> commit;
Commit complete.
6.TT中验证数据
Command> select * from oratt.customer;
< 2, xifenfei >
< 3, wwww.xifenfei.com3 >
< 4, wwww.xifenfei.com4 >
< 5, wwww.xifenfei.com5 >
4 rows found.
Command> select * from oratt.orders;
< 5, 3 >
< 6, 3 >
2 rows found.
7.补充说明
7.1)在oracle中需要授权cacheuser有访问oratt中相关表权限,不然创建cache group失败
7.2)自动刷新数据需要设置AUTOREFRESH STATE ON,其他方法初始化关联表的数据暂未知
7.3)在TT中,关联表删除是级联的
oracle cache table,Multiple-table cache group配置相关推荐
- oracle redo wait较高,【案例】Oracle等待事件latch:row cache objects原因和解决办法
[案例]Oracle等待事件latch:row cache objects原因和解决办法 时间:2016-11-05 13:41 来源:Oracle研究中心 作者:HTZ 点击: 次 天萃 ...
- Oracle PLSQL 导出数据table xx contains one or more CLOB columns 解决方案
Oracle PLSQL 导出数据table xx contains one or more CLOB columns 解决方案 参考文章: (1)Oracle PLSQL 导出数据table xx ...
- oracle buffer block,8 Oracle深度学习笔记——BUFFER CACHE深入一
8.Oracle深度学习笔记--BUFFER CACHE深入一 最近项目一直和ORACLE死磕,感觉总是找不到出口,只能多看书少说话了. 先记录多少是多少吧! BUFFER CACHE在ORACLE的 ...
- table 合并列_Table.Group相邻的两个数合并案例
本期案例是对相邻的两个不同的数进行合并,连续有多个相邻的数是相同的,则往后合并,直至使合并的非重复个数是两个为止,如果当前数与上一个数相同,则显示为空,合并后效果下:--源数据: {4,5,4,2,4 ...
- Android studio 快速解决Gradle's dependency cache may be corrupt 和 Gradle配置 gradle-3.*-all.zip快速下载
用了好久的AS了,官方版本更新,各种配置工具 也跟着更新.更新后导入工程时(使用Android工程编译或者导入新的工程没有对应的gradle版本)一些电脑出现一下问题. Error:Failed to ...
- oracle sequences优化_性能优化-Oracle RAC中的Sequence Cache问题
性能优化-Oracle RAC中的Sequence Cache问题 enq: SQ - contention 在RAC情况下,可以将使用频繁的序列Cache值增加到10000,或者更高到50000,这 ...
- Oracle Flashback之Flashback table和flashback drop
在Oracle 10g中, Flash back家族分为以下成员: Flashback Database Flashback Drop Flashback Table Flashback Query( ...
- Oracle后台专家解决library cache锁争用的终极武器
今天来给大家分享一个Oracle使用中的小技巧. 当某条SQL语句或者对象被反复访问,过多的软解析可能会造成大量的"library cache:mutex X"争用,有什么样的方法 ...
- Hibernate里插入oracle数据出现:ORA-01747: invaid user.table.column, table.column, or column specification
Hibernate里插入oracle数据出现ORA-01747: invaid user.table.column, table.column, or column specificati ...
- 【安装篇】- 基于 VMWARE Oracle Linux7.9 安装 Oracle19c RAC 详细配置方案
作者 | yanwei 来源 | 墨天轮 https://www.modb.pro/db/95684 大家好,我是 JiekeXu,很高兴又和大家见面了,今天和大家一起来看看 Linux7.9 安装 ...
最新文章
- keep健身软件电脑版_keep下载安装2020官方版-keep健身软件免费版下载v6.125.0 安卓最新版...
- 新闻行业中,自然语言理解技术该如何应用?
- y电容如何选型_常用电子元器件分类选型以及单端反激正激变压器设计 (MOS管、电感部分)...
- Android Studio如何发布APK
- tuxedo linux 安装
- FFmpeg之yuv旋转(十九)
- 团队管理心得--建团队,管事理人
- 微服务系统和分布式系统的区别
- macOS下R语言入门操作教程
- RNAcentral:非编码RNA数据库
- ModernUI教程
- linux下好用的中文输入法
- 普通话测试-短文60篇文章,附带拼音(11-20篇)
- windows无法上网:代理服务器出现问题或地址有误
- js转换Date日期格式
- java写的家谱_关于java:家谱计划的逻辑
- win7更新_微软最新累积更新导致Win7及以上版本VB6/VBA/VBS运行异常
- 多维数组java_Java多维数组
- Javascript 私有变量
- 关于微信浏览器调整字体大小,H5页面适配问题