ITPub博客

首页 > 数据库 > 数据库开发技术 > Timesten导入数据到Cache Group

Timesten导入数据到Cache Group

原创 数据库开发技术 作者:jolly10 时间:2012-03-27 17:02:59 0 删除 编辑
Timesten导入数据到Cache Group[@more@]

1.load cache group语句来导入read only的cache group
用户必须有CACHE_MANAGER或 LOAD CACHE GROUP的权限

下面的语句会导入cacheadm.ro cache group,HR.DEPARTMENTS有27条数据
Command> load cache group ro commit every 256 rows;
27 cache instances affected.

也可以用load cache group来导入可update的cache group
Command> load cache group g_awt where employees.employee_id > 200 commit every 0 rows;
6 cache instances affected.

2.用select 语句导入可update的cache group
用hr帐户登入,查询之前用load cache group导入的6笔数据
Command> connect "dsn=ljg_tt1122;uid=hr;pwd=hr;orclepwd=hr";

Warning 01S00: Undefined connection attribute "orclepwd" in connection string

Connection successful: DSN=ljg_tt1122;UID=hr;DataStore=/home/timesten/TimesTen/tt1122/info/ljg;DatabaseCharacterSet=WE8MSWIN1252;ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1122/lib/libtten.so;LogDir=/home/timesten/TimesTen/tt1122/info/ljg/logs;PermSize=64;TempSize=32;TypeMode=0;OracleNetServiceName=orcl131;
(Default setting AutoCommit=1)
con1: Command> select employee_id, first_name from employees;
< 201, Michael >
< 202, Pat >
< 203, Susan >
< 204, Hermann >
< 205, Shelley >
< 206, William >
6 rows found.

用select导入一笔资料


con4: Command> connect "dsn=ljg_tt1122;uid=hr;pwd=hr;oraclepwd=hr";
Connection successful: DSN=ljg_tt1122;UID=hr;DataStore=/home/timesten/TimesTen/tt1122/info/ljg;DatabaseCharacterSet=WE8MSWIN1252;ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1122/lib/libtten.so;LogDir=/home/timesten/TimesTen/tt1122/info/ljg/logs;PermSize=64;TempSize=32;TypeMode=0;OracleNetServiceName=orcl131;
(Default setting AutoCommit=1)
con5: Command> select first_name, last_name from employees where employee_id=100;
< Steven, King >
1 row found.
con5: Command>
con5: Command> select count(*) from employees;
< 7 >
1 row found.

如果导入的子表的数据,则主表的数据会自动被导入,job_history是employees的子表。
con5: Command> select employee_id, start_date, end_date from job_history where employee_id=200;
< 200, 1995-09-17 00:00:00, 2001-06-17 00:00:00 >
< 200, 2002-07-01 00:00:00, 2006-12-31 00:00:00 >
2 rows found.
con5: Command> select count(*) from employees;
< 8 >
1 row found.

最后把cachr group "g_awt"的数据全部导进来
con5: Command> connect "dsn=ljg_tt1122;uid=cacheadm;pwd=cacheadm;oraclepwd=cacheadm";
Connection successful: DSN=ljg_tt1122;UID=cacheadm;DataStore=/home/timesten/TimesTen/tt1122/info/ljg;DatabaseCharacterSet=WE8MSWIN1252;ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1122/lib/libtten.so;LogDir=/home/timesten/TimesTen/tt1122/info/ljg/logs;PermSize=64;TempSize=32;TypeMode=0;OracleNetServiceName=orcl131;
(Default setting AutoCommit=1)
con6: Command> load cache group g_awt commit every 256 rows;
99 cache instances affected.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/271283/viewspace-1057743/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-02-20

  • 博文量
    263
  • 访问量
    768044