* 歯医者へ [#z30eb2e2]

あまりにも痛く、休みを取って歯医者へ。

- 歯医者 880円

前に詰めたところはまた虫歯になっているようですがそこは特に痛みもなく、
その隣が見た目は虫歯ではないのに激痛という。

暫定措置として痛み止めの薬を詰められておしまいになりましたが、
最終的には神経を抜かないと痛みは引かないとのこと。

少なくとも短答の試験まではこれで持てばいいんですが。
麻酔してもぜんぜん効いてなかったし、不安は残ります。

* Oracle [#zcd71e28]

#amazon(4798119911,left)
DB Magazine の定期購読のおまけということで、
本が来ました。

だいたい知ってることばかりではありますが、
より実践的にまとまっているので役には立ちそうです。
#amazon(,clear)

* 本 [#l3808149]

amazonで注文していた本が来ました。22時過ぎに来るとは。。

#amazon(4004308690,left)
昨年合格したという方に紹介されて。文庫本ですし、
通勤時間にさらさらと読もうと思います。
#amazon(,clear)

* お勉強 [#tcfd4927]

歯医者で待っていたときに短答アドヴァンステキストのTRIPs協定を少々。

あとは不正競争防止法の過去問。

- 1 不正競争
-- 3 営業秘密
-- 4 ドメイン名
-- 5 原産地表示
-- 6 不正競争全般
- 2 その他禁止行為

* Oracle Database + TimesTen [#m0b8313b]

Oracle Database 11g R1 のテーブルを
TimesTen 11g にキャッシュしてみるという実験。

まだちょっと触ってみただけなので、
ちゃんとまとまったら技術文書に書きます。
いつになるかはわかりませんが。

HR.EMPLOYEES 表を使いました。

** Database側 [#ba540e62]

#pre{{
[oracle@ora1 ~]$ sqlplus hr/hr

SQL*Plus: Release 11.1.0.6.0 - Production on 水 4月 14 20:21:00 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.



Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
に接続されました。
SQL> select count(*) from employees;

  COUNT(*)
----------
       107

SQL> 
}}

** TimesTen 側 [#q4fc5421]

ログは適当に改行しています。

#pre{{
timesten@osol:~$ ttIsql "DSN=cacheprod1;UID=hr;PWD=hr;OraclePWD=hr"

Copyright (c) 1996-2009, Oracle.  All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.



connect "DSN=cacheprod1;UID=hr;PWD=hr;OraclePWD=hr";
Connection successful: DSN=cacheprod1;UID=hr;
DataStore=/export/home/timesten/product/TimesTen/prod1/DataStore;
DatabaseCharacterSet=JA16EUC;
ConnectionCharacterSet=US7ASCII;
PermSize=64;TypeMode=0;OracleNetServiceName=prod1;
(Default setting AutoCommit=1)
Command> select count(*) from employees;
< 107 >
1 row found.
Command> 
}}

#pre{{
Command> cachegroups;

Cache Group HR.EMPLOYEES_CACHE:

  Cache Group Type: Asynchronous Writethrough
  Autorefresh: No
  Aging: No aging defined

  Root Table: HR.EMPLOYEES
  Table Type: Propagate

1 cache group found.
Command> 
}}

クエリーも流してみます。なぜこんなサンプルなのかというと
CASE の実験もしてみたかったからです(笑)

#pre{{
Command> timing 1
Command> @scripts/case.sql

select 
  case
  when hire_date >= sysdate then 1
  else 0
  end as status
from employees
where employee_id = 190;
< 0 >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.000051 seconds.
Command> 
}}

51マイクロ秒ですか。すごい速さですね。

** TimesTen での更新 [#u438b249]

AWT の場合、Replication agent を動かさないと
Oracle Database には反映されません。

あらかじめ起動しておきます。

#pre{{
Command> call ttrepstart;
}}

1行 insert してみます。データは適当です。

#pre{{
Command> insert into employees values (
       > 207, 'Takashi', 'Sugimura', 'sugimura', '10.10.10.10', sysdate, 'AC_ACCOUNT', 9000, null, 205, 110);
1 row inserted.
Execution time (SQLExecute) = 0.000827 seconds.
}}

非同期ということでどうなるのかなと思っていましたが、
ちゃんと反映されました。

#pre{{
SQL> select employee_id, first_name, last_name from employees
  2  where employee_id = 207;

EMPLOYEE_ID FIRST_NAME
----------- ------------------------------------------------------------
LAST_NAME
---------------------------------------------------------------------------
        207 Takashi
Sugimura


SQL> 

}}

* Database での更新 [#cef0164c]

今度は逆に、Database で insert してみて TimesTen に反映されるかどうかを見てみました。

#pre{{
SQL> insert into employees values (
  2  208, 'Foo', 'Bar', 'sugitk', '100.100.100.100', sysdate, 'AC_ACCOUNT', 9100, null, 206, 110);

1行が作成されました。

SQL> commit;

コミットが完了しました。

SQL> 
}}

TimesTen で見てみます。

#pre{{
Command>  select * from employees where employee_id = 208;
0 rows found.
Command> 
}}

うーん。反映されません。

明示的に load してみるとうまくいきました。

#pre{{
Command> load cache group employees_cache commit every 0 rows;
1 cache instance affected.
Command> select * from employees where employee_id = 208;
< 208, Foo, Bar, sugitk, 100.100.100.100, 2010-04-14 21:51:15, AC_ACCOUNT, 9100, <NULL>, 206, 110 >
1 row found.
Command> 
}}

cache group を作るときのパラメータなど、
何かタイミングがあるんでしょうね。まだよくわかりません。

こんな小さいテーブルじゃなくて、もっと大きいのでも試してみたいです。

** 参考文献 [#j8030a9c]

- [[TimesTen In-Memory Databaseドキュメント 11g リリース2(11.2.1):http://download.oracle.com/docs/cd/E16662_01/welcome.html]]
- [[Creating and Managing an ASYNCHRONOUS WRITETHROUGH (AWT) Cache Group in Oracle In-Memory Database Cache 7.0:http://www.oracle.com/technology/products/timesten/obe/awtcg/awtcachegroup.htm]]

----
#comment

トップ   差分 履歴 リロード   一覧 検索 最終更新   ヘルプ   最終更新のRSS