Timesten匯入資料到Cache Group

jolly10發表於2012-03-27
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章