<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>TimesTen</title>
	<atom:link href="http://www.ttisql.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ttisql.com</link>
	<description>Oracle  In-Memory  DataBase</description>
	<pubDate>Fri, 15 Jan 2010 04:24:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TimesTen 11g/7 中清除Cache Group</title>
		<link>http://www.ttisql.com/cachegroup/timesten-11g-dropcg.html</link>
		<comments>http://www.ttisql.com/cachegroup/timesten-11g-dropcg.html#comments</comments>
		<pubDate>Fri, 15 Jan 2010 03:58:32 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[CacheConnect]]></category>

		<category><![CDATA[drop ttgriddetachall detach 删除]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=561</guid>
		<description><![CDATA[
1.&#160;&#160;&#160;&#160; Cache Group/Grid的清除
&#160;
在TimesTen 7以上的版本中，如果已经建了Cache Group，而你想直接ttdestroy datastore的话，会报如下的错误：
&#160;
[timesten@rac1 info]$ ttdestroy tt_workshop
Failed to destroy data store: TT10026: Some cache groups that hold triggers and other objects in Oracle may exist in the datastore, drop all the cache groups before destroying the datastore &#8212; file &#34;db.c&#34;, lineno 22014, procedure &#34;sbDbDestroy&#34;
&#160;
这是因为建立Cache Group的时候会在Oracle那边的创建一些底层的辅助性的objects，所以要求你在ttdestroy之前必须先drop 掉 相关的Cache Group。
&#160;
在我们上面的例子中，在RAC1节点上，有三个Cache Group，分别是AWT、G_AWT、RO。
&#160;
[timesten@rac1 info]$ ttisql tt_workshop
Command&#62; cachegroups;
&#160;
Cache [...]]]></description>
			<content:encoded><![CDATA[<div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">1.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">Cache Group/Grid</span></b><b><span style="font-size: 14pt">的清除</span></b></div>
<div style="text-indent: 21pt">&nbsp;</div>
<div style="text-indent: 21pt">在TimesTen 7以上的版本中，如果已经建了Cache Group，而你想直接ttdestroy datastore的话，会报如下的错误：</div>
<div style="text-indent: 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">[timesten@rac1 info]$ ttdestroy tt_workshop</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">Failed to destroy data store: TT10026: Some cache groups that hold triggers and other objects in Oracle may exist in the datastore, drop all the cache groups before destroying the datastore &#8212; file &quot;db.c&quot;, lineno 22014, procedure &quot;sbDbDestroy&quot;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">这是因为建立Cache Group的时候会在Oracle那边的创建一些底层的辅助性的objects，所以要求你在ttdestroy之前必须先drop 掉 相关的Cache Group。</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">在我们上面的例子中，在RAC1节点上，有三个Cache Group，分别是AWT、G_AWT、RO。</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">[timesten@rac1 info]$ ttisql tt_workshop</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; cachegroups;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">Cache Group CACHEUSER.AWT:</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Cache Group Type: Asynchronous Writethrough</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Autorefresh: No</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Aging: No aging defined</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Root Table: ORATT.BONUS</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Table Type: Propagate</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">Cache Group CACHEUSER.G_AWT:</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Cache Group Type: Asynchronous Writethrough global (Dynamic)</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Autorefresh: No</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Aging: LRU on</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Root Table: ORATT.DEPT</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Table Type: Propagate</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Child Table: ORATT.EMP</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Table Type: Propagate</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">Cache Group CACHEUSER.RO:</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Cache Group Type: Read Only</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Autorefresh: Yes</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Autorefresh Mode: Incremental</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Autorefresh State: On</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Autorefresh Interval: 5 Seconds</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Autorefresh Status: unknown</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Aging: No aging defined</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Root Table: ORATT.SALGRADE</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;Table Type: Read Only</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">3 cache groups found.</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">Command&gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">那么清除Cache Group有哪几种方式呢？一般有如下三种</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 52.5pt; text-indent: -21pt"><b><span>1)<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><u>推荐的命令方式</u></b></div>
<div style="margin: 0cm 0cm 0pt 52.5pt; text-indent: -21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">//执行下面命令之前必须保证Oracle是运行的，且replication agent是关闭的，但cache agent是打开的。如果有Cache Grid的话，必须先detach。</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">ttisql tt_workshop</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; grant drop any table to cacheuser;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b>&nbsp;</b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">ttisql &quot;dsn=tt_workshop;uid=cacheuser;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; Call ttGridDetachAll;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; call ttrepstop;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; drop cache group g_awt;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; drop cache group awt;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; drop cache group ro;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; Call ttcachestop;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; exit;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">ttdestroy tt_workshop;</span></u></b></div>
<div><b>&nbsp;</b></div>
<div style="margin: 0cm 0cm 0pt 52.5pt; text-indent: -21pt"><b><span>2)<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><u>通过脚本手工删除方式</u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">有的时候，Oracle那边的额东东可能是通过手工方式创建，虽然这种情形比较少，那么随后的清除Cache Group也必须通过手工的方式去做。</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">ttisql &quot;dsn=tt_workshop;uid=cacheuser;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; cachesqlget INCREMENTAL_AUTOREFRESH RO UNINSTALL /tmp/obj.sql;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; exit</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">% sqlplus / as sysdba</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">SQL&gt; @/tmp/obj</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">SQL&gt; exit</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b>&nbsp;</b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">这种方式虽然比较少见，不过可以通过这种方式看看到底TimesTen在oracle那边做了些什么。</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 52.5pt; text-indent: -21pt"><b><span>3)<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><u>暴力方式</u></b></div>
<div><b>&nbsp;</b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">还有一种情形，可能TimesTen突然宕机了，导致datastore或者磁盘无法访问，或者整个datastore都不见了，这样也就无从说起通过命令行或者手工删除的方式去oracle那边清除了。这时候就只能到oracle那边把所有的相关object找出来，直接清除，不过这样做的风险就是，如果你还有其他的TimesTen也连在这个Oracle上，就都失效了。所以一般只是在特殊的情形下，且只有宕机的TimesTen连到这个Oracle。</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b>&nbsp;</b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">% sqlplus / as sysdba</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">SQL&gt; select &#8216;drop &#8216;||object_type ||&#8217; &#8216;||owner||&#8217;.'||object_name|| &#8216;;&#8217; from all_objects where object_name like &#8216;TT\_%&#8217; escape &#8216;\&#8217;;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&#8216;DROP&#8217;||OBJECT_TYPE||&#8221;||OWNER||&#8217;.'||OBJECT_NAME||&#8217;;&#8217;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_USER_COUNT;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_SYNC_OBJS;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_MYGRID_1CGNODEINFO;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_MYGRID_1CGNODEID;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop INDEX CACHEUSER.TT_05_MYGRID_1CGIXIPPORT2;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop INDEX CACHEUSER.TT_05_MYGRID_1CGIXIPPORT;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_MYGRID_1CGGROUPDEFS;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_DDL_TRACKING;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_DDL_L;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_DB_PARAMS;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_DATABASES;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&#8216;DROP&#8217;||OBJECT_TYPE||&#8221;||OWNER||&#8217;.'||OBJECT_NAME||&#8217;;&#8217;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop INDEX CACHEUSER.TT_05_CACHE_STATS_S_U;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_CACHE_STATS;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_AR_PARAMS;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE CACHEUSER.TT_05_AGENT_STATUS;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE TIMESTEN.TT_GRIDINFO;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">drop TABLE TIMESTEN.TT_GRIDID;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">17 rows selected.</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">SQL&gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">然后直接在sqlplus中执行上面生成的drop语句即可。</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&nbsp;</div>
<div style="text-indent: 21pt">一般来说，最好是通过第一种方式，即正常的命令行方式执行清除。如果Cache Grid涉及到多个TimesTen节点，在每个节点上也都要完成同样的清除工作。</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/cachegroup/timesten-11g-dropcg.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen 11g 中创建Cache Grid</title>
		<link>http://www.ttisql.com/cachegroup/timesten-11g-cgrid.html</link>
		<comments>http://www.ttisql.com/cachegroup/timesten-11g-cgrid.html#comments</comments>
		<pubDate>Thu, 14 Jan 2010 02:35:13 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[CacheConnect]]></category>

		<category><![CDATA[cache grid 集群]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=557</guid>
		<description><![CDATA[
1.&#160;&#160;&#160;&#160; 创建全局的AWT Cache Group
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Cahe Grid是11g中一个中的一个亮点，故名思义，它是在Cache Connect这一层架构了一个集群，即底层是同一个Oracle数据库（而且必须有），在此之上是一个TimesTen组成的Cache集群，每个TimesTen缓存部分的Oracle数据，但数据也可以在TimesTen之间流动，同时最终的数据都可以同步到底层的Oracle数据库。所以理想的状况下，每个TimesTen的数据对本地应用来说是完整的，不需要和其它节点或者Oracle交互，但不是很频繁的数据流动也是支持，但个人觉得最好这种操作不要太多，否则肯定影响性能。另外，每行记录在整个Cache Grid最多有且仅有一份，如果数据从A节点流动到B节点，则A节点上的该行数据就没了，只在B节点上有。为什么说最多有且仅有一份呢，因为可能这行记录在所有的TimesTen上都没有，只存在于Oracle上，那么第一次访问的时候，会自动从Oracle加载到相应的TimesTen节点上。
&#160;
//下面的实验接着Cache Group的实验来进行，下面这一步还是在原来的机子上操作的，即RAC1上。用全局的AWT来组成一个Cache Grid，即在多个节点上都有Cache Group，它们逻辑上是同一个数据库，可以保证数据和事务的一致性。
&#160;
//创建的时候必须把replication agent停掉
&#160;
ttisql &#34;dsn=tt_workshop;uid=cacheuser;pwd=timesten;oraclepwd=oracle&#34;
Command&#62; call ttrepstop;
Command&#62; create dynamic asynchronous writethrough global cache group g_awt from
&#160;&#160;&#160;&#160;&#160;&#160; oratt.dept(
&#160;&#160;&#160;&#160;&#160;&#160; deptno number(2) primary key,
&#160;&#160;&#160;&#160;&#160;&#160; dname varchar2(14) ,
&#160;&#160;&#160;&#160;&#160;&#160; loc varchar2(13) 
&#160;&#160;&#160;&#160;&#160;&#160; ),
&#160;&#160;&#160;&#160;&#160;&#160; oratt.emp(
&#160;&#160;&#160;&#160;&#160;&#160; empno number(4) primary key,
&#160;&#160;&#160;&#160;&#160;&#160; ename varchar2(10),
&#160;&#160;&#160;&#160;&#160;&#160; job varchar2(9),
&#160;&#160;&#160;&#160;&#160;&#160; mgr number(4),
&#160;&#160;&#160;&#160;&#160;&#160; hiredate date,
&#160;&#160;&#160;&#160;&#160;&#160; sal number(7,2),
&#160;&#160;&#160;&#160;&#160;&#160;comm number(7,2),
&#160;&#160;&#160;&#160;&#160;&#160; deptno number(2),
&#160;&#160;&#160;&#160;&#160;&#160; foreign [...]]]></description>
			<content:encoded><![CDATA[<div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">1.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">创建全局的</span></b><b><span style="font-size: 14pt">AWT Cache Group</span></b></div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cahe Grid是11g中一个中的一个亮点，故名思义，它是在Cache Connect这一层架构了一个集群，即底层是同一个Oracle数据库（而且必须有），在此之上是一个TimesTen组成的Cache集群，每个TimesTen缓存部分的Oracle数据，但数据也可以在TimesTen之间流动，同时最终的数据都可以同步到底层的Oracle数据库。所以理想的状况下，每个TimesTen的数据对本地应用来说是完整的，不需要和其它节点或者Oracle交互，但不是很频繁的数据流动也是支持，但个人觉得最好这种操作不要太多，否则肯定影响性能。另外，每行记录在整个Cache Grid最多有且仅有一份，如果数据从A节点流动到B节点，则A节点上的该行数据就没了，只在B节点上有。为什么说最多有且仅有一份呢，因为可能这行记录在所有的TimesTen上都没有，只存在于Oracle上，那么第一次访问的时候，会自动从Oracle加载到相应的TimesTen节点上。</div>
<div>&nbsp;</div>
<div>//下面的实验接着<a onclick="window.open(this.href,'','resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,status'); return false" href="http://www.ttisql.com/cachegroup/timesten-11g-cgroup.html">Cache Group</a>的实验来进行，下面这一步还是在原来的机子上操作的，即RAC1上。用全局的AWT来组成一个Cache Grid，即在多个节点上都有Cache Group，它们逻辑上是同一个数据库，可以保证数据和事务的一致性。</div>
<div>&nbsp;</div>
<div>//创建的时候必须把replication agent停掉</div>
<div><b>&nbsp;</b></div>
<div><b><u><span style="color: blue">ttisql &quot;dsn=tt_workshop;uid=cacheuser;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div><b><u><span style="color: blue">Command&gt; call ttrepstop;</span></u></b></div>
<div><b><span style="color: blue">Command&gt; create dynamic asynchronous writethrough global cache group g_awt from</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oratt.dept(</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deptno number(2) primary key,</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dname varchar2(14) ,</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loc varchar2(13) </span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oratt.emp(</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; empno number(4) primary key,</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ename varchar2(10),</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; job varchar2(9),</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mgr number(4),</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hiredate date,</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sal number(7,2),</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comm number(7,2),</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deptno number(2),</span></b></div>
<div><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreign key (deptno) references oratt.dept(deptno));</span></b></div>
<div><b><u><span style="color: blue">Command&gt; call ttrepstart;</span></u></b></div>
<div>&nbsp;</div>
<div>//在操作Global AWT之前必须和一个Cache Grid关联，参数具体说明可以参考reference一书，第一个参数1的位置只有在这个节点上存在着active-standby pair的模式，且是standby节点加入到Cache Grid的时候才是2，其它情况下都是1。端口5001则是任意空闲的相互之间可以通讯的任何端口都可以。</div>
<div>&nbsp;</div>
<div><b><u><span style="color: blue">Command&gt; call ttGridAttach(1,&#8217;tt_workshop&#8217;,'rac1&#8242;,5001);</span></u></b></div>
<div><b><u><span style="color: blue">Command&gt; exit;</span></u></b></div>
<div>&nbsp;</div>
<div>//通过oratt用户的查询去动态加载所需的数据</div>
<div><b><u><span style="color: blue">ttisql &quot;dsn=tt_workshop;uid=oratt;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div><b><u><span style="color: blue">Command&gt; select * from oratt.emp;</span></u></b></div>
<div>0 rows found.</div>
<div><b><u><span style="color: blue">Command&gt; select * from oratt.dept;</span></u></b></div>
<div>0 rows found.</div>
<div><b><u><span style="color: blue">Command&gt; <a name="OLE_LINK1">select * from oratt.emp where empno=7900;</a></span></u></b></div>
<div>&lt; 7900, james, clerk, 7698, 1981-12-03 00:00:00, 950, &lt;NULL&gt;, 30 &gt;</div>
<div>1 row found.</div>
<div>&nbsp;</div>
<div>//7900对应的deptno为30，所有deptno=30的记录都被加载</div>
<div><b><u><span style="color: blue">Command&gt; select * from oratt.emp;</span></u></b></div>
<div>&lt; 7499, allen, salesman, 7698, 1981-02-20 00:00:00, 1600, 300, 30 &gt;</div>
<div>&lt; 7521, ward, salesman, 7698, 1981-02-22 00:00:00, 1250, 500, 30 &gt;</div>
<div>&lt; 7654, martin, salesman, 7698, 1981-09-28 00:00:00, 1250, 1400, 30 &gt;</div>
<div>&lt; 7698, blake, manager, 7839, 1981-05-01 00:00:00, 2850, &lt;NULL&gt;, 30 &gt;</div>
<div>&lt; 7844, turner, salesman, 7698, 1981-09-08 00:00:00, 1500, 0, 30 &gt;</div>
<div>&lt; 7900, james, clerk, 7698, 1981-12-03 00:00:00, 950, &lt;NULL&gt;, 30 &gt;</div>
<div>6 rows found.</div>
<div><b><u><span style="color: blue">Command&gt;</span></u></b></div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">2.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">Global AWT</span></b><b><span style="font-size: 14pt">的动态扩展</span></b></div>
<div>&nbsp;</div>
<div style="text-indent: 18pt">按照Cache Grid的架构，当业务增长的时候，需要再配置一台服务器分担业务压力，这时候就涉及到Cache Grid的动态扩展了，即在原来节点上运行的系统不停止的情况下，动态地把一个新的节点加入到已有的集群中去。我们上面实验的机子hostname为RAC1，上面装了TimesTen和Oracle。下面我们在新的机子RAC2上再部署一个TimesTen，并且配置好之后加入到原来的mygrid集群中去。下面所有的操作都是在RAC2上进行的。</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt"><b><span style="font-size: 14pt">a)<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">安装</span></b><b><span style="font-size: 14pt">TimesTen</span></b></div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt">在RAC2安装TimesTen之前，是否需要安装Oracle数据库软件或者Oracle数据库软件的客户端呢？答案是不需要的，但后面TimesTen又确实需要和RAC1上的Oracle同步，那它怎么去访问的呢？在TimesTen 11g的版本中，安装介质里面含有一个Oracle instant client，即简化的客户端软件。在上面创建AWT 以及ReadOnly的例子中，我们配置的tnsnames.ora是在$ORACLE_HOME/network/admin目录下，但RAC2压根就没有$ORACLE_HOME这一说，怎么办呢？可以通过设置TNS_ADMIN来指定tnsnames.ora在哪儿，这个设置可以在安装TimesTen的过程中，通过</div>
<div style="margin: 0cm 0cm 0pt 42pt">Please enter a value for TNS_ADMIN (s=skip)? [&nbsp;]</div>
<div style="margin: 0cm 0cm 0pt 42pt">/home/timesten/TimesTen/tt1121/network/admin</div>
<div style="margin: 0cm 0cm 0pt 42pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt">虽然这个路径安装到这一步提示的时候还没有，但如果你知道TimesTen的路径结构，可以先设置。当然不确定的话，可以先skip掉，安装后之后通过ttmodinstall来修改。</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt"><b><span style="font-size: 14pt">b)<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">配置</span></b><b><span style="font-size: 14pt">DSN</span></b></div>
<div style="margin: 0cm 0cm 0pt 42pt">在RAC2上配置好DSN</div>
<div style="margin: 0cm 0cm 0pt 42pt">[tt_workshop]</div>
<div style="margin: 0cm 0cm 0pt 42pt">Driver=/home/timesten/TimesTen/tt1121/lib/libtten.so</div>
<div style="margin: 0cm 0cm 0pt 42pt">DataStore=/home/timesten/datastore/tt_workshop</div>
<div style="margin: 0cm 0cm 0pt 42pt">DatabaseCharacterSet=ZHS16GBK</div>
<div style="margin: 0cm 0cm 0pt 42pt">PermSize=100</div>
<div style="margin: 0cm 0cm 0pt 42pt">TempSize=32</div>
<div style="margin: 0cm 0cm 0pt 42pt">CkptFrequency=120</div>
<div style="margin: 0cm 0cm 0pt 42pt">CkptLogVolume=0</div>
<div style="margin: 0cm 0cm 0pt 42pt">PLSQL=1</div>
<div style="margin: 0cm 0cm 0pt 42pt">OracleNetServiceName=devdb1</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt"><b><span style="font-size: 14pt">c)<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">设置好环境变量</span></b></div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt">在.bash_profile 中，加入如下行，我还是设置了一个环境变量叫ORACLE_HOME，虽然它跟传统意义上的ORACLE_HOME目录下的东西很不一样，但因为sqlplus工具在这个目录下，所以就这样设置了。</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt">export ORACLE_SID=devdb1</div>
<div style="margin: 0cm 0cm 0pt 42pt">export ORACLE_HOME=/home/timesten/TimesTen/tt1121/ttoracle_home/instantclient_11_1</div>
<div style="margin: 0cm 0cm 0pt 42pt">export TT_HOME=/home/timesten/TimesTen/tt1121</div>
<div style="margin: 0cm 0cm 0pt 42pt">export LD_LIBRARY_PATH=$ORACLE_HOME:$TT_HOME/lib</div>
<div style="margin: 0cm 0cm 0pt 42pt">export TNS_ADMIN=/home/timesten/TimesTen/tt1121/network/admin</div>
<div style="margin: 0cm 0cm 0pt 21pt; text-indent: 21pt">PATH=$ORACLE_HOME:$TT_HOME/bin:$PATH:$HOME/bin</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt"><b><span style="font-size: 14pt">d)<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">创建</span></b><b><span style="font-size: 14pt">TimesTen</span></b><b><span style="font-size: 14pt">用户</span></b></div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt; text-indent: 21pt">//创建和前面实验中同样的用户</div>
<div style="margin: 0cm 0cm 0pt 21pt; text-indent: 21pt"><b><u><span style="color: blue">&nbsp;[timesten@rac2 oraclescripts]$ ttisql tt_workshop</span></u></b></div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt; text-indent: 21pt"><b><u><span style="color: blue">Command&gt; create user cacheuser identified by timesten;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt; text-indent: 10.5pt"><b><u><span style="color: blue">Command&gt; grant create session,cache_manager,create any table to cacheuser;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 42pt"><b><u><span style="color: blue">Command&gt; create user oratt identified by timesten;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt; text-indent: 21pt"><b><u><span style="color: blue">Command&gt; grant create session to oratt;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 42pt"><b><u><span style="color: blue">Command&gt; exit</span></u></b></div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 42pt; text-indent: -21pt"><b><span style="font-size: 14pt">e)<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">创建同一个结群下的另一个</span></b><b><span style="font-size: 14pt">Global AWT</span></b></div>
<div style="margin: 0cm 0cm 0pt 10.5pt; text-indent: 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 10.5pt; text-indent: 21pt">//用cacheuser用户登录创建global AWT</div>
<div style="margin: 0cm 0cm 0pt 31.5pt; text-indent: 10.5pt"><b><u><span style="color: blue">[timesten@rac2]$ttisql &quot;dsn=tt_workshop;uid=cacheuser;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">//设置Cache Group管理用户信息并创建Cache Grid</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; call ttcacheuidpwdset(&#8217;cacheuser&#8217;,'oracle&#8217;);</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b>&nbsp;</b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">//不需要再次call ttgridcreate(&#8217;mygrid&#8217;);</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; call ttgridnameset(&#8217;mygrid&#8217;);</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; call ttCacheStart;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">Command&gt; create dynamic asynchronous writethrough global cache group g_awt from</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oratt.dept(</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deptno number(2) primary key,</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dname varchar2(14) ,</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loc varchar2(13) </span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oratt.emp(</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; empno number(4) primary key,</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ename varchar2(10),</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; job varchar2(9),</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mgr number(4),</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hiredate date,</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sal number(7,2),</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; comm number(7,2),</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deptno number(2),</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreign key (deptno) references oratt.dept(deptno));</span></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; call ttrepstart;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; call ttGridAttach(1,&#8217;tt_workshop&#8217;,'rac2&#8242;,5001);</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; exit;</span></u></b></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">//通过oratt用户去操作数据</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">ttisql &quot;dsn=tt_workshop;uid=oratt;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; select * from oratt.emp where empno=7900;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&lt; 7900, james, clerk, 7698, 1981-12-03 00:00:00, 950, &lt;NULL&gt;, 30 &gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">1 row found.</div>
<div style="margin: 0cm 0cm 0pt 31.5pt"><b><u><span style="color: blue">Command&gt; select * from oratt.emp ;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&lt; 7499, allen, salesman, 7698, 1981-02-20 00:00:00, 1600, 300, 30 &gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&lt; 7521, ward, salesman, 7698, 1981-02-22 00:00:00, 1250, 500, 30 &gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&lt; 7654, martin, salesman, 7698, 1981-09-28 00:00:00, 1250, 1400, 30 &gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&lt; 7698, blake, manager, 7839, 1981-05-01 00:00:00, 2850, &lt;NULL&gt;, 30 &gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&lt; 7844, turner, salesman, 7698, 1981-09-08 00:00:00, 1500, 0, 30 &gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">&lt; 7900, james, clerk, 7698, 1981-12-03 00:00:00, 950, &lt;NULL&gt;, 30 &gt;</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">6 rows found.</div>
<div style="margin: 0cm 0cm 0pt 31.5pt">Command&gt;</div>
<div>&nbsp;</div>
<p><span style="font-size: 10.5pt">此时再通过</span><span style="font-size: 10.5pt">select * from oratt.emp ;</span><span style="font-size: 10.5pt">去检查</span><span style="font-size: 10.5pt">rac1</span><span style="font-size: 10.5pt">节点上的数据，发现没了。即两个节点已经组成了一个Cache Grid，且第二个节点是动态加入进去的，在第二个节点加入的过程中，第一个节点的业务不受影响。回过头去看看，在RAC1节点上既有本地的Cache Group，也有组成Cache Grid的全局Cache Group，如果是本地的则数据不能流动，只是属于本地。所以可以根据具体的需求去创建不同的Cache Group，它们之间可以共存。</span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/cachegroup/timesten-11g-cgrid.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen 11g 中创建Cache Group</title>
		<link>http://www.ttisql.com/cachegroup/timesten-11g-cgroup.html</link>
		<comments>http://www.ttisql.com/cachegroup/timesten-11g-cgroup.html#comments</comments>
		<pubDate>Tue, 12 Jan 2010 08:42:24 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[CacheConnect]]></category>

		<category><![CDATA[timesten 11g cache group]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=552</guid>
		<description><![CDATA[&#160;&#160;&#160; 从TimesTen 7版本过渡到TimesTen 11g，在Cache Group这一块，操作上要复杂些，下面介绍如何在TimesTen 11g中创建Cache Group。主要参考标准文档Oracle &#160;In-Memory Database Cache User&#8217;s Guide 中的第二章 Getting Started。我的环境是RedHat 4 32bit ，TimesTen 11.2。
&#160;

1.&#160;&#160;&#160;&#160; 安装Oracle软件
为了和TimesTen 11g 中底层的OCI接口以及CRS（Oracle Clusterware）的兼容，建议安装11.1.0.7或者以上版本。当然其它版本的Oracle估计也可以，但没有经过完全官方测试，在有些功能上可能会有问题，我就在11.1.0.6的版本上碰到无法卸载TimesTen 11g注册资源的问题，但如果只是普通的功能应该没什么问题。实验中我创建了操作系统用户oracle，且其.bash_profile设置如下：
&#160;
export EDITOR=vi
export ORACLE_SID=devdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_11g
export NLS_LANG=american_america.zhs16gbk
export
PATH=$ORACLE_HOME/bin: /bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin
&#160;
建议先装Oracle，再装TimesTen，这样安装TimesTen的时候可以直接设置TNS_ADMIN的路径，即tnsnames.ora文件所在的路径，位于$ORACLE_HOME/network/admin目录下。如果先装的是TimesTen，后装的Oracle，则要通过ttmodinstall来重新配置TNS_ADMIN路径。我的$ORACLE_HOME/network/admin/tnsnames.ora配置如下：
&#160;
DEVDB1 =
&#160;(DESCRIPTION =
&#160;&#160;&#160; (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521))
&#160;&#160;&#160; (CONNECT_DATA =
&#160;&#160;&#160;&#160;&#160; (SERVER = DEDICATED)
&#160;&#160;&#160;&#160;&#160; (SERVICE_NAME = devdb1)
&#160;&#160;&#160; )
&#160;)
&#160;
2.&#160;&#160;&#160;&#160; 创建timesten用户及/etc/TimesTen目录
&#160;
为了便于管理，不建议用oracle用户或者root用户安装TimesTen，实验中我单独创建了操作系统用户timesten，并使之属于dba以及oinstall组，Primary Group为dba。
&#160;
用root用户创建/etc/TimesTen目录，TimesTen的大小写要一致，并更改所属用户为刚创建的timesten：
&#160;
root#mkdir /etc/TimesTen
root#chown timesten:dba /etc/TimesTen
&#160;
3.&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;&nbsp;&nbsp; 从TimesTen 7版本过渡到TimesTen 11g，在Cache Group这一块，操作上要复杂些，下面介绍如何在TimesTen 11g中创建Cache Group。主要参考标准文档Oracle &nbsp;In-Memory Database Cache User&#8217;s Guide 中的第二章 Getting Started。我的环境是RedHat 4 32bit ，TimesTen 11.2。</div>
<div>&nbsp;</div>
<div>
<p><b><span style="font-size: 14pt">1.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">安装</span></b><b><span style="font-size: 14pt">Oracle</span></b><b><span style="font-size: 14pt">软件</span></b></p>
<div style="margin: 0cm 0cm 0pt 21pt">为了和TimesTen 11g 中底层的OCI接口以及CRS（Oracle Clusterware）的兼容，建议安装11.1.0.7或者以上版本。当然其它版本的Oracle估计也可以，但没有经过完全官方测试，在有些功能上可能会有问题，我就在11.1.0.6的版本上碰到无法卸载TimesTen 11g注册资源的问题，但如果只是普通的功能应该没什么问题。实验中我创建了操作系统用户oracle，且其.bash_profile设置如下：</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export EDITOR=vi</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export ORACLE_SID=devdb1</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export ORACLE_BASE=/u01/app/oracle</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_11g</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export NLS_LANG=american_america.zhs16gbk</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">PATH=$ORACLE_HOME/bin: /bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">建议先装Oracle，再装TimesTen，这样安装TimesTen的时候可以直接设置TNS_ADMIN的路径，即tnsnames.ora文件所在的路径，位于$ORACLE_HOME/network/admin目录下。如果先装的是TimesTen，后装的Oracle，则要通过ttmodinstall来重新配置TNS_ADMIN路径。我的$ORACLE_HOME/network/admin/tnsnames.ora配置如下：</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><span style="color: blue">DEVDB1 =</span></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><span style="color: blue">&nbsp;(DESCRIPTION =</span></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp; (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521))</span></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp; (CONNECT_DATA =</span></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (SERVER = DEDICATED)</span></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (SERVICE_NAME = devdb1)</span></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp; )</span></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><span style="color: blue">&nbsp;)</span></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">2.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">创建</span></b><b><span style="font-size: 14pt">timesten</span></b><b><span style="font-size: 14pt">用户及</span></b><b><span style="font-size: 14pt">/etc/TimesTen</span></b><b><span style="font-size: 14pt">目录</span></b></div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">为了便于管理，不建议用oracle用户或者root用户安装TimesTen，实验中我单独创建了操作系统用户timesten，并使之属于dba以及oinstall组，Primary Group为dba。</div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">用root用户创建/etc/TimesTen目录，TimesTen的大小写要一致，并更改所属用户为刚创建的timesten：</div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">root#mkdir /etc/TimesTen</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">root#chown timesten:dba /etc/TimesTen</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">3.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">安装</span></b><b><span style="font-size: 14pt">TimesTen</span></b><b><span style="font-size: 14pt">软件</span></b></div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">可以去<a href="http://www.oracle.com/technology/software/products/timesten/index.html">http://www.oracle.com/technology/software/products/timesten/index.html</a> 下载最新的TimesTen版本11.2.1.4.0 (timesten112140.linux86.tar.gz)，然后解压安装。</div>
<div style="margin: 0cm 0cm 0pt 18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt">在安装的时候要注意的地方：</div>
<ul>
<li>TNS_ADMIN的设置</li>
</ul>
<div style="margin: 0cm 0cm 0pt 36pt; text-indent: 3pt">Please enter a value for TNS_ADMIN (s=skip)? [&nbsp;]</div>
<div style="margin: 0cm 0cm 0pt 36pt; text-indent: 3pt">/u01/app/oracle/product/11.1.0/db_11g/network/admin</div>
<ul>
<li>Enable PL/SQL</li>
</ul>
<div style="margin: 0cm 0cm 0pt 18pt">Would you like to enable PL/SQL for this instance? [ yes ]yes</div>
<ul>
<li>选择文档以及Demo的安装</li>
</ul>
<div style="margin: 0cm 0cm 0pt 18pt">Do you want to install QuickStart and the TimesTen Documentation? [ no ] yes</div>
<div style="margin: 0cm 0cm 0pt 18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">4.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">设置环境变量</span></b></div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt">修改timesten用户的.bash_profile，增加如下设置：</div>
<div style="margin: 0cm 0cm 0pt 18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export ORACLE_SID=devdb1</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export ORACLE_BASE=/u01/app/oracle</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_11g</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export TT_HOME=/home/timesten/TimesTen/tt1121</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$TT_HOME/lib</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">export&nbsp;PATH=$ORACLE_HOME/bin:$TT_HOME/bin:$PATH:$HOME/bin</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt">要注意的是LD_LIBRARY_PATH，因为cache connect要调用oracle下的一些动态链接库，所以一定要设置准确，64位平台上可能名字叫lib64。退出并重新登录，使环境变量起作用。</div>
<div style="margin: 0cm 0cm 0pt 18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">5.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">初始化配置</span></b></div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt">现在我们跟着文档Oracle &nbsp;In-Memory Database Cache User&#8217;s Guide 的第二章Getting Started一步步做，这个初始化工作都一样的，做一次就可以了。建议大家先把这一章读一遍，知道里面到底是要做些什么，Oracle里面涉及到如下几个用户：</div>
<ul>
<li>TIMESTEN</li>
</ul>
<div style="margin: 0cm 0cm 0pt 18pt">这个用户名字无法修改指定，是直接通过timesten的安装脚本产生的，这个用户是使用Cache Grid的时候要用的，专门管理Cache Grid的元数据信息。当然你如果直接修改其脚本可以达到修改用户名的目的，但以后使用Cache Grid时肯定会碰到问题。可以认为是TimesTen在Oracle这边的定制用户。</div>
<ul>
<li>cacheuser</li>
</ul>
<div style="margin: 0cm 0cm 0pt 18pt">这个用户是用于管理Cache Connect，比如drop cache group，create cache group，启动关闭cache agent等日常维护操作。</div>
<ul>
<li>oratt</li>
</ul>
<div style="margin: 0cm 0cm 0pt 18pt">真正的最终数据所在的schema用户，所以在生产系统中，这个用户是我们经常要用到的，比如对表进行insert、update、delete等时，就要用这个用户了。</div>
<div style="margin: 0cm 0cm 0pt 18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">[timesten@rac1 oraclescripts]$ cd $TT_HOME/oraclescripts</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">[timesten@rac1 oraclescripts]$ pwd</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">/home/timesten/TimesTen/tt1121/oraclescripts</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">[timesten@rac1 oraclescripts]$ sqlplus / as sysdba</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">//为管理cache group创建单独的Oracle表空间</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">SQL&gt; create tablespace cachetblsp datafile &#8216;datfttuser.dbf&#8217; size 100m;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">//在Oracle中创建TimesTen用户以及配置对应的表空间</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">SQL&gt; @initCacheGlobalSchema &quot;cachetblsp&quot;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">Please enter the tablespace where TIMESTEN user is to be created</div>
<div style="margin: 0cm 0cm 0pt 21pt">The value chosen for tablespace is cachetblsp</div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">******* Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE starts *******</div>
<div style="margin: 0cm 0cm 0pt 21pt">1. Creating TIMESTEN schema</div>
<div style="margin: 0cm 0cm 0pt 21pt">2. Creating TIMESTEN.TT_GRIDID table</div>
<div style="margin: 0cm 0cm 0pt 21pt">3. Creating TIMESTEN.TT_GRIDINFO table</div>
<div style="margin: 0cm 0cm 0pt 21pt">4. Creating TT_CACHE_ADMIN_ROLE role</div>
<div style="margin: 0cm 0cm 0pt 21pt">5. Granting privileges to TT_CACHE_ADMIN_ROLE</div>
<div style="margin: 0cm 0cm 0pt 21pt">** Creation of TIMESTEN schema and TT_CACHE_ADMIN_ROLE done successfully **</div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">PL/SQL procedure successfully completed.</div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">//创建表所属的用户</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">SQL&gt; create user oratt identified by oracle default tablespace users;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">//赋予权限</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">SQL&gt; grant create session,resource to oratt;&nbsp;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">Grant succeeded.</div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">//创建Cache Group的管理员用户</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">SQL&gt; create user cacheuser identified by oracle default tablespace cachetblsp quota unlimited on cachetblsp;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">User created.</div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">//赋予相应的权限</div>
<div style="margin: 0cm 0cm 0pt 21pt"><b><u><span style="color: blue">SQL&gt; @grantCacheAdminPrivileges &quot;cacheuser&quot;</span></u></b></div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">Please enter the administrator user id</div>
<div style="margin: 0cm 0cm 0pt 21pt">The value chosen for administrator user id is cacheuser</div>
<div style="margin: 0cm 0cm 0pt 21pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 21pt">***************** Initialization for cache admin begins ******************</div>
<div style="margin: 0cm 0cm 0pt 21pt">0. Granting the CREATE SESSION privilege to CACHEUSER</div>
<div style="margin: 0cm 0cm 0pt 21pt">1. Granting the TT_CACHE_ADMIN_ROLE to CACHEUSER</div>
<div style="margin: 0cm 0cm 0pt 21pt">2. Granting the DBMS_LOCK package privilege to CACHEUSER</div>
<div style="margin: 0cm 0cm 0pt 21pt">3. Granting the RESOURCE&nbsp;privilege to CACHEUSER</div>
<div style="margin: 0cm 0cm 0pt 21pt">4. Granting the CREATE ANY PROCEDURE&nbsp;privilege to CACHEUSER</div>
<div style="margin: 0cm 0cm 0pt 21pt">5. Granting the CREATE ANY TRIGGER&nbsp;privilege to CACHEUSER</div>
<div style="margin: 0cm 0cm 0pt 21pt">6. Checking if the cache administrator user has permissions on the default</div>
<div style="margin: 0cm 0cm 0pt 21pt">tablespace</div>
<div style="margin: 0cm 0cm 0pt 21pt"><span>&nbsp;&nbsp;&nbsp;&nbsp; Permission exists</span></div>
<div style="margin: 0cm 0cm 0pt 21pt">7. Granting the CREATE ANY TYPE privilege to CACHEUSER</div>
<div style="margin: 0cm 0cm 0pt 21pt">********* Initialization for cache admin user done successfully *********</div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">6.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">在</span></b><b><span style="font-size: 14pt">Oracle</span></b><b><span style="font-size: 14pt">中创建表以及初始化数据</span></b></div>
<div>&nbsp;</div>
<div style="margin-left: 40px">su &ndash; timesten</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//记得要先启动oracle listener</div>
<div style="margin-left: 40px">sqlplus&nbsp;<a href="mailto:oratt/oracle@devdb1">oratt/oracle@devdb1</a></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//创建表以及数据并赋予cacheuser用户相关表的访问权限，scott.sql可以在<a target="_blank" href="http://www.ttisql.com//download/timesten/example/scott.sql"><u><strong>这儿</strong></u></a>下载</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">SQL&gt;@ scott.sql </span></u></b></div>
<div style="margin-left: 40px"><b>&nbsp;</b></div>
<div style="margin-left: 40px">//为了后面维护上的方便，讲相应的权限预先都赋予给cacheuser用户。在真实的环境中，不必要把所有的权限都给cacheuser用户，它需要什么要的操作的时候就赋予它什么样的权限即可</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">SQL&gt;grant all on bonus to cacheuser; </span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">SQL&gt;grant all on salgrade to cacheuser;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">SQL&gt;grant all on dept to cacheuser;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">SQL&gt;grant all on emp to cacheuser;</span></u></b></div>
<div>&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">7.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">在</span></b><b><span style="font-size: 14pt">TimesTen</span></b><b><span style="font-size: 14pt">配置</span></b><b><span style="font-size: 14pt">DSN</span></b><b><span style="font-size: 14pt">以及相关设置</span></b></div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt">&nbsp;</div>
<div style="margin-left: 40px">//配置sys.odbc.ini</div>
<div style="margin-left: 40px">[tt_workshop]</div>
<div style="margin-left: 40px">Driver=/home/timesten/TimesTen/tt1121/lib/libtten.so</div>
<div style="margin-left: 40px">DataStore=/home/timesten/datastore/tt_workshop</div>
<div style="margin-left: 40px">DatabaseCharacterSet=ZHS16GBK</div>
<div style="margin-left: 40px">PermSize=100</div>
<div style="margin-left: 40px">TempSize=32</div>
<div style="margin-left: 40px">CkptFrequency=120</div>
<div style="margin-left: 40px">CkptLogVolume=0</div>
<div style="margin-left: 40px">PLSQL=1</div>
<div style="margin-left: 40px">OracleNetServiceName=devdb1</div>
<div>&nbsp;</div>
<div style="margin-left: 40px">//创建缺少的目录</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">mkdir -p /home/timesten/datastore</span></u></b></div>
<div style="margin-left: 40px">//不带用户登录，即为缺省的安装用户，相当于sys用户</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">[timesten@rac1 oraclescripts]$ ttisql tt_workshop</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; create user cacheuser identified by timesten;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; grant create session,cache_manager,create any table to cacheuser;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; create user oratt identified by timesten;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; grant create session,create any table to oratt;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; exit</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//用cacheuser用户登录</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">[timesten@rac1]$ttisql &quot;dsn=tt_workshop;uid=cacheuser;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//设置Cache Group管理用户信息并创建Cache Grid</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; call ttcacheuidpwdset(&#8217;cacheuser&#8217;,'oracle&#8217;);</span></u></b></div>
<div style="margin-left: 40px"><b>&nbsp;</b></div>
<div style="margin-left: 40px">//TimesTen 11g 所有的cache group必须隶属于一个Cache Grid</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; call ttgridcreate(&#8217;mygrid&#8217;);</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; call ttgridnameset(&#8217;mygrid&#8217;);</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; exit</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">至此，所有准备工作全部完成。</div>
<div style="margin: 0cm 0cm 0pt 18pt">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">8.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">创建只读</span></b><b><span style="font-size: 14pt">Cache Group</span></b></div>
<div>&nbsp;</div>
<div style="margin-left: 40px">//cache group的创建都是通过cacheuser用户来进行的</div>
<div style="margin-left: 40px">ttisql &quot;dsn=tt_workshop;uid=cacheuser;pwd=timesten;oraclepwd=oracle&quot;</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; call ttcachestart;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; </span></u><span style="color: blue">create readonly cache group ro</span></b></div>
<div style="margin: 0cm 0cm 0pt 80px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp; Autorefresh&nbsp;interval 5 seconds mode incremental</span></b></div>
<div style="margin: 0cm 0cm 0pt 80px; text-indent: 21.1pt"><b><span style="color: blue">from</span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;oratt.salgrade( </span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grade number primary key,</span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; losal number,</span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hisal number );</span></b></div>
<div style="margin-left: 40px"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; cachegroups;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; load cache group ro commit every 10 rows;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; exit;</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//通过真正的数据拥有者oratt登录进去检查，如果还是通过cacheuser用户查询oratt.salgrade表的话，会报权限不够的错误，可以赋与cacheuser相关权限也可以查询grant select on oratt.salgrade to cacheuser;</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">ttisql &quot;dsn=tt_workshop;uid=oratt;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt;select * from oratt.salgrade;</span></u></b></div>
<div style="margin-left: 40px">&lt; 1, 700, 1200 &gt;</div>
<div style="margin-left: 40px">&lt; 2, 1201, 1400 &gt;</div>
<div style="margin-left: 40px">&lt; 3, 1401, 2000 &gt;</div>
<div style="margin-left: 40px">&lt; 4, 2001, 3000 &gt;</div>
<div style="margin-left: 40px">&lt; 5, 3001, 9999 &gt;</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//在Oracle中针对Oratt.salgrade表插入一条记录并提交</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">SQL&gt;insert into oratt.salgrade values(6,10000,15000);</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">SQL&gt;commit;</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//在TimesTen中验证刚插入的记录已经同步到TimesTen中</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; select * from oratt.salgrade;</span></u></b></div>
<div style="margin-left: 40px">&lt; 1, 700, 1200 &gt;</div>
<div style="margin-left: 40px">&lt; 2, 1201, 1400 &gt;</div>
<div style="margin-left: 40px">&lt; 3, 1401, 2000 &gt;</div>
<div style="margin-left: 40px">&lt; 4, 2001, 3000 &gt;</div>
<div style="margin-left: 40px">&lt; 5, 3001, 9999 &gt;</div>
<div style="margin-left: 40px"><b><span style="border-right: windowtext 1pt solid; padding-right: 0cm; border-top: windowtext 1pt solid; padding-left: 0cm; padding-bottom: 0cm; border-left: windowtext 1pt solid; color: blue; padding-top: 0cm; border-bottom: windowtext 1pt solid">&lt; 6, 10000, 15000 &gt;</span></b></div>
<div style="margin-left: 40px">6 rows found.</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">要注意的是整个timesten只有两种用户cacheuser，oratt。而oracle有三个用户timesten（必须），cacheuser（管理员），oratt（schemauser）</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt"><b><span style="font-size: 14pt">9.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><span style="font-size: 14pt">创建本地的</span></b><b><span style="font-size: 14pt">AWT Cache Group</span></b></div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">ttisql &quot;dsn=tt_workshop;uid=cacheuser;pwd=timesten;oraclepwd=oracle&quot;</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; </span></u><span style="color: blue">create asynchronous writethrough cache group awt from</span></b></div>
<div style="margin: 0cm 0cm 0pt 80px; text-indent: 10.5pt"><b><span style="color: blue">&nbsp;&nbsp;&nbsp; oratt. bonus(</span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; empno number(4) primary key,</span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ename varchar2(10),</span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sal &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; number,</span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; comm &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; number</span></b></div>
<div style="margin: 0cm 0cm 0pt 120px"><b><span style="color: blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) ;</span></b></div>
<div style="margin-left: 40px">//AWT是通过replication agent和oracle同步的，所以必须启动replication agent，否则数据同步不过去</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; call ttrepstart;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; exit;</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//通过oratt进行数据操作</div>
<div style="margin-left: 40px">ttisql &quot;dsn=tt_workshop;uid=oratt;pwd=timesten;oraclepwd=oracle&quot;</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; desc oratt.bonus;</span></u></b></div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; insert into oratt.bonus values(7566,&#8217;jones&#8217;,5000,4500);</span></u></b></div>
<div style="margin-left: 40px">1 row inserted.</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">Command&gt; commit;</span></u></b></div>
<div style="margin-left: 40px">Command&gt;</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">//在Oracle检查数据是否已近过来</div>
<div style="margin-left: 40px"><b><u><span style="color: blue">SQL&gt; select * from oratt.bonus;</span></u></b></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">EMPNO ENAME<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMM</span></div>
<div style="margin-left: 40px">&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</div>
<div style="margin-left: 40px"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7566 jones&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4500</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div>至此实验完成，要注意的是用户之间的切换，如果实在不想切换，也可以一次性把相关的权限都赋予给某个用户，比如cacheuser。</div>
<div>&nbsp;</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/cachegroup/timesten-11g-cgroup.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>通过Perl访问TimesTen</title>
		<link>http://www.ttisql.com/develope/perl-timesten.html</link>
		<comments>http://www.ttisql.com/develope/perl-timesten.html#comments</comments>
		<pubDate>Wed, 14 Oct 2009 04:08:49 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[应 用 开 发]]></category>

		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=547</guid>
		<description><![CDATA[前段时间看到有人在网上问如何通过Perl访问TimesTen，觉得这个问题比较有意思，找了相关资料试了下，通过一个开源的封装接口，Perl能正常访问TimesTen，实验步骤如下：
&#160;

创建一个DSN并能正常访问,创建一个用户test并赋予权限


[tt705@west-mountain info]$ ttisql ttcore


Copyright (c) 1996-2008, Oracle. &#160;All rights reserved.
Type ? or &#34;help&#34; for help, type &#34;exit&#34; to quit ttIsql.
All commands must end with a semicolon character.


connect &#34;DSN=ttcore&#34;;
Connection successful: DSN=ttcore;UID=tt705;DataStore=/home/tt705/TimesTen/tt705/info/ttcore;&#8230;CkptFrequency=300;TypeMode=0;
(Default setting AutoCommit=1)
Command&#62; create user test identified by &#8216;test&#8217;;
Command&#62; grant all to test;
&#160;

下载开源的封装好的Perl接口

&#160;
可以到原网站上直接下载：http://www.perl.com/CPAN/modules/by-module/DBD/DBD-TimesTen-0.06.tar.gz&#160;， 如有问题可以参考README文件. 貌似最新的版本就是0.06，一直没有更新。
&#160;

解压并安装

&#160;

[tt705@west-mountain ~]$ unzip DBD-TimesTen-0.06.tar.gz
[tt705@west-mountain ~]$ tar -xvf DBD-TimesTen-0.06.tar&#160;
&#160;

设置系统变量

&#160;
export &#160; &#160;DBI_DSN=dbi:TimesTen:ttcore

export &#160; &#160;DBI_USER=test
export [...]]]></description>
			<content:encoded><![CDATA[<div>前段时间看到有人在网上问如何通过Perl访问TimesTen，觉得这个问题比较有意思，找了相关资料试了下，通过一个开源的封装接口，Perl能正常访问TimesTen，实验步骤如下：</div>
<div>&nbsp;</div>
<ul>
<li><u><strong>创建一个DSN并能正常访问,创建一个用户test并赋予权限</strong></u></li>
</ul>
<div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain info]$ ttisql ttcore</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); "><br />
</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">Copyright (c) 1996-2008, Oracle. &nbsp;All rights reserved.</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">Type ? or &quot;help&quot; for help, type &quot;exit&quot; to quit ttIsql.</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">All commands must end with a semicolon character.</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); "><br />
</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">connect &quot;DSN=ttcore&quot;;</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">Connection successful: DSN=ttcore;UID=tt705;DataStore=/home/tt705/TimesTen/tt705/info/ttcore;&#8230;CkptFrequency=300;TypeMode=0;</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">(Default setting AutoCommit=1)</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">Command&gt; create user test identified by &#8216;test&#8217;;</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">Command&gt; grant all to test;</span></div>
<div style="margin-left: 40px; ">&nbsp;</div>
<ul>
<li><u><strong>下载开源的封装好的Perl接口</strong></u></li>
</ul>
<div style="margin-left: 40px; ">&nbsp;</div>
<div style="margin-left: 40px; ">可以到原网站上直接下载：<a target="popup" href="http://www.perl.com/CPAN/modules/by-module/DBD/DBD-TimesTen-0.06.tar.gz">http://www.perl.com/CPAN/modules/by-module/DBD/DBD-TimesTen-0.06.tar.gz&nbsp;</a>， 如有问题可以参考<a target="popup" href="http://www.perl.com/CPAN/modules/by-module/DBD/DBD-TimesTen-0.06.readme">README</a>文件. 貌似最新的版本就是0.06，一直没有更新。</div>
<div style="margin-left: 40px; ">&nbsp;</div>
<ul>
<li><u><strong>解压并安装</strong></u></li>
</ul>
<div>&nbsp;</div>
<div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain ~]$ unzip DBD-TimesTen-0.06.tar.gz</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain ~]$ tar -xvf DBD-TimesTen-0.06.tar</span><span style="background-color: rgb(153, 153, 255); ">&nbsp;</span></div>
<div>&nbsp;</div>
<ul>
<li><u><strong>设置系统变量</strong></u></li>
</ul>
<div>&nbsp;</div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); "><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">export &nbsp; &nbsp;DBI_DSN=dbi:TimesTen:ttcore</span></span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "></p>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">export &nbsp; &nbsp;DBI_USER=test</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">export &nbsp; &nbsp;DBI_PASS=test</span></div>
<p></span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); "><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">export &nbsp; &nbsp;TT_HOME=/home/tt705/TimesTen/</span></span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><wbr></wbr></span><span style="background-color: rgb(153, 153, 255); "><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">tt705</span></span></div>
<div>&nbsp;</div>
<ul>
<li><u><strong>修改Makefile.PL</strong></u></li>
</ul>
<div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain ~]$ cd DBD-TimesTen-0.06</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain DBD-TimesTen-0.06]$ ls</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">ChangeLog &nbsp;dbdimp.h &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dbivport.h &nbsp; MANIFEST &nbsp; &nbsp; &nbsp; META.yml &nbsp;t &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TimesTen.pm</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">dbdimp.c &nbsp; DBD-TimesTen.spec &nbsp;Makefile.PL &nbsp;MANIFEST.SKIP &nbsp;README &nbsp; &nbsp;TimesTen.h &nbsp;TimesTen.xs</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); "><br type="_moz" /><br />
</span></div>
<div style="margin-left: 40px; "><span style="color: rgb(255, 0, 0); "><span style="background-color: rgb(153, 153, 255); ">修改之前备份一下，原有的Makefile.PL是为client/server方式的连接准备的，我们要修改成direct方式的</span></span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain DBD-TimesTen-0.06]$ cp Makefile.PL Makefile.PL.Client</span></div>
</div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain DBD-TimesTen-0.06]$ vi Makefile.PL&nbsp;</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); "><br type="_moz" /><br />
</span></div>
<div style="margin-left: 40px; "><span style="color: rgb(255, 0, 0); "><span style="background-color: rgb(153, 153, 255); ">将第91行进行如下的修改，即将client/server模式的编译方式换成direct方式的</span></span><span style="background-color: rgb(153, 153, 255); ">&nbsp;</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">$opts{LIBS} = &quot;-L$timesten_home/lib -lttclient&quot;;</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">&#8211;&gt;</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">$opts{LIBS} = &quot;-L$timesten_home/lib -ltten&quot;;</span></div>
<div>&nbsp;</div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">&nbsp;</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "></p>
<ul>
<li><strong><u>make并安装</u></strong></li>
</ul>
<div>&nbsp;</div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain DBD-TimesTen-0.06]$ perl Makefile.PL</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain DBD-TimesTen-0.06]$ make</span></div>
<div style="margin-left: 40px; "><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain DBD-TimesTen-0.06]$ make install</span></div>
<div style="margin-left: 40px; ">&nbsp;</div>
<div style="margin-left: 40px; ">可能会碰到有些目录权限的问题，赋予相应的权限即可。</div>
<div style="margin-left: 40px; ">&nbsp;</div>
<ul>
<li><u><strong>创建下面的应用程序保存为test.t文件</strong></u></li>
</ul>
<div style="margin-left: 40px; ">
<div><span style="background-color: rgb(153, 153, 255); ">#!/usr/bin/perl</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">use strict;</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">use DBI;</span></div>
<div><span style="background-color: rgb(153, 153, 255); "><br />
</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">MAIN:</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">{</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">my ($db, $st, $row);</span></div>
<div><span style="background-color: rgb(153, 153, 255); "><br />
</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">$db = DBI-&gt;connect(&#8217;DBI:TimesTen:DSN=ttcore&#8217;, &#8216;test&#8217;, &#8216;test&#8217;)</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">or die $DBI::errstr;</span></div>
<div><span style="background-color: rgb(153, 153, 255); "><br />
</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">$st = $db-&gt;prepare(&quot;select * from monitor&quot;)</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">or die $DBI::errstr;</span></div>
<div><span style="background-color: rgb(153, 153, 255); "><br />
</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">$st-&gt;execute()</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">or die $DBI::errstr;</span></div>
<div><span style="background-color: rgb(153, 153, 255); "><br />
</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">while ($row = $st-&gt;fetchrow_hashref())</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">{</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">foreach (keys %{$row})</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">{</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">printf &quot;%s=%s\n&quot;, $_, $row-&gt;{$_};</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">}</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">}</span></div>
<div><span style="background-color: rgb(153, 153, 255); "><br />
</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">$st-&gt;finish();</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">$db-&gt;disconnect();</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">};</span></div>
</div>
<ul>
<li><span class="Apple-style-span" style="font-weight: bold; "><u><strong>运行perl test.t</strong></u></span>&nbsp;</li>
</ul>
<div style="margin-left: 40px; ">
<div><span style="background-color: rgb(153, 153, 255); ">[tt705@west-mountain DBD-TimesTen-0.06]$ perl test.t</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">REP_CONFLICT_COUNT=0</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">TEMP_IN_USE_HIGH_WATER=3521</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">DS_CHECKPOINTS_FUZZY=0</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">TIME_OF_1ST_CONNECT=Sun Sep 27 20:07:00 2009 &nbsp; &nbsp; &nbsp; &nbsp;</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">SYS5=0</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">DEADLOCKS=0</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">SYS13=0</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">SYS4=0</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">REP_XACT_COUNT=0</span></div>
<div><span style="background-color: rgb(153, 153, 255); ">&#8230;</span></div>
</div>
<p></span></div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/develope/perl-timesten.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>SQL Developer 2.1 for TimesTen 发布</title>
		<link>http://www.ttisql.com/news/sqldeveloper21.html</link>
		<comments>http://www.ttisql.com/news/sqldeveloper21.html#comments</comments>
		<pubDate>Fri, 25 Sep 2009 02:47:36 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[最 新 动 态]]></category>

		<category><![CDATA[sqldeveloper]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=543</guid>
		<description><![CDATA[&#160;SQL Developer 2.1 supports both TimesTen (and In-Memory Database Cache) 11g and 7.0. It contains the following new TimesTen features:
&#160;
&#160;&#160; &#160; &#160; &#160;* In-Memory Database Cache
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160;o Create, Drop, Alter, Load, Refresh, Unload and Flush Cache Groups
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160;o Start and Stop Cache and Replication Agents
&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;SQL Developer 2.1 supports both TimesTen (and In-Memory Database Cache) 11g and 7.0. It contains the following new TimesTen features:</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* In-Memory Database Cache</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;o Create, Drop, Alter, Load, Refresh, Unload and Flush Cache Groups</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;o Start and Stop Cache and Replication Agents</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;o Set and Change Cache Administration User</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* PL/SQL support*</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;o Create, Drop, Edit, Compile, Run and Export PL/SQL subprograms (Packages, Procedures, Functions)</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* Privileges* - Grant, Revoke and View object privileges</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* Aging - Define, Alter and View aging policies on cache and regular tables</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* Statistics - Update and View table/column statistics</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* Plans - Show SQL execution plans</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* Index* - Creation of Bitmap indexes</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp; &nbsp;* Applicable to TimesTen 11g only</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp; &nbsp;Software Downloads and Documentation</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* The download for SQL Developer 2.1 Early Adapter 1 is available on <a target="popup" href="http://www.oracle.com/technology/products/timesten/timesten_sqldeveloper.html"><u><strong>OTN</strong></u></a></div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;* Please refer the <a target="popup" href="http://www.oracle.com/technology/products/timesten/htdocs/doc/sqldev2_1ea1/e15859.pdf"><u><strong>Release Notes</strong></u></a> and the <a target="popup" href="http://www.oracle.com/technology/products/timesten/htdocs/doc/sqldev2_1ea1/e13078.pdf"><u><strong>User&#8217;s Guide</strong></u></a> for more information.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/news/sqldeveloper21.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen 11g 正式发布</title>
		<link>http://www.ttisql.com/news/timesten-11g.html</link>
		<comments>http://www.ttisql.com/news/timesten-11g.html#comments</comments>
		<pubDate>Thu, 02 Jul 2009 11:21:05 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[最 新 动 态]]></category>

		<category><![CDATA[timesten 11g]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=539</guid>
		<description><![CDATA[&#160;
TimesTen 11g终于发布了，可以从OTN上下载，但目前的只有Linux 32bit/64bit 以及 Windows 32bit 三个版本：
&#160;




In-Memory Database Cache 11.2.1.1.0 and TimesTen In-Memory Database 11.2.1.1.0


Note: Each of the platform download file includes the software and documentation for both In-Memory Database Cache and TimesTen In-Memory Database.


&#160;
&#160;
&#160;


&#160;

TimesTen In-Memory Database 11.2.1.1.0 for Linux x86 (32-bit) (611,242,843 bytes)


&#160;

TimesTen In-Memory Database 11.2.1.1.0 for Linux x86 (64-bit) (663,579,857 bytes)


&#160;

TimesTen In-Memory Database [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>TimesTen 11g终于发布了，可以从OTN上下载，但目前的只有Linux 32bit/64bit 以及 Windows 32bit 三个版本：</div>
<div>&nbsp;</div>
<div>
<table width="100%" border="0">
<tbody>
<tr>
<td colspan="3"><span class="parahead1">In-Memory Database Cache 11.2.1.1.0 and TimesTen In-Memory Database 11.2.1.1.0</span></td>
</tr>
<tr>
<td colspan="3" height="16"><span class="boldbodycopy">Note: </span><span class="textA">Each of the platform download file includes the software and documentation for both In-Memory Database Cache and TimesTen In-Memory Database.</span></td>
</tr>
<tr>
<td width="17">&nbsp;</td>
<td align="right" width="35">&nbsp;</td>
<td width="858">&nbsp;</td>
</tr>
<tr>
<td width="17">&nbsp;</td>
<td align="right" width="35"><img height="13" alt="Download" width="13" align="top" border="0" src="http://oracleimg.com/admin/images/ocom/download_icon13.gif" /></td>
<td width="858"><span class="bodycopy"><a class="bodylink" onclick="youMustAgreePrompt();" name="file1">TimesTen In-Memory Database 11.2.1.1.0 for Linux x86 (32-bit)</a> </span><span class="textA">(611,242,843 bytes)</span></td>
</tr>
<tr>
<td width="17">&nbsp;</td>
<td align="right" width="35"><img height="13" alt="Download" width="13" align="top" border="0" src="http://oracleimg.com/admin/images/ocom/download_icon13.gif" /></td>
<td width="858"><span class="bodycopy"><a class="bodylink" onclick="youMustAgreePrompt();" name="file2">TimesTen In-Memory Database 11.2.1.1.0 for Linux x86 (64-bit)</a> </span><span class="textA">(663,579,857 bytes)</span></td>
</tr>
<tr>
<td width="17">&nbsp;</td>
<td align="right" width="35"><img height="13" alt="Download" width="13" align="top" border="0" src="http://oracleimg.com/admin/images/ocom/download_icon13.gif" /></td>
<td width="858"><span class="bodycopy"><a class="bodylink" onclick="youMustAgreePrompt();" name="file3">TimesTen In-Memory Database 11.2.1.1.0 for Windows (32-bit)</a> </span><span class="textA">(136,223,544 bytes)</span></td>
</tr>
<tr>
<td width="17" height="22">&nbsp;</td>
<td class="boldbodycopy" colspan="2" height="22">Notes:</td>
</tr>
<tr>
<td width="17" height="16">&nbsp;</td>
<td valign="top" width="35" height="16"><img height="11" alt="" width="35" src="http://www.oracle.com/technology/images/bullets_and_symbols/blk_line_bullet_35.gif" /></td>
<td class="bodycopy" valign="top" width="858" height="16">The TimesTen 11.2.1.1.0 Linux x86 (32-bit and 64-bit) downloads support Oracle Enterprise Linux 4 and 5, RedHat Enterprise Linux 4 and 5, SUSE Linux Enterprise Server 10, Asianux 2.0 and MontaVista CGE 4.0 and 5.0.</td>
</tr>
<tr>
<td width="17" height="16">&nbsp;</td>
<td class="boldbodycopy" colspan="2" height="22">Directions</td>
</tr>
<tr>
<td width="17" height="16">&nbsp;</td>
<td valign="top" width="35" height="16"><img height="11" alt="" width="35" src="http://www.oracle.com/technology/images/bullets_and_symbols/blk_line_bullet_35.gif" /></td>
<td class="bodycopy" valign="top" width="858" height="16">See the <a class="bodylink" href="http://download.oracle.com/docs/cd/E13085_01/doc/timesten.1121/e13080.pdf">Release Notes</a> and <a class="bodylink" href="http://download.oracle.com/docs/cd/E13085_01/doc/timesten.1121/e13063.pdf">Installation Guide</a> for system requirements.</td>
</tr>
<tr>
<td width="17" height="16">&nbsp;</td>
<td valign="top" width="35" height="16"><img height="11" alt="" width="35" src="http://www.oracle.com/technology/images/bullets_and_symbols/blk_line_bullet_35.gif" /></td>
<td class="bodycopy" valign="top" width="858" height="16">See the complete <a class="bodylink" href="http://download.oracle.com/docs/cd/E13085_01/doc/index.htm">product documentation</a>.</td>
</tr>
</tbody>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/news/timesten-11g.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Replication的修改和变动</title>
		<link>http://www.ttisql.com/replication/alter-replication.html</link>
		<comments>http://www.ttisql.com/replication/alter-replication.html#comments</comments>
		<pubDate>Sun, 28 Jun 2009 05:01:57 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[Replication]]></category>

		<category><![CDATA[alter replication 变动]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=528</guid>
		<description><![CDATA[&#160;
在TimesTen中，如果创建完Replication之后，是否能做一些调整呢？比如系统上线之后，发现要增加新的表到Replication中，或者说要调整某些列（增加，删除，修改缺省值等等），TimesTen是否支持这些要求？如果支持，如何去做呢？而且在做的时候，是否对运行的业务有影响？因为Replication的主要作用就是保证服务的不停止。
&#160;
在TimesTen的标准文档中，Replication.pdf一书中，详细介绍了具体的过程以及功能，现摘录如下。
&#160;
Alter 或者 Drop&#160;Replication Scheme
&#160;
其支持的功能如下

Adding a table or sequence to an existing replication scheme
Adding a cache group to an existing replication scheme
Adding a DATASTORE element to an existing replication scheme
Dropping a table or sequence from a replication scheme
Creating and adding a subscriber data store
Dropping a subscriber data store
Changing a TABLE or SEQUENCE element name
Replacing a master [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>在TimesTen中，如果创建完Replication之后，是否能做一些调整呢？比如系统上线之后，发现要增加新的表到Replication中，或者说要调整某些列（增加，删除，修改缺省值等等），TimesTen是否支持这些要求？如果支持，如何去做呢？而且在做的时候，是否对运行的业务有影响？因为Replication的主要作用就是保证服务的不停止。</div>
<div>&nbsp;</div>
<div>在TimesTen的<a target="popup" href="http://www.ttisql.com/download/standarddoc.html"><span style="color: #0000ff"><strong>标准文档</strong></span></a>中，Replication.pdf一书中，详细介绍了具体的过程以及功能，现摘录如下。</div>
<div>&nbsp;</div>
<div><u><strong>Alter 或者 Drop&nbsp;Replication Scheme</strong></u></div>
<div>&nbsp;</div>
<div>其支持的功能如下</div>
<ul>
<li>Adding a table or sequence to an existing replication scheme</li>
<li>Adding a cache group to an existing replication scheme</li>
<li>Adding a DATASTORE element to an existing replication scheme</li>
<li>Dropping a table or sequence from a replication scheme</li>
<li>Creating and adding a subscriber data store</li>
<li>Dropping a subscriber data store</li>
<li>Changing a TABLE or SEQUENCE element name</li>
<li>Replacing a master data store</li>
<li>Eliminating conflict detection</li>
<li>Eliminating the return receipt service</li>
<li>Changing the port number</li>
<li>Changing the replication route</li>
</ul>
<div>&nbsp;</div>
<div>&nbsp;以active standby pair为例（下面的试验均已它为例，如果不熟悉这一块的，请参考</div>
<div><a href="http://www.ttisql.com/replication/pair-disaster-recovery-1.html"><u><strong><span style="color: #0000ff">http://www.ttisql.com/replication/pair-disaster-recovery-1.html</span></strong></u></a>），创建好两个DataStore，分别为dsa（active）和dsb（Standby），创建一个表并在此基础之上创建active standby pair：</div>
<div>&nbsp;</div>
<div><span style="background-color: #9999ff">create table TEST.TT (<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A NUMBER(38) NOT NULL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; B NUMBER(38) DEFAULT 88,<br />
&nbsp;&nbsp;&nbsp; primary key (A));</span></div>
<div><span style="background-color: #9999ff">&nbsp;</span></div>
<div><span style="background-color: #9999ff">create active standby pair<br />
&nbsp;&nbsp;&nbsp; DSA on &quot;WEST-MOUNTAIN&quot;, DSB on &quot;WEST-MOUNTAIN&quot; return receipt <br />
&nbsp;&nbsp;&nbsp; store DSA on &quot;WEST-MOUNTAIN&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; port 20000<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failthreshold 5<br />
&nbsp;&nbsp;&nbsp; store DSB on &quot;WEST-MOUNTAIN&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; port 22000<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failthreshold 5;</span></div>
<div>&nbsp;</div>
<div>验证复制正常工作。然后在创建一个新的表T1：</div>
<div>&nbsp;</div>
<div><span style="background-color: #9999ff">create table TEST.T1 (<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A NUMBER(38) NOT NULL,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; B NUMBER(38),<br />
&nbsp;&nbsp;&nbsp; primary key (A));</span></div>
<div>&nbsp;</div>
<div>那么如何将新加的这个表T1包含到replication中去呢：</div>
<div>&nbsp;</div>
<div><u><strong><span style="background-color: #9999ff">DSA：</span></strong></u></div>
<div><span style="background-color: #9999ff">Command&gt; call ttrepstop;<br />
Command&gt; ALTER&nbsp; active standby pair&nbsp;&nbsp;INCLUDE table t1;<br />
Command&gt; repschemes;</span></div>
<div><span style="background-color: #9999ff">Command&gt; call ttrepstart;<br />
&nbsp;</span></div>
<div><u><strong><span style="background-color: #9999ff">DSB：</span></strong></u></div>
<div><span style="background-color: #9999ff">ttadmin -repstop dsb</span></div>
<div><span style="background-color: #9999ff">ttdestroy dsb</span></div>
<div><span style="background-color: #9999ff">ttrepadmin -duplicate -from dsa -host &quot;west-mountain&quot; -setMasterRepStart -uid test -pwd test -remoteDaemonPort 17050 -nokeepCG&nbsp; -localhost &quot;west-mountain&quot; dsb</span><br />
&nbsp;</div>
<div>也就是说针对这种修改，active standby pair是通过 duplicate 到 standby端的。</div>
<div>&nbsp;</div>
<div><u><strong>Alter&nbsp; Table 在 Replication中</strong></u></div>
<div>&nbsp;</div>
<div>alter table可以是增加或者删除列，这些修改可以直接被复制到对端。但如果是修改一个列的缺省值，则不能被复制，需要把这个修改在每个节点上手工做一遍。从另一个角度说明针对某个列，各个节点可以有不同的缺省值。</div>
<div>&nbsp;</div>
<div>在双向复制的复制器中，需要确定所有的修改都已经同步到对端（通过ttRepSubscriberWait验证），然后再做列的修改。</div>
<div>&nbsp;</div>
<div>如果有多次alter table，最好是每次alter table之后，确认一下是否已经成功，然后再进行下一个alter table。</div>
<div>&nbsp;</div>
<div>以上面的例子为试验对象，</div>
<div>&nbsp;</div>
<div><u><strong><span style="background-color: #9999ff">DSA：</span></strong></u></div>
<div><span style="background-color: #9999ff">Command&gt; alter table tt add column c int;</span></div>
<div><span style="background-color: #9999ff">Command&gt; insert into tt values (1,1,1);</span></div>
<div>
<div><span style="background-color: #9999ff">Command&gt; insert into tt values (2,2,2);</span></div>
<div><span style="background-color: #9999ff">Command&gt; commit;</span></div>
<div>&nbsp;</div>
</div>
<div><strong><u><span style="background-color: #9999ff">DSB：</span></u></strong></div>
<div><span style="background-color: #9999ff">Command&gt; desc tt;</span></div>
<div><span style="background-color: #9999ff">Table TEST.TT:<br />
&nbsp; Columns:<br />
&nbsp;&nbsp; *A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NUMBER (38) NOT NULL<br />
&nbsp;&nbsp;&nbsp; B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NUMBER (38) DEFAULT 88<br />
&nbsp;&nbsp;&nbsp; C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NUMBER (38)</span></div>
<div><span style="background-color: #9999ff">1 table found.<br />
(primary key columns are indicated with *)<br />
Command&gt; select * from tt;<br />
&lt; 1, 1, 1 &gt;<br />
&lt; 2, 2, 2 &gt;<br />
2 rows found.<br />
Command&gt; </span></div>
<div>&nbsp;</div>
<div>可以看出，对列的增加和删除，并不用停止replication agent，而且很方便。但在alter table的过程中肯定是要加表级锁的，所以在那一刹那对应用还是有阻塞的，也是正常的。</div>
<div>&nbsp;</div>
<div>但如果是修改列的缺省属性，则不会被复制到对端，而需要手工在对端同样修改一次。</div>
<div>&nbsp;</div>
<div><u><strong>Truncate Table 在 Replication 中</strong></u></div>
<div>&nbsp;</div>
<div>Truncate可以被复制到对端，相当于每个节点上执行truncate操作。类似于delete，但和delete不同的是，delete删除的记录两边是一摸一样的，而truncate则不会判断记录是否一样，一次性全部删除。</div>
<div>&nbsp;</div>
<div><u><strong>改变 Subscriber DataStore的状态</strong></u></div>
<div>&nbsp;</div>
<div>可以通过命令行工具ttRepAdmin -state&nbsp;或者调用存储过程 ttRepSubscriberStateSet来设置，可能的状态有Start、Pause、Stop、Failed等。</div>
<div>&nbsp;</div>
<div><u><strong>解决 Update 冲突</strong></u></div>
<div>&nbsp;</div>
<div>实际中只有在双向复制的时候才会发生这种冲突，但一般不建议使用双向复制，即使迫不得已使用，也最好是数据针对应用切分，即底层不会有交叉应用的数据。否则真的等到冲突的时候，代价太大了，多半需要人工干预，也就失去了Replication的本意。</div>
<div>&nbsp;</div>
<div><u><strong>从失败中恢复</strong></u></div>
<div>&nbsp;</div>
<div>这个涉及的范围很广，具体分为硬件问题（系统、网络），软件问题（操作系统、应用程序、数据库、误操作）。具体可参考<a href="http://www.ttisql.com/replication/pair-disaster-restore-1.html">http://www.ttisql.com/replication/pair-disaster-restore-1.html</a></div>
<div>&nbsp;</div>
<div><u><strong>升级DataStore</strong></u></div>
<div>&nbsp;</div>
<div>这个也涉及很多东西，包括版本、数据类型、应用程序等等，一般通过ttMigrate&nbsp;和 ttRepAdmin等工具进行。以后会写一篇专门的帖子来谈升级的问题。</div>
<div>&nbsp;</div>
<div>在TimesTen中，因为历史的原因，有两种类型的replication，一种是旧的，老版本的replication；另一种是新的，我们称之为active standby pair 类型，那么针对active standby pair，在修改的时候，有些特别的地方的。其支持的修改功能如下：</div>
<div>&nbsp;</div>
<ul>
<li>Adding or dropping a subscriber data store</li>
<li>Altering store attributes - Only the PORT and TIMEOUT attributes can be set for subscribers. The RELEASE clause cannot be set for any data store in an active standby pair.</li>
<li>Including tables or cache groups in the active standby pair</li>
<li>Excluding tables or cache groups from the active standby pair<br />
    &nbsp;</li>
</ul>
<ol>
<li>针对 Active Standby Pair ，一般Alter步骤如下：</li>
<li>停止active上的replication agent</li>
<li>停止active上的cache agent，如果有用到的话</li>
<li>在active上执行alter active standby pair&#8230;</li>
<li>启动Active上的replication agent</li>
<li>启动Active上的cache agent，如果需要的话</li>
<li>Destroy 掉standby 以及 subscriber 对应的datastore</li>
<li>重建Standby 以及 Subscriber (通过dulicate）</li>
</ol>
<div>&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/replication/alter-replication.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>各种情形下的数据迁移</title>
		<link>http://www.ttisql.com/faq/data-migrate.html</link>
		<comments>http://www.ttisql.com/faq/data-migrate.html#comments</comments>
		<pubDate>Tue, 09 Jun 2009 13:06:12 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[migrate copy move ttbulkcp ttmigrate 迁移]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=517</guid>
		<description><![CDATA[&#160;
TimesTen提供了各种工具来满足在不同情形下数据的迁移、备份、恢复、移动位置等要求。

&#160;不同版本间的数据迁移

可以使用ttMigrate工具，ttMigrate将datastore备份到一个二进制的文件中，这种格式的数据文件是独立与版本的。
也可以使用ttBulkcp工具，一个表一个表的进行，只是比较麻烦一些。

不同硬件或者平台间的数据迁移

可以使用ttBulkCp工具，ttBulkCp将表中的数据备份到一个ASCII文件中，类似与Oracle数据库中的spool命令，该ASCII文件可用于将数据恢复到其它的硬件平台上。
也可以ttMigrate工具，比如在32位的Solaris和64位的Solaris系统之间做数据的迁移。

&#160;往一个表中添加数据

&#160;
使用ttBulkCp工具，直接将ASCII文件形式存储的数据添加到表中。
&#160;

备份和恢复数据

&#160;
使用ttBackUp 和 ttRestore 工具进行，这两个是专门用于这个DataStore的数据备份和恢复的，在需要反复准备原始数据的测试环境中尤其有用。而且备份又分为增量备份和完全备份。
&#160;

导入数据并更改表名

&#160;
使用ttMigrate工具，带上参数 - rename&#160; 即可。
&#160;

改变已有系统的字符集

&#160;
可以使用ttMigrate工具，原字符集导出，然后导入到新字符集的DataStore即可，当然需要字符集之间有包含关系，否则有数据失真。这个功能在Oracle数据库中是不可想象的，而且好像没有现成的工具去实现同样的目的。
&#160;

迁移数据到另一个目录

使用ttBackUp 和 ttRestore即可，再恢复之前定义上新的路径即可。
&#160;

和其它数据库之间的数据迁移

&#160;
通过ttBulkCp导出到文本文件中，然后其它数据库通过其自身的工具将文本文件的数据导入，或者反之。如果对端是Oracle数据库的话，额外的一种途径是Cache Group，但除非Cache Group中的数据只是在TimesTen是只读的，否则不建议通过这种方式来在Oracle和TimesTen之间做数据迁移。因为如果Cache Agent不关的话，会对性能有影响；如果把Cache Agent关掉的话，如果有修改的事物的话，又会有日志的累积。
&#160;
要注意的是，如果涉及到不同的平台或者不同的版本之间的数据迁移，所用的工具只是用当时当地的工具。比如说从32位的平台上迁移到64位的平台上，那么导出的工具是32位平台上的ttMigrate，导入的工具是用64位的ttMigrate。
&#160;
]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>TimesTen提供了各种工具来满足在不同情形下数据的迁移、备份、恢复、移动位置等要求。</p>
<ul>
<li><strong>&nbsp;不同版本间的数据迁移</strong></li>
</ul>
<p style="margin-left: 40px">可以使用ttMigrate工具，ttMigrate将datastore备份到一个二进制的文件中，这种格式的数据文件是独立与版本的。</p>
<p style="margin-left: 40px">也可以使用ttBulkcp工具，一个表一个表的进行，只是比较麻烦一些。</p>
<ul>
<li><strong>不同硬件或者平台间的数据迁移</strong></li>
</ul>
<p style="margin-left: 40px">可以使用ttBulkCp工具，ttBulkCp将表中的数据备份到一个ASCII文件中，类似与Oracle数据库中的spool命令，该ASCII文件可用于将数据恢复到其它的硬件平台上。</p>
<p style="margin-left: 40px">也可以ttMigrate工具，比如在32位的Solaris和64位的Solaris系统之间做数据的迁移。</p>
<ul>
<li><strong>&nbsp;往一个表中添加数据</strong></li>
</ul>
<div>&nbsp;</div>
<div style="margin-left: 40px">使用ttBulkCp工具，直接将ASCII文件形式存储的数据添加到表中。</div>
<div>&nbsp;</div>
<ul>
<li><strong>备份和恢复数据</strong></li>
</ul>
<div>&nbsp;</div>
<div style="margin-left: 40px">使用ttBackUp 和 ttRestore 工具进行，这两个是专门用于这个DataStore的数据备份和恢复的，在需要反复准备原始数据的测试环境中尤其有用。而且备份又分为增量备份和完全备份。</div>
<div>&nbsp;</div>
<ul>
<li><strong>导入数据并更改表名</strong></li>
</ul>
<div>&nbsp;</div>
<div style="margin-left: 40px">使用ttMigrate工具，带上参数 - rename&nbsp; 即可。</div>
<div>&nbsp;</div>
<ul>
<li><strong>改变已有系统的字符集</strong></li>
</ul>
<div>&nbsp;</div>
<div style="margin-left: 40px">可以使用ttMigrate工具，原字符集导出，然后导入到新字符集的DataStore即可，当然需要字符集之间有包含关系，否则有数据失真。这个功能在Oracle数据库中是不可想象的，而且好像没有现成的工具去实现同样的目的。</div>
<div style="margin-left: 40px">&nbsp;</div>
<ul>
<li><strong>迁移数据到另一个目录</strong></li>
</ul>
<div style="margin-left: 40px">使用ttBackUp 和 ttRestore即可，再恢复之前定义上新的路径即可。</div>
<div style="margin-left: 40px">&nbsp;</div>
<ul>
<li><strong>和其它数据库之间的数据迁移</strong></li>
</ul>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">通过ttBulkCp导出到文本文件中，然后其它数据库通过其自身的工具将文本文件的数据导入，或者反之。如果对端是Oracle数据库的话，额外的一种途径是Cache Group，但除非Cache Group中的数据只是在TimesTen是只读的，否则不建议通过这种方式来在Oracle和TimesTen之间做数据迁移。因为如果Cache Agent不关的话，会对性能有影响；如果把Cache Agent关掉的话，如果有修改的事物的话，又会有日志的累积。</div>
<div>&nbsp;</div>
<div>要注意的是，如果涉及到不同的平台或者不同的版本之间的数据迁移，所用的工具只是用当时当地的工具。比如说从32位的平台上迁移到64位的平台上，那么导出的工具是32位平台上的ttMigrate，导入的工具是用64位的ttMigrate。</div>
<div>&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/data-migrate.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen 11g 新特性</title>
		<link>http://www.ttisql.com/news/timesten-11g-newfeature.html</link>
		<comments>http://www.ttisql.com/news/timesten-11g-newfeature.html#comments</comments>
		<pubDate>Sat, 06 Jun 2009 07:15:05 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[基 本 概 念]]></category>

		<category><![CDATA[最 新 动 态]]></category>

		<category><![CDATA[新特性 11g]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=470</guid>
		<description><![CDATA[&#160;
TimesTen新的版本叫11g了，呵呵，可能是为了和Oracle的其它产品版本号一致的原因。从介绍来看，变化还是很大的，据说从功能以及性能上都有比较大的提升，性能方面在后面的具体试验帖子中再来介绍，从功能上来说，主要变化如下：
&#160;


PL/SQL的支持


OCI以及Pro*C的支持


Cache Grid（在Cache Group这一块实现了类似集群的功能）


和Oracle Clusterware的整合，可以自动检测异常并切换


实现Client端的异常切换（类似与TAF）


支持Oracle DataGuard


多个并发的Log Buffer支持（性能在有些机型上可能有很大的提升）


在replication的表中，支持不同的表定义（因为表字段不一样而需要升级的人有福了）


replication的传输通道扩大到2个，未来可能还会扩大（传输的性能应该会好一些）


物化视图支持异步刷新


用户基于DataStore了，而不是Instance级了。唯一的 Instance 级用户是安装用户


Object的粒度更细了，只是隶属与某个User了，和Oracle一致


Delete Insert Update支持 returning into 子句


DDL 缺省直接 Commit了，和 Oracle 一致


子句中支持set语法


支持 RowID 类型


LogBufMB 替掉了原来的 LogBuffSize （实在是容易弄混，现在都统一为 M 了）


可以监控内存中的SQL语句以及PL/SQL等


ttMigrate的并行支持


Bitmap索引支持，XLA的提升以及replication XLA的支持等


安装介质中带有 Oracle Instant Client


除了上面列出来的一些大的变化外，还有其它的零零碎碎的一些改变。也有一些属性，语法，命令在新版本中被替代或者丢弃了。不过总体感觉是很好很强大。:-)
&#160;
]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<p>TimesTen新的版本叫11g了，呵呵，可能是为了和Oracle的其它产品版本号一致的原因。从介绍来看，变化还是很大的，据说从功能以及性能上都有比较大的提升，性能方面在后面的具体试验帖子中再来介绍，从功能上来说，主要变化如下：</p>
<div>&nbsp;</div>
<ol>
<li>
<p><u><span style="font-family: 宋体">PL/SQL的支持</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">OCI以及Pro*C的支持</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">Cache Grid（在Cache Group这一块实现了类似集群的功能）</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">和Oracle Clusterware的整合，可以自动检测异常并切换</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">实现Client端的异常切换（类似与TAF）</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">支持Oracle DataGuard</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">多个并发的Log Buffer支持（性能在有些机型上可能有很大的提升）</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">在replication的表中，支持不同的表定义（因为表字段不一样而需要升级的人有福了）</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">replication的传输通道扩大到2个，未来可能还会扩大（传输的性能应该会好一些）</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">物化视图支持异步刷新</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">用户基于DataStore了，而不是Instance级了。唯一的 Instance 级用户是安装用户</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">Object的粒度更细了，只是隶属与某个User了，和Oracle一致</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">Delete Insert Update支持 returning into 子句</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">DDL 缺省直接 Commit了，和 Oracle 一致</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">子句中支持set语法</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">支持 RowID 类型</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">LogBufMB 替掉了原来的 LogBuffSize （实在是容易弄混，现在都统一为 M 了）</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">可以监控内存中的SQL语句以及PL/SQL等</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">ttMigrate的并行支持</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">Bitmap索引支持，XLA的提升以及replication XLA的支持等</span></u></p>
</li>
<li>
<p><u><span style="font-family: 宋体">安装介质中带有 Oracle Instant Client</span></u></p>
</li>
</ol>
<p>除了上面列出来的一些大的变化外，还有其它的零零碎碎的一些改变。也有一些属性，语法，命令在新版本中被替代或者丢弃了。不过总体感觉是很好很强大。:-)</p>
<div>&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/news/timesten-11g-newfeature.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen 对信号量的消耗</title>
		<link>http://www.ttisql.com/faq/timesten-semaphore.html</link>
		<comments>http://www.ttisql.com/faq/timesten-semaphore.html#comments</comments>
		<pubDate>Wed, 03 Jun 2009 06:36:41 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[semaphore 信号量]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=478</guid>
		<description><![CDATA[
TimesTen和其它的数据库产品一样，对信号量也有其具体的需求，但不同的平台上稍有差异。针对信号量总的消耗，在TimesTen的安装文档中描述如下：
Semaphores
TimesTen consumes 1 SEMMNI per active data store, plus 1 additional SEMMNI per TimesTen instance where Client/Server communication is done through shared memory. For each active data store, TimesTen consumes 100 SEMMSL if the Connections attribute is set to the default value, and one additional SEMMSL for each connection above the default.
也就是说 TimesTen 每个活动的 DataStore [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>TimesTen和其它的数据库产品一样，对信号量也有其具体的需求，但不同的平台上稍有差异。针对信号量总的消耗，在TimesTen的安装文档中描述如下：</p>
<h4 class="sect3">Semaphores</h4>
<p><a id="sthref73" name="sthref73"></a>TimesTen consumes 1 SEMMNI per active data store, plus 1 additional SEMMNI per TimesTen instance where Client/Server communication is done through shared memory. For each active data store, TimesTen consumes 100 SEMMSL if the Connections attribute is set to the default value, and one additional SEMMSL for each connection above the default.</p>
<p>也就是说 TimesTen 每个活动的 DataStore 消耗 1 SEMMIN，另外如果该Instance中Client/Server是通过share memory方式通讯的，则每个这种Instance再额外消耗 1 SEMMIN。每个活动的 DataStore 消耗 100 SEMMSL (在Connections是缺省值64的情况下)，超出64个以外的Connection，每个消耗 1 SEMMSL.</p>
<p>不同的平台信号量的值设置有些差异，比如在Linux平台上，建议设置为：</p>
<pre class="oac_no_warn" xml:space="preserve">
kernel.sem = 250 32000 128 100
</pre>
<p>在Solaris平台上，则为：</p>
<p>set semsys:seminfo_semmni = 20<br />
set semsys:seminfo_semmsl = 512<br />
set semsys:seminfo_semmns = 2000<br />
set semsys:seminfo_semmnu = 2000<br />
&nbsp;</p>
<p>在HP-UX平台上，只是提到：</p>
<p>On <a id="sthref79" name="sthref79"></a>HP-UX systems, to connect to more than 2 data stores simultaneously, you must increase the value of the kernel parameter semmns.</p>
<p>所以一般上也不用怎么修改。</p>
<p>Aix 平台上不用动，缺省值就够了。</p>
<p>具体可以参考installation.pdf 中关于安装之前的要求一章。</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/timesten-semaphore.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>几种数据类型的选择</title>
		<link>http://www.ttisql.com/faq/%e5%87%a0%e7%a7%8d%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e7%9a%84%e9%80%89%e6%8b%a9.html</link>
		<comments>http://www.ttisql.com/faq/%e5%87%a0%e7%a7%8d%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e7%9a%84%e9%80%89%e6%8b%a9.html#comments</comments>
		<pubDate>Tue, 28 Apr 2009 06:11:59 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[数据类型]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=467</guid>
		<description><![CDATA[&#160;
虽然TimesTen在数据类型上和Oracle数据库基本兼容，但由于毕竟是两个不同的产品，在TimesTen中存在着一些自己独有的数据类型，比如以 TT_ 开头的一些数据类型，如TT_TINYINT，TT_DATE等。拿TT_INTEGER来说，可以在TT中定义为TT_INTEGER，也可以定义为INT，还可以定义为Number(*)，这几种定义方式可能都适合具体的需求，那么哪一种才是最好的选择呢？
&#160;
在TimesTen中，独有的数据类型且区别比较大的有如下几种以及相对应的oracle数据类型：
&#160;



TimesTen类型
所占空间[Byte]
对应的Oracle类型
所占空间[Byte]


TT_TINYINT
1
INT
38


TT_SMALLINT
2
INT
38


TT_INT[EGER]
4
INT
38


TT_BIGINT
8
INT
38


NUMBER
5~22
NUMBER
5~22



&#160;
上面几种单独列出来的原因是，以TT_开头的几种数据类型比传统的Oracle数据类型空间上更紧凑，性能上更好。所以如果可能的话，从空间，以及性能上考虑，建议选择以TT_开头的上述几种类型。但要注意选择好对应的TT_类型，而不要因为选择不当导致长度不够，从而引起数据的丢失。比如说，如果原来的表中某个字段定义为Number(15)，那么对应过来，只能选择TT_BIGINT。
&#160;
但对其它的，比如TT_DATE，TT_TIMESTAMP，TT_TIMESTAMP，TT_DECIMAL，TT_NVARCHAR，TT_VARCHAR，TT_CHAR等则无所谓，定义为TimesTen的或者Oracle的都可以。
]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>虽然TimesTen在数据类型上和Oracle数据库基本兼容，但由于毕竟是两个不同的产品，在TimesTen中存在着一些自己独有的数据类型，比如以 TT_ 开头的一些数据类型，如TT_TINYINT，TT_DATE等。拿TT_INTEGER来说，可以在TT中定义为TT_INTEGER，也可以定义为INT，还可以定义为Number(*)，这几种定义方式可能都适合具体的需求，那么哪一种才是最好的选择呢？</div>
<div>&nbsp;</div>
<div>在TimesTen中，独有的数据类型且区别比较大的有如下几种以及相对应的oracle数据类型：</div>
<div>&nbsp;</div>
<table cellspacing="1" cellpadding="1" width="600" border="1">
<tbody>
<tr>
<td>TimesTen类型</td>
<td>所占空间[Byte]</td>
<td>对应的Oracle类型</td>
<td>所占空间[Byte]</td>
</tr>
<tr>
<td>TT_TINYINT</td>
<td>1</td>
<td>INT</td>
<td>38</td>
</tr>
<tr>
<td>TT_SMALLINT</td>
<td>2</td>
<td>INT</td>
<td>38</td>
</tr>
<tr>
<td>TT_INT[EGER]</td>
<td>4</td>
<td>INT</td>
<td>38</td>
</tr>
<tr>
<td>TT_BIGINT</td>
<td>8</td>
<td>INT</td>
<td>38</td>
</tr>
<tr>
<td>NUMBER</td>
<td>5~22</td>
<td>NUMBER</td>
<td>5~22</td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>上面几种单独列出来的原因是，以TT_开头的几种数据类型比传统的Oracle数据类型空间上更紧凑，性能上更好。所以如果可能的话，从空间，以及性能上考虑，建议选择以TT_开头的上述几种类型。但要注意选择好对应的TT_类型，而不要因为选择不当导致长度不够，从而引起数据的丢失。比如说，如果原来的表中某个字段定义为Number(15)，那么对应过来，只能选择TT_BIGINT。</div>
<div>&nbsp;</div>
<div>但对其它的，比如TT_DATE，TT_TIMESTAMP，TT_TIMESTAMP，TT_DECIMAL，TT_NVARCHAR，TT_VARCHAR，TT_CHAR等则无所谓，定义为TimesTen的或者Oracle的都可以。</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/%e5%87%a0%e7%a7%8d%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e7%9a%84%e9%80%89%e6%8b%a9.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>varchar2在TimesTen中占用的空间</title>
		<link>http://www.ttisql.com/faq/varchar2.html</link>
		<comments>http://www.ttisql.com/faq/varchar2.html#comments</comments>
		<pubDate>Tue, 28 Apr 2009 04:06:45 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[varchar2]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=463</guid>
		<description><![CDATA[大家都知道varchar2是不定长的，所以存储数据的时候对磁盘数据库来说是根据具体的数据来存储的，但是在TimesTen中，有些不一样，这种差别主要是由于存储的方式不一样导致的。
&#160;
在TimesTen中，varchar2定义的时候，可以定义为inline，也可以定义为not inline，所谓的inline就是空间的分配和普通的int，char等类型一样，都是放在表所在的连续空间中，当varchar2的长度小于等于128字节时缺省是inline。而not inline则是放在一个另开的空间，比如堆中，当varchar2的长度大于128字节时，缺省是not inline。
&#160;
在TimesTen中，明确定义了两种模式下的空间消耗：
&#160;
&#160;



VARCHAR2 (n
            [BYTE&#124;CHAR])

For NOT INLINE columns:
            &#160;&#160;&#160;&#160;&#160; On 32-bit platforms, length of value + 20 bytes (minimum of 28 bytes).
           [...]]]></description>
			<content:encoded><![CDATA[<div>大家都知道varchar2是不定长的，所以存储数据的时候对磁盘数据库来说是根据具体的数据来存储的，但是在TimesTen中，有些不一样，这种差别主要是由于存储的方式不一样导致的。</div>
<div>&nbsp;</div>
<div>在TimesTen中，varchar2定义的时候，可以定义为inline，也可以定义为not inline，所谓的inline就是空间的分配和普通的int，char等类型一样，都是放在表所在的连续空间中，当varchar2的长度小于等于128字节时缺省是inline。而not inline则是放在一个另开的空间，比如堆中，当varchar2的长度大于128字节时，缺省是not inline。</div>
<div>&nbsp;</div>
<div>在TimesTen中，明确定义了两种模式下的空间消耗：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table cellspacing="1" cellpadding="1" width="500" align="center" border="1">
<tbody>
<tr>
<td>VARCHAR2 (n<br />
            [BYTE|CHAR])</td>
<td>
<div>For NOT INLINE columns:<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On 32-bit platforms, length of value + 20 bytes (minimum of 28 bytes).<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On 64-bit platforms, length of value + 24 bytes (minimum of 40 bytes).<br />
            &nbsp;</div>
<div>
            For INLINE columns:<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On 32-bit platforms, n + 4 bytes.<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On 64-bit platforms, n + 8 bytes.</p>
<p>            If character semantics, the length of the column (n) is based on length semantics and character set.</p></div>
</td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>从中可以看出，如果是inline模式，则占用的空间是固定的，即长度+4/8。</div>
<div>&nbsp;</div>
<div>试验如下：</div>
<div>&nbsp;</div>
<div><span style="background-color: #9999ff">Command&gt; create table test ( a varchar2(50));</p>
<p>Command&gt; desc test;</span></div>
<div><span style="background-color: #9999ff">Table TEST.TEST:<br />
&nbsp; Columns:<br />
&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VARCHAR2 (50) </span><span style="color: #ff0000"><strong><u><span style="background-color: #9999ff">INLINE</span></u></strong></span></div>
<div><span style="background-color: #9999ff">1 table found.<br />
(primary key columns are indicated with *)<br />
</span><br />
然后通过ttsize验证：</div>
<div>&nbsp;</div>
<div><span style="background-color: #9999ff">[tt705@west-mountain ~]$ ttsize -tbl test -rows 1000 -frac 0.3 ttcore</span></div>
<div><span style="background-color: #9999ff">Rows = 1000</span></div>
<div><span style="background-color: #9999ff">Total in-line row bytes = </span><span style="color: #ff0000"><u><strong><span style="background-color: #9999ff">77786</span></strong></u></span></div>
<div><span style="background-color: #9999ff">Total = 77786</p>
<p>[tt705@west-mountain ~]$ ttsize -tbl test -rows 1000 -frac 0.4 ttcore</span></div>
<div><span style="background-color: #9999ff">Rows = 1000</span></div>
<div><span style="background-color: #9999ff">Total in-line row bytes = </span><span style="color: #ff0000"><u><strong><span style="background-color: #9999ff">77786</span></strong></u></span></div>
<div><span style="background-color: #9999ff">Total = 77786</p>
<p>[tt705@west-mountain ~]$ ttsize -tbl test -rows 1000 -frac 0.5 ttcore</span></div>
<div><span style="background-color: #9999ff">Rows = 1000</span></div>
<div><span style="background-color: #9999ff">Total in-line row bytes = </span><span style="color: #ff0000"><u><strong><span style="background-color: #9999ff">77786</span></strong></u></span></div>
<div><span style="background-color: #9999ff">Total = 77786<br />
</span>&nbsp;</div>
<div>可以看出，不管frac如何变化，所占用的空间都是一样的。</div>
<div>&nbsp;</div>
<div>但如果我们将varchar2显式定义为 not inline 呢：</div>
<div>&nbsp;</div>
<div><span style="background-color: #9999ff">Command&gt; create table test11 ( a varchar2(50) not inline);<br />
Command&gt; desc test11;</span></div>
<div><span style="background-color: #9999ff">Table TEST.TEST11:<br />
&nbsp; Columns:<br />
&nbsp;&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VARCHAR2 (50) NOT INLINE</span></div>
<div><span style="background-color: #9999ff">1 table found.<br />
(primary key columns are indicated with *)</span></div>
<div>&nbsp;</div>
<div>再通过ttsize验证，发现空间就会随着frac的变化而变化了：</div>
<div>&nbsp;</div>
<div><span style="background-color: #9999ff">[tt705@west-mountain ~]$ ttsize -tbl test11 -rows 1000 -frac 0.3 ttcore</span></div>
<div><span style="background-color: #9999ff">Rows = 1000</span></div>
<div><span style="background-color: #9999ff">Total in-line row bytes = 24538</span></div>
<div><span style="background-color: #9999ff">Out-of-line columns:<br />
&nbsp; Column A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total&nbsp;&nbsp;&nbsp; 36000&nbsp;&nbsp;&nbsp; avg size&nbsp;&nbsp;&nbsp;&nbsp; 14<br />
&nbsp; Total out-of-line column bytes = </span><span style="color: #ff0000"><u><strong><span style="background-color: #9999ff">36000</span></strong></u></span></div>
<div><span style="background-color: #9999ff">Total = 60538</span></div>
<div><span style="background-color: #9999ff">&nbsp;</span></div>
<div><span style="background-color: #9999ff">[tt705@west-mountain ~]$ ttsize -tbl test11 -rows 1000 -frac 0.4 ttcore</span></div>
<div><span style="background-color: #9999ff">Rows = 1000</span></div>
<div><span style="background-color: #9999ff">Total in-line row bytes = 24538</span></div>
<div><span style="background-color: #9999ff">Out-of-line columns:<br />
&nbsp; Column A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total&nbsp;&nbsp;&nbsp; 40000&nbsp;&nbsp;&nbsp; avg size&nbsp;&nbsp;&nbsp;&nbsp; 20<br />
&nbsp; Total out-of-line column bytes = </span><span style="color: #ff0000"><u><strong><span style="background-color: #9999ff">40000</span></strong></u></span></div>
<div><span style="background-color: #9999ff">Total = 64538<br />
&nbsp;</span></div>
<div><span style="background-color: #9999ff">[tt705@west-mountain ~]$ ttsize -tbl test11 -rows 1000 -frac 0.5 ttcore</span></div>
<div><span style="background-color: #9999ff">Rows = 1000</span></div>
<div><span style="background-color: #9999ff">Total in-line row bytes = 24538</span></div>
<div><span style="background-color: #9999ff">Out-of-line columns:<br />
&nbsp; Column A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total&nbsp;&nbsp;&nbsp; 44000&nbsp;&nbsp;&nbsp; avg size&nbsp;&nbsp;&nbsp;&nbsp; 25<br />
&nbsp; Total out-of-line column bytes = </span><span style="color: #ff0000"><u><strong><span style="background-color: #9999ff">44000</span></strong></u></span></div>
<div><span style="background-color: #9999ff">Total = 68538<br />
[tt705@west-mountain ~]$</span></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/varchar2.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>LogFlushMethod说明</title>
		<link>http://www.ttisql.com/faq/logflushmethod.html</link>
		<comments>http://www.ttisql.com/faq/logflushmethod.html#comments</comments>
		<pubDate>Mon, 16 Feb 2009 06:26:08 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[LogFlushMethod]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=459</guid>
		<description><![CDATA[在TimesTen的属性定义中，有一项属性是LogFlushMethod，有三个值0，1，2。
&#160;
LogFlushMethod
0&#8212; Write data to the log files using the previously used value.
1&#8212; Write data to log files using buffered writes and use explicit sync operations as needed to sync log data to disk (for example with durable commits). This is the default.
2&#8212;Write data to log files using synchronous writes such that explicit sync operations are [...]]]></description>
			<content:encoded><![CDATA[<div>在TimesTen的属性定义中，有一项属性是LogFlushMethod，有三个值0，1，2。</div>
<div>&nbsp;</div>
<div><u><strong>LogFlushMethod</strong></u></div>
<div style="margin-left: 40px">0&mdash; Write data to the log files using the previously used value.<br />
1&mdash; Write data to log files using buffered writes and use explicit sync operations as needed to sync log data to disk (for example with durable commits). This is the default.<br />
2&mdash;Write data to log files using synchronous writes such that explicit sync operations are not needed.</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>其缺省值是1，可选有2 和 0（同以前的设置）。那么1和2之间到底有什么不同呢？</div>
<div>&nbsp;</div>
<div>LogFlushMethod=1意味着以常规的模式打开LogFile，写的时候也就是普通的write()，当需要同步的时候，比如调用durablecommit，此时才在write()之后紧接着调用fdatasync()。</div>
<div>&nbsp;</div>
<div>LogFlushMethod=2意味着以O_SYNC的方式打开LogFile，所有的写操作都是同步的，且都包含在write()里面了。</div>
<div>&nbsp;</div>
<div>两种模式的选择取决与操作系统、存储硬件以及系统的压力等各方面的因素。一般来说，当存储不是很好，且只有少量durable commits的时候，LogFlushMethod=1性能更好。</div>
<div>&nbsp;</div>
<div>当存储很好（尤其是同步写性能），比如RAID；且包含大量的durable commits的时候，LogFlushMethod=2性能更好。</div>
<div>&nbsp;</div>
<div>上面只是一个初步的参考，具体的环境做对比验证才是正确决定的基础。</div>
<div>&nbsp;</div>
<div>参考连接：</div>
<div>&nbsp;</div>
<div><a href="http://archives.postgresql.org/pgsql-performance/2004-09/msg00080.php">http://archives.postgresql.org/pgsql-performance/2004-09/msg00080.php</a></div>
<div>&nbsp;</div>
<div><a href="http://blog.chinaunix.net/u2/72383/showart_1353626.html">http://blog.chinaunix.net/u2/72383/showart_1353626.html</a></div>
<div>&nbsp;</div>
<div><a href="http://book.csdn.net/bookfiles/418/10041815076.shtml">http://book.csdn.net/bookfiles/418/10041815076.shtml</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/logflushmethod.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen 初学者学习路线图</title>
		<link>http://www.ttisql.com/faq/timesten-start.html</link>
		<comments>http://www.ttisql.com/faq/timesten-start.html#comments</comments>
		<pubDate>Sat, 27 Dec 2008 11:21:24 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=397</guid>
		<description><![CDATA[



&#160;


&#160;


&#160;


&#160;




&#160;


&#160;


&#160;


&#160;




安装介质下载


安装介质下载


TimesTen简介
&#160;


标准文档




安装


安装


TimesTen卸载


存储过程大全




创建数据源


启动和关闭


TimesTen特性


命令大全




初步使用


创建数据源


基本概念


DSN属性大全




C/S配置



C/S配置



DataStore介绍


系统变量




CacheConnect


CacheConnect


用户级别


系统上限阀值




&#160;


复制配置


锁机制


&#160;




&#160;


复制异常恢复


数据持久性


&#160;




&#160;


&#160;


索引


&#160;




&#160;


&#160;


如有疑惑&#8230;


&#160;




]]></description>
			<content:encoded><![CDATA[<table bordercolor="#ffffff" height="850" width="690" align="left" background="http://www.ttisql.com/images/tt-steps.jpg" border="0">
<tbody>
<tr>
<td align="center" width="122" height="94">
<div align="center">&nbsp;</div>
</td>
<td align="center" width="206">
<div align="center">&nbsp;</div>
</td>
<td align="center" width="206">
<div align="center">&nbsp;</div>
</td>
<td align="center" width="128">
<div align="center">&nbsp;</div>
</td>
</tr>
<tr>
<td align="center" height="88">
<div align="center">&nbsp;</div>
</td>
<td align="center">
<div align="center">&nbsp;</div>
</td>
<td align="center">
<div align="center">&nbsp;</div>
</td>
<td align="center">
<div align="center">&nbsp;</div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="58">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/download/ttdownload.html">安装介质下载</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/download/ttdownload.html">安装介质下载</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/ttgeneral.html">TimesTen简介</a></div>
<div class="style-tt" align="center">&nbsp;</div>
</td>
<td align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/download/standarddoc.html">标准文档</a></div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="65">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/download/install-on-windows.html">安装</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/download/ttinstall-linux-x86-32.html">安装</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/download/ttuninstall.html">TimesTen卸载</a></div>
</td>
<td align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/ttref/procedures.html">存储过程大全</a></div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="65">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/faq/tt-windows-usage-1.html">创建数据源</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/tthowtouse-1.html">启动和关闭</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/faq/whyfast.html">TimesTen特性</a></div>
</td>
<td align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/ttref/ttisqlcommand.html">命令大全</a></div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="56">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/faq/tt-windows-usage-2.html">初步使用</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/tthowtouse-2.html">创建数据源</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/concepts.html">基本概念</a></div>
</td>
<td align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/ttref/ttattributes.html">DSN属性大全</a></div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="57">
<p class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/faq/tt-windows-usage-3.html">C/S配置</a></p>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center">
<p><a target="_blank" href="http://www.ttisql.com/faq/clientserver.html">C/S配置</a></p>
</p></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/datastore.html">DataStore介绍</a></div>
</td>
<td align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/ttref/ttsysvarible.html">系统变量</a></div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="78">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/faq/tt-windows-usage-4.html">CacheConnect</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/tthowtouse-3.html">CacheConnect</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/timesten-user.html">用户级别</a></div>
</td>
<td align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/ttref/ttsystemlimit.html">系统上限阀值</a></div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="59">
<div align="center">&nbsp;</div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/replication/pair-disaster-recovery-1.html">复制配置</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/ttlock.html">锁机制</a></div>
</td>
<td align="center">
<div align="center">&nbsp;</div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="76">
<div align="center">&nbsp;</div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/replication/pair-disaster-restore-1.html">复制异常恢复</a></div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/data-persistence.html">数据持久性</a></div>
</td>
<td align="center">
<div align="center">&nbsp;</div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="57">
<div align="center">&nbsp;</div>
</td>
<td valign="middle" align="center">
<div align="center">&nbsp;</div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a target="_blank" href="http://www.ttisql.com/architecture/ttindex.html">索引</a></div>
</td>
<td align="center">
<div align="center">&nbsp;</div>
</td>
</tr>
<tr valign="middle" align="center">
<td valign="middle" align="center" height="51">
<div align="center">&nbsp;</div>
</td>
<td valign="middle" align="center">
<div align="center">&nbsp;</div>
</td>
<td valign="middle" align="center">
<div class="style-tt" align="center"><a href="http://www.ttisql.com/forum/forum/timesten">如有疑惑&#8230;</a></div>
</td>
<td align="center">
<div align="center">&nbsp;</div>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/timesten-start.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen的各种端口</title>
		<link>http://www.ttisql.com/faq/timesten-ports.html</link>
		<comments>http://www.ttisql.com/faq/timesten-ports.html#comments</comments>
		<pubDate>Thu, 25 Dec 2008 06:24:30 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[port number]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=395</guid>
		<description><![CDATA[&#160;
在TimesTen的安装以及使用过程中，会碰到各种各样的端口，比如主守护进程的监听端口，服务进程的监听端口，webserver的监听端口等等。那么这些端口如何去确定呢？
&#160;
缺省的情况下，TimesTen 7.0 会按照如下的方式去预定端口号：
&#160;
&#160;
&#160;



&#160;
32位平台
64位平台


主守护进程
17000
17001


Server
17002
17003


Web Server
17004
17005



&#160;
&#160;
安装的时候，如果你选择的主守护进程监听端口号不是17000，比如说这个端口号被占了，你选择了17100为端口号，则Server 以及 WebServer&#160; 都会按照17100来确定自己的端口号，分别为 17102，17104 或者 17103，17105。
&#160;
也可以通过如下方式来确定目前使用的端口号是哪些，方法之一是ttstatus：
&#160;
D:\&#62;ttstatus
TimesTen status report as of Thu Dec 25 14:08:20 2008
Daemon pid 364 port 17000 instance tt70_32
TimesTen server pid 3904 started on port 17002
TimesTen webserver pid 2304 started on port 17004
&#160;
方法之二是通过配置文件来查看：
&#160;
主守护进程:
$ cat /etc/TimesTen/instance_info
&#160;
Server :
$ cat $TIMESTEN_HOME/info/sys.ttconnect.ini
&#160;
3) Web Server:
$ cat $TIMESTEN_HOME/info/webserver.config

&#160;
除此之外，还有定义Replication的时候，定义两端Agent监听的端口号，比如：
&#160;
Create replication &#8230;&#8230;
Store DSN_Name on Host_Name Port Port_Number
&#8230;&#8230;
&#160;
这时候可以不用定义端口号，让TimesTen自己自动分配，但我觉得还是人为指定的好。创建完之后如何查看端口号呢？
&#160;
通过 [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>在TimesTen的安装以及使用过程中，会碰到各种各样的端口，比如主守护进程的监听端口，服务进程的监听端口，webserver的监听端口等等。那么这些端口如何去确定呢？</div>
<div>&nbsp;</div>
<div>缺省的情况下，TimesTen 7.0 会按照如下的方式去预定端口号：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table cellspacing="1" cellpadding="1" width="200" align="center" border="1">
<tbody>
<tr>
<td>&nbsp;</td>
<td>32位平台</td>
<td>64位平台</td>
</tr>
<tr>
<td>主守护进程</td>
<td>17000</td>
<td>17001</td>
</tr>
<tr>
<td>Server</td>
<td>17002</td>
<td>17003</td>
</tr>
<tr>
<td>Web Server</td>
<td>17004</td>
<td>17005</td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>安装的时候，如果你选择的主守护进程监听端口号不是17000，比如说这个端口号被占了，你选择了17100为端口号，则Server 以及 WebServer&nbsp; 都会按照17100来确定自己的端口号，分别为 17102，17104 或者 17103，17105。</div>
<div>&nbsp;</div>
<div>也可以通过如下方式来确定目前使用的端口号是哪些，方法之一是ttstatus：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:\&gt;ttstatus<br />
TimesTen status report as of Thu Dec 25 14:08:20 2008</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Daemon pid 364 port <span style="color: #ff0000"><strong>17000 </strong></span>instance tt70_32<br />
TimesTen server pid 3904 started on port <span style="color: #ff0000"><strong>17002</strong></span><br />
TimesTen webserver pid 2304 started on port </span><span style="color: #ff0000"><strong><span style="background-color: #9999ff">17004</span></strong></span></div>
<div>&nbsp;</div>
<div>方法之二是通过配置文件来查看：</div>
<div>&nbsp;</div>
<div>主守护进程:</div>
<div>$ cat /etc/TimesTen/instance_info</div>
<div>&nbsp;</div>
<div>Server :</div>
<div>$ cat $TIMESTEN_HOME/info/sys.ttconnect.ini</div>
<div>&nbsp;</div>
<div>3) Web Server:</div>
<div>$ cat $TIMESTEN_HOME/info/webserver.config</div>
<div>
&nbsp;</div>
<div>除此之外，还有定义Replication的时候，定义两端Agent监听的端口号，比如：</div>
<div>&nbsp;</div>
<div>Create replication &#8230;&#8230;</div>
<div>Store DSN_Name on Host_Name Port Port_Number</div>
<div>&#8230;&#8230;</div>
<div>&nbsp;</div>
<div>这时候可以不用定义端口号，让TimesTen自己自动分配，但我觉得还是人为指定的好。创建完之后如何查看端口号呢？</div>
<div>&nbsp;</div>
<div>通过 repschemes查看 ：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Command&gt; repschemes;</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Replication Scheme Active Standby:</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp; Master Store: DSA on WEST-MOUNTAIN<br />
&nbsp; Master Store: DSB on WEST-MOUNTAIN<br />
&nbsp; Master Return Service: Return Receipt</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff"><br />
&nbsp; Excluded Tables:<br />
&nbsp;&nbsp;&nbsp; None</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp; Excluded Cache Groups:<br />
&nbsp;&nbsp;&nbsp; None</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp; Excluded sequences:<br />
&nbsp;&nbsp;&nbsp; None</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp; Store: DSA on WEST-MOUNTAIN<br />
&nbsp;&nbsp;&nbsp; Port: <span style="color: #ff0000"><strong>20000</strong></span><br />
&nbsp;&nbsp;&nbsp; Log Fail Threshold: 5<br />
&nbsp;&nbsp;&nbsp; Retry Timeout: 5 seconds<br />
&nbsp;&nbsp;&nbsp; Compress Traffic: Disabled<br />
&nbsp;&nbsp;&nbsp; Return Service Wait Time: 10 seconds<br />
&nbsp;&nbsp;&nbsp; Return Service on Replication Stop: Disabled<br />
&nbsp;&nbsp;&nbsp; Return Service Failure Policy: (none)</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp; Store: DSB on WEST-MOUNTAIN<br />
&nbsp;&nbsp;&nbsp; Port: <span style="color: #ff0000"><strong>22000</strong></span><br />
&nbsp;&nbsp;&nbsp; Log Fail Threshold: 5<br />
&nbsp;&nbsp;&nbsp; Retry Timeout: 5 seconds<br />
&nbsp;&nbsp;&nbsp; Compress Traffic: Disabled<br />
&nbsp;&nbsp;&nbsp; Return Service Wait Time: 10 seconds<br />
&nbsp;&nbsp;&nbsp; Return Service on Replication Stop: Disabled<br />
&nbsp;&nbsp;&nbsp; Return Service Failure Policy: (none)</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">1 replication scheme found.<br />
Command&gt; </span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div>或者通过ttRepAdmin -showstatus &lt;DSN&gt; 查看，但此时必须启动Replication Agent：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">[tt705@west-mountain ~]$ ttRepAdmin -showstatus dsa</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Replication Agent Status as of: 2008-12-20 17:41:22</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">DSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : dsa<br />
Process ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 4586 (Started)<br />
Replication Agent Policy&nbsp;&nbsp;&nbsp; : manual<br />
Host&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : WEST-MOUNTAIN<br />
RepListener Port&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : <span style="color: #ff0000"><strong>20000 </strong></span><br />
Last write LSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 63.1728920<br />
Last LSN forced to disk&nbsp;&nbsp;&nbsp;&nbsp; : 63.1728920<br />
Replication hold LSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 63.1725672</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Replication Peers:<br />
&nbsp;&nbsp; Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : DSB<br />
&nbsp;&nbsp; Host&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : WEST-MOUNTAIN<br />
&nbsp;&nbsp; Port&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0&nbsp; (Not Connected)<br />
&nbsp;&nbsp; Replication State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : STARTED<br />
&nbsp;&nbsp; Communication Protocol&nbsp;&nbsp; : 24</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">TRANSMITTER thread(s):<br />
&nbsp;For&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : DSB<br />
&nbsp;&nbsp; Start/Restart count&nbsp;&nbsp; : 1<br />
&nbsp;&nbsp; Send LSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 63.1725672<br />
&nbsp;&nbsp; Transactions sent&nbsp;&nbsp;&nbsp;&nbsp; : 0<br />
&nbsp;&nbsp; Total packets sent&nbsp;&nbsp;&nbsp; : 0<br />
&nbsp;&nbsp; Tick packets sent&nbsp;&nbsp;&nbsp;&nbsp; : 0<br />
&nbsp;&nbsp; Total Packets received: 0</span></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/timesten-ports.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>缓冲区的大小和数据持久化的关系</title>
		<link>http://www.ttisql.com/faq/logbuff-persistence.html</link>
		<comments>http://www.ttisql.com/faq/logbuff-persistence.html#comments</comments>
		<pubDate>Thu, 25 Dec 2008 03:58:18 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[durablecommits logbuffsize]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=391</guid>
		<description><![CDATA[&#160;
在标准文档replication.pdf中，有一段讲了缓冲区的大小和数据持久性之间的关系，现摘录翻译如下：
&#160;
关于日志缓冲去的大小和数据的持久化
&#160;
一个普通的误解就是日志缓冲区的大小和可能丢失的事务之间存在着某种关系，实际上日志缓冲区的大小不会对数据的持久化有影响。
&#160;
当DSN配置为DurableCommits=0的时候，事务在如下情况下被永久化写入磁盘：
&#160;
Log Buffer 满的时候
&#160;
当显式调用ttDurableCommit 或者连接中的事务配置成DurableCommits=1的时候
&#160;
当Replication Agent发送一包数据，且Replication被配置成Transmit Durable的时候
&#160;
当Replication Agent定时执行Durable Commit的时候
&#160;
当DSN配置有LogFlushMethod=2，且在控制返回给应用之前，写入已经完成。
&#160;
所以综上所述，在上述的环境下，日志缓冲区的大小对数据的持久化没有冲击。个人理解是在DurableCommits=1的情况下，没什么好说的，每次提交都是同步到磁盘，所以数据的持久化上最好，但性能很差。在DurableCommits=0的情况下，只要牵涉到其中隐藏有DurableCommits=1的情形，即可导致数据的持久化。所以在此之前的数据也就不用担心事务丢失了。
&#160;
但如果不在上述情况下，发生断电或者其它异常，且DurableCommits=0时，肯定还是存在一定的时间窗口会导致事务的丢失的，但个人觉得和缓冲区的大小也没什么关系，按照TimesTen的架构，异步写入磁盘的过程是能做多快就做多快的，所以即使丢失，也只是丢失最后一部分没有被写入的事务。如果要做到高性能且数据零丢失的话，就只能用Replication了。单节点理论上总是存在着限制。
&#160;
&#160;
&#160;
&#160;
原文如下：
&#160;
A common misconception among TimesTen users is that there is a relationship between the size of the log buffer and lost transactions. The size of the log buffer has no impact on persistence.
If your DSN is configured with DurableCommits=0, then transactions are written durably to disk only under [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>在标准文档replication.pdf中，有一段讲了缓冲区的大小和数据持久性之间的关系，现摘录翻译如下：</div>
<div>&nbsp;</div>
<div>关于日志缓冲去的大小和数据的持久化</div>
<div>&nbsp;</div>
<div>一个普通的误解就是日志缓冲区的大小和可能丢失的事务之间存在着某种关系，实际上日志缓冲区的大小不会对数据的持久化有影响。</div>
<div>&nbsp;</div>
<div>当DSN配置为DurableCommits=0的时候，事务在如下情况下被永久化写入磁盘：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px">Log Buffer 满的时候</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">当显式调用ttDurableCommit 或者连接中的事务配置成DurableCommits=1的时候</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">当Replication Agent发送一包数据，且Replication被配置成Transmit Durable的时候</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">当Replication Agent定时执行Durable Commit的时候</div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px">当DSN配置有LogFlushMethod=2，且在控制返回给应用之前，写入已经完成。</div>
<div>&nbsp;</div>
<div>所以综上所述，在上述的环境下，日志缓冲区的大小对数据的持久化没有冲击。个人理解是在DurableCommits=1的情况下，没什么好说的，每次提交都是同步到磁盘，所以数据的持久化上最好，但性能很差。在DurableCommits=0的情况下，只要牵涉到其中隐藏有DurableCommits=1的情形，即可导致数据的持久化。所以在此之前的数据也就不用担心事务丢失了。</div>
<div>&nbsp;</div>
<div>但如果不在上述情况下，发生断电或者其它异常，且DurableCommits=0时，肯定还是存在一定的时间窗口会导致事务的丢失的，但个人觉得和缓冲区的大小也没什么关系，按照TimesTen的架构，异步写入磁盘的过程是能做多快就做多快的，所以即使丢失，也只是丢失最后一部分没有被写入的事务。如果要做到高性能且数据零丢失的话，就只能用Replication了。单节点理论上总是存在着限制。</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>原文如下：</div>
<div>&nbsp;</div>
<div>A common misconception among TimesTen users is that there is a relationship between the size of the log buffer and lost transactions. The size of the log buffer has no impact on persistence.<br />
If your DSN is configured with DurableCommits=0, then transactions are written durably to disk only under the following circumstances:</div>
<div style="margin-left: 40px">
When the log buffer fills up.<br />
When a ttDurableCommit is called or when a transaction on a connection with DurableCommits=1 is committed or rolled back.<br />
When the replication agent sends a batch of transactions to a subscriber and the master has been configured for replication with the TRANSMIT DURABLE attribute (the default). <br />
When the replication agent periodically executes a durable commit, whether the primary store is configured with TRANSMIT DURABLE or not.<br />
When your DSN is configured with LogFlushMethod=2, writes are written to disk before control is returned to the application.<br />
&nbsp;</div>
<div>The size of the log buffer has no influence on the ability of TimesTen to write data to disk under any of the circumstances listed above.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/logbuff-persistence.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen for Windows 使用指南(4) Cache Connect</title>
		<link>http://www.ttisql.com/faq/tt-windows-usage-4.html</link>
		<comments>http://www.ttisql.com/faq/tt-windows-usage-4.html#comments</comments>
		<pubDate>Wed, 24 Dec 2008 15:31:18 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=388</guid>
		<description><![CDATA[&#160;
下面介绍在Windows平台上，TimesTen如何通过Cache Connect访问Oracle。如果试验的时候，Oracle是和TimesTen在同一台机子上，则不用过多的配置。如果Oracle和TimesTen不在同一台机子上，则必须安装Oracle的客户端程序，目前TimesTen支持的Oracle客户端如下：
&#160;
Oracle 10g Release 2 (Oracle 10.2.0.1.0 or above)
Oracle 10g Release 1 (Oracle 10.1.0.5.0 or above)
Oracle 9i Release 2 (Oracle 9.2.0.8.0 or above)
&#160;
不管通过哪种Oracle模式，首先必须启动Oracle数据库以及listener。
&#160;
D:\&#62;oradim -startup -sid orcl -syspwd welcome
D:\&#62;lsnrctl
&#160;
并能成功地通过和TimesTen在同一台服务器上的SqlPlus来成功访问Oracle，才算Oracle配置好。
&#160;
由于Cache Connect访问Oracle的时候，必须有一个用户在TimesTen和Oracle中是一样的，通过这个用户登录TimesTen之后，然后Cache Connect的底层通过这个用户去和Oracle通讯，来进行数据的两边同步。在前面我们已经创建了用户tt，那么现在在oracle中，我们也创建同样的用户tt，并授予相应的Oracle权限。
&#160;
sqlplus / as sysdba
SQL&#62; CREATE USER tt IDENTIFIED BY tt;
SQL&#62; GRANT connect, resource, create any trigger TO testuser;
SQL&#62; COMMIT;
SQL&#62; EXIT
&#160;
现在到控制面板&#8211;&#62;ODBC数据源管理&#8211;&#62;系统DSN&#8211;&#62;test，双击之后，点击General Connection页，在User Id这一栏填上tt，如下：
&#160;
&#160;







&#160;
&#160;
然后再点击Cache Connect页，看到Oracle User ID已经填上了tt，且不能被修改了，这是因为这个用户名必须和TimesTen中的一样。在Oracle ID一栏填上Oracle的Service [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>下面介绍在Windows平台上，TimesTen如何通过Cache Connect访问Oracle。如果试验的时候，Oracle是和TimesTen在同一台机子上，则不用过多的配置。如果Oracle和TimesTen不在同一台机子上，则必须安装Oracle的客户端程序，目前TimesTen支持的Oracle客户端如下：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Oracle 10g Release 2 (Oracle 10.2.0.1.0 or above)<br />
Oracle 10g Release 1 (Oracle 10.1.0.5.0 or above)<br />
Oracle 9i Release 2 (Oracle 9.2.0.8.0 or above)</span></div>
<div>&nbsp;</div>
<div>不管通过哪种Oracle模式，首先必须启动Oracle数据库以及listener。</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:\&gt;oradim -startup -sid orcl -syspwd welcome</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:\&gt;lsnrctl</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div>并能成功地通过和TimesTen在同一台服务器上的SqlPlus来成功访问Oracle，才算Oracle配置好。</div>
<div>&nbsp;</div>
<div>由于Cache Connect访问Oracle的时候，必须有一个用户在TimesTen和Oracle中是一样的，通过这个用户登录TimesTen之后，然后Cache Connect的底层通过这个用户去和Oracle通讯，来进行数据的两边同步。在前面我们已经创建了用户tt，那么现在在oracle中，我们也创建同样的用户tt，并授予相应的Oracle权限。</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">sqlplus / as sysdba</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">SQL&gt; CREATE USER tt IDENTIFIED BY tt;<br />
SQL&gt; GRANT connect, resource, create any trigger TO testuser;<br />
SQL&gt; COMMIT;<br />
SQL&gt; EXIT</span></div>
<div>&nbsp;</div>
<div>现在到控制面板&#8211;&gt;ODBC数据源管理&#8211;&gt;系统DSN&#8211;&gt;test，双击之后，点击General Connection页，在User Id这一栏填上tt，如下：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="384" cellspacing="1" cellpadding="1" width="509" align="center" border="0">
<tbody>
<tr>
<td><img alt="" src="http://www.ttisql.com/images/win-usage-10.jpg" /></td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>然后再点击Cache Connect页，看到Oracle User ID已经填上了tt，且不能被修改了，这是因为这个用户名必须和TimesTen中的一样。在Oracle ID一栏填上Oracle的Service Name，在Oracle Password一栏填上对应的密码。如下图所示：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="386" cellspacing="1" cellpadding="1" width="510" align="center" border="0">
<tbody>
<tr>
<td><img alt="" src="http://www.ttisql.com/images/win-usage-11.jpg" /></td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>点击确定即可。现在用tt用户登录Oracle数据库，并创建测试用的表。</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">SQL&gt; connect </span><a href="mailto:tt/tt@orcl"><span style="background-color: #9999ff">tt/tt@orcl</span></a><span style="background-color: #9999ff"><br />
已连接。<br />
SQL&gt; create table test(a int primary key, b char(10));</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">表已创建。</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">SQL&gt; insert into test values(1,&#8217;aaa&#8217;);</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">已创建 1 行。</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">SQL&gt; insert into test values(2,&#8217;bbb&#8217;);</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">已创建 1 行。</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">SQL&gt; commit;</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">提交完成。</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">SQL&gt;</span></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>用ttisql登录到test数据源，设置好cacheuidpwd，启动cache agent，并创建只读的cache group，如下：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:\&gt;ttisql test</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Copyright (c) 1996-2008, Oracle.&nbsp; All rights reserved.<br />
Type ? or &quot;help&quot; for help, type &quot;exit&quot; to quit ttIsql.<br />
All commands must end with a semicolon character.</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">connect &quot;DSN=test&quot;;<br />
Enter password for &#8216;tt&#8217;:<br />
Connection successful: DSN=test;UID=tt;DataStore=C:\TimesTen\ds\test;DatabaseCha<br />
racterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=C:\TimesTen\tt70_32\bi<br />
n\ttdv70.dll;OracleId=orcl;TypeMode=0;<br />
(Default setting AutoCommit=1)<br />
Command&gt; call ttcacheuidpwdset(&#8217;tt&#8217;,'tt&#8217;);<br />
Command&gt; call ttcachestart;<br />
Command&gt; create readonly cache group read<br />
&gt;&nbsp; autorefresh interval 5 seconds<br />
&gt;&nbsp; from test<br />
&gt; (a int primary key, b char(10));<br />
Command&gt;</span></div>
<div>&nbsp;</div>
<div>这里要说明的是，如果前面创建test的时候的字符集和Oracle数据库中的字符集不一样的话，就会报错而不能登录。这时候要统一两者的字符集，为方便起见，修改test数据源的字符集。首先必须destroy掉test数据源（通过控制台命令ttdestroy test完成），因为字符集是在数据源创建的时候起作用的，所以只能destroy掉，然后在ODBC数据源管理中修改test数据源的字符集，使得它和Oracle的一样，然后执行上面的步骤即可。</div>
<div>&nbsp;</div>
<div>创建完之后可以通过cachegroups命令检查一下，并通过load加载初始化数据：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Command&gt; cachegroups ;</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Cache Group TT.READ:</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp; Cache Group Type: Read Only<br />
&nbsp; Autorefresh: Yes<br />
&nbsp; Autorefresh Mode: Incremental<br />
&nbsp; Autorefresh State: Paused<br />
&nbsp; Autorefresh Interval: 5 Seconds</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp; Root Table: TT.TEST<br />
&nbsp; Table Type: Read Only</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">1 cache group found.</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff"><br />
Command&gt; load cache group read commit every 10 rows;<br />
2 cache instances affected.<br />
Command&gt; select * from test;<br />
&lt; 1, aaa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;<br />
&lt; 2, bbb&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;<br />
2 rows found.<br />
Command&gt;</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div>此后，在Oracle数据库中插入到test表的数据，5秒钟之后都会被刷新到TimesTen中来，Cache Connect正常运转了。通过ttstatus命令可以看到cache agent已经启动：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:\&gt;ttstatus&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cache<br />
TimesTen status report as of Wed Dec 24 23:28:50 2008&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
Daemon pid 284 port 17000 instance tt70_32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
TimesTen server pid 3284 started on port 17002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
TimesTen webserver pid 3360 started on port 17004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; <br />
Data store c:\timesten\ds\test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
There are 11 connections to the data store&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
Data store is in shared mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
Shared Memory KEY Global\test.SHM.2 HANDLE 0&#215;248&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PID&nbsp;&nbsp;&nbsp;&nbsp; Context&nbsp;&nbsp;&nbsp;&nbsp; Connection Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ConnID&nbsp; <br />
<span style="color: #ff0000"><strong>Cache Agent&nbsp;&nbsp;&nbsp;&nbsp; 3396&nbsp;&nbsp;&nbsp; 0&#215;00b5d310&nbsp; Handler&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; <br />
Cache Agent&nbsp;&nbsp;&nbsp;&nbsp; 3396&nbsp;&nbsp;&nbsp; 0&#215;00bccf18&nbsp; Timer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; <br />
Cache Agent&nbsp;&nbsp;&nbsp;&nbsp; 3396&nbsp;&nbsp;&nbsp; 0&#215;06591ce0&nbsp; Aging&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp; <br />
Cache Agent&nbsp;&nbsp;&nbsp;&nbsp; 3396&nbsp;&nbsp;&nbsp; 0&#215;06601260&nbsp; ttora70&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5&nbsp; <br />
Cache Agent&nbsp;&nbsp;&nbsp;&nbsp; 3396&nbsp;&nbsp;&nbsp; 0&#215;06662fb8&nbsp; ttora70&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6&nbsp; <br />
</strong></span>Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;006cc398&nbsp; Worker&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2042&nbsp; <br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;066d1170&nbsp; Flusher&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2043&nbsp; <br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;06700628&nbsp; Checkpoint&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2044&nbsp; <br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;0674f8b0&nbsp; Aging&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2045&nbsp; <br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;0679eb38&nbsp; HistGC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2046&nbsp; <br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;067eded0&nbsp; Monitor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2047&nbsp; <br />
Replication policy&nbsp; : Manual&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
Cache agent policy&nbsp; : Manual&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
<span style="color: #ff0000"><strong>TimesTen&#8217;s Cache agent is running for this data store&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong></span><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; <br />
Access control enabled.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
End of report&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
D:\&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>&nbsp;</div>
<div>而且还多了一堆辅助的子线程。</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/tt-windows-usage-4.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen for Windows 使用指南(3) 远程客户端配置</title>
		<link>http://www.ttisql.com/faq/tt-windows-usage-3.html</link>
		<comments>http://www.ttisql.com/faq/tt-windows-usage-3.html#comments</comments>
		<pubDate>Wed, 24 Dec 2008 13:43:43 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[client server 配置]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=382</guid>
		<description><![CDATA[&#160;
有的时候需要Client/Server模式的连接方式，那么针对前面的test 数据源，如果把它作为Server端的话，如何配置Client端呢？
&#160;
和Oracle数据库类似，如果要配置TimesTen的客户端，必须首先安装包含有TimesTen客户端的软件，当然如果你选择的是完全安装的话，就已经包含了客户端的。现在我们在同一台机子上模拟Client/Server模式的连接。
&#160;
前面安装TimesTen的时候，我们已经选择了完全安装，现在我们直接创建Client端的数据源，这个Client端的数据源是一个逻辑的概念，它会指向客户端的数据源。
&#160;
在控制面板&#8211;&#62;ODBC数据源管理&#8211;&#62;系统DSN&#8211;&#62;添加，这时候不象前面创建数据源的时候选择TimesTen Data Manager 7.0，而是选择TimesTen Client 7.0。如下：
&#160;
&#160;









&#160;
&#160;
点击完成。在弹出的Oracle TimesTen Client DSN Setup窗口中点击右边的Servers&#8230;按钮，弹出Oracle TimesTen Logic Server List窗口，现在还是空白的，点击Add&#8230;按钮，弹出如下的界面：
&#160;
&#160;







&#160;
&#160;
这里面的Server Name是你想给你的服务器端的机子起一个什么样的名字，比如说我们这里命名为west。Description可不填，是针对服务器端的一个说明。Network则比较重要了，填你服务器端的IP地址，我们因为是在同一台机子上，所以可填上 127.0.0.1，端口号怎么确定呢？一般来说，32位平台上缺省的是17002，我们也可以通过如下控制台命令去确认：
&#160;
D:&#62;ttdaemonadmin -start
TimesTen Data Manager 7.0 服务正在启动 .
TimesTen Data Manager 7.0 服务已经启动成功。

D:&#62;ttstatus
TimesTen status report as of Wed Dec 24 21:05:19 2008
Daemon pid 284 port 17000 instance tt70_32
TimesTen server pid 3284 started on port 17002
TimesTen webserver pid 3360 started on port [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>有的时候需要Client/Server模式的连接方式，那么针对前面的test 数据源，如果把它作为Server端的话，如何配置Client端呢？</div>
<div>&nbsp;</div>
<div>和Oracle数据库类似，如果要配置TimesTen的客户端，必须首先安装包含有TimesTen客户端的软件，当然如果你选择的是完全安装的话，就已经包含了客户端的。现在我们在同一台机子上模拟Client/Server模式的连接。</div>
<div>&nbsp;</div>
<div>前面安装TimesTen的时候，我们已经选择了完全安装，现在我们直接创建Client端的数据源，这个Client端的数据源是一个逻辑的概念，它会指向客户端的数据源。</div>
<div>&nbsp;</div>
<div>在控制面板&#8211;&gt;ODBC数据源管理&#8211;&gt;系统DSN&#8211;&gt;添加，这时候不象前面创建数据源的时候选择TimesTen Data Manager 7.0，而是选择TimesTen Client 7.0。如下：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="341" cellspacing="1" cellpadding="1" width="470" align="center" border="0">
<tbody>
<tr>
<td>
<div><img alt="" src="http://www.ttisql.com/images/win-usage-5.jpg" /></div>
</td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>点击完成。在弹出的Oracle TimesTen Client DSN Setup窗口中点击右边的Servers&#8230;按钮，弹出Oracle TimesTen Logic Server List窗口，现在还是空白的，点击Add&#8230;按钮，弹出如下的界面：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="378" cellspacing="1" cellpadding="1" width="470" align="center" border="0">
<tbody>
<tr>
<td><img alt="" src="http://www.ttisql.com/images/win-usage-6.jpg" /></td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>这里面的Server Name是你想给你的服务器端的机子起一个什么样的名字，比如说我们这里命名为west。Description可不填，是针对服务器端的一个说明。Network则比较重要了，填你服务器端的IP地址，我们因为是在同一台机子上，所以可填上 127.0.0.1，端口号怎么确定呢？一般来说，32位平台上缺省的是17002，我们也可以通过如下控制台命令去确认：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:&gt;ttdaemonadmin -start<br />
TimesTen Data Manager 7.0 服务正在启动 .<br />
TimesTen Data Manager 7.0 服务已经启动成功。</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff"><br />
</span><span style="background-color: #9999ff">D:&gt;ttstatus<br />
TimesTen status report as of Wed Dec 24 21:05:19 2008</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Daemon pid 284 port 17000 instance tt70_32<br />
TimesTen server pid 3284 started on port 17002<br />
TimesTen webserver pid 3360 started on port 17004</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Data store c:timestendstest<br />
There are no connections to the data store<br />
Replication policy&nbsp; : Manual<br />
Cache agent policy&nbsp; : Manual<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Access control enabled.<br />
End of report</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:&gt;</span><br />
&nbsp;</div>
<div>&nbsp;</div>
<div>这里可以看到 TimesTen server pid 3284 started on port 17002。则确定端口号确实是17002。所以最终填的信息如下图：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="374" cellspacing="1" cellpadding="1" width="469" align="center" border="0">
<tbody>
<tr>
<td>&nbsp;<img alt="" src="http://www.ttisql.com/images/win-usage-7.jpg" /></td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>然后点击OK，会看到Oracle TimesTen Logic Server List多了一个Logic Server 叫west，然后点击Close。回到如下的界面，在Server Name or Network下拉式列表框中看到有west选择，点击紧贴着的下面refresh按钮，如果服务器端的IP地址，端口号，以及服务器端的TimesTen Daemon已经起来的话，将会列出所有服务器端的数据源。如下所示：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="378" cellspacing="1" cellpadding="1" width="466" align="center" border="0">
<tbody>
<tr>
<td><img alt="" src="http://www.ttisql.com/images/win-usage-8.jpg" /></td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>看到其中有我们前面创建的test数据源，选择它。在Client DSN一栏填上你想为客户端数据源的命名；Description可不填，只是一个说明；User ID 填上我们前面已经创建好的用户tt，密码也为tt。在点击OK之前，还可以点击最下面的两个大按钮，&quot;Test Oracle TimesTen Server Connection&quot; 以及 &quot;Test Data Source Connection&quot; ，应该可以看到成功的提示。所以这个弹出窗口填的信息如下：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="375" cellspacing="1" cellpadding="1" width="471" align="center" border="0">
<tbody>
<tr>
<td><img alt="" src="http://www.ttisql.com/images/win-usage-9.jpg" /></td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>点击OK之后可以看到系统DSN定义中多了一个test_client的新数据源。这时候可以通过ttisql去连接一下试试：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">C:TimesTentt70_32bin&gt;ttisql test_client</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Copyright (c) 1996-2008, Oracle.&nbsp; All rights reserved.<br />
Type ? or &quot;help&quot; for help, type &quot;exit&quot; to quit ttIsql.<br />
All commands must end with a semicolon character.</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">connect &quot;DSN=test_client&quot;;<br />
Connection successful: DSN=test_client;TTC_SERVER=west;TTC_SERVER_DSN=test;UID=t<br />
t;DATASTORE=C:TimesTendstest;DATABASECHARACTERSET=AL32UTF8;CONNECTIONCHARACTE<br />
RSET=US7ASCII;TYPEMODE=0;<br />
(Default setting AutoCommit=1)<br />
Command&gt;</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div>可以看到反馈的信息有TTC_SERVER和TTC_SERVER_DSN。再次通过ttstatus可以看到不一样的信息：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:&gt;ttstatus<br />
TimesTen status report as of Wed Dec 24 21:39:15 2008</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Daemon pid 284 port 17000 instance tt70_32<br />
TimesTen server pid 3284 started on port 17002<br />
TimesTen webserver pid 3360 started on port 17004</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Data store c:timestendstest<br />
There are 7 connections to the data store<br />
Data store is in shared mode<br />
Shared Memory KEY Globaltest.SHM.2 HANDLE 0&#215;1f8<br />
Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PID&nbsp;&nbsp;&nbsp;&nbsp; Context&nbsp;&nbsp;&nbsp;&nbsp; Connection Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Conn<br />
<span style="color: #ff0000"><strong>Server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2852&nbsp;&nbsp;&nbsp; 0&#215;0092db50&nbsp; test_client<br />
&nbsp;&nbsp;&nbsp; (Client Information: pid: 2160; IPC: TCP/IP;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Node: west(127.0.0.1))<br />
</strong></span>Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;006cc398&nbsp; Worker&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;06661d20&nbsp; Flusher&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;066d1218&nbsp; Checkpoint&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;067204a0&nbsp; Aging&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;0676f728&nbsp; HistGC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3120&nbsp;&nbsp;&nbsp; 0&#215;067be9b0&nbsp; Monitor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20<br />
Replication policy&nbsp; : Manual<br />
Cache agent policy&nbsp; : Manual<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Access control enabled.<br />
End of report</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:&gt;</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div>至此，windows上的客户端服务器模式配置完成。要注意的是，在UNIX平台上，只能通过ttisqlcs去连接客户端的数据源，而不是和windows平台一样通过ttisql。</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/tt-windows-usage-3.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen for Windows 使用指南(2)</title>
		<link>http://www.ttisql.com/faq/tt-windows-usage-2.html</link>
		<comments>http://www.ttisql.com/faq/tt-windows-usage-2.html#comments</comments>
		<pubDate>Tue, 23 Dec 2008 06:30:22 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<category><![CDATA[使用]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=337</guid>
		<description><![CDATA[&#160;
针对刚创建的test数据源，现在可以直接通过ttisql访问了。
&#160;
启动一个Windows命令行控制台：
&#160;
D:\&#62;ttisql test
Copyright (c) 1996-2008, Oracle.&#160; All rights reserved.
Type ? or &#34;help&#34; for help, type &#34;exit&#34; to quit ttIsql.
All commands must end with a semicolon character.
&#160;
connect &#34;DSN=test&#34;;
Connection successful: DSN=test;UID=canoe;DataStore=C:\TimesTen\ds\test;Database
CharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER=C:\TimesTen\tt70_32
\bin\ttdv70.dll;TypeMode=0;
(Default setting AutoCommit=1)
Command&#62;
&#160;
可以看到连接到test之后，有些相应的反馈信息。比如UID=canoe，因为我们现在没有创建TimesTen的内部用户，所以缺省地使用安装TimesTen时候的操作系统用户，该用户就相当于TimesTen的DBA用户，类似于Oracle的sys用户。另外还可以看到放置DataStore的目录，进入这个目录下查看，发现已有如下的文件存在：
&#160;
&#160;C:\TimesTen\ds 的目录
2008-12-23&#160; 13:54&#160;&#160;&#160; &#60;DIR&#62;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .
2008-12-23&#160; 13:54&#160;&#160;&#160; &#60;DIR&#62;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ..
2008-12-23&#160; 13:54&#160;&#160;&#160;&#160;&#160;&#160;&#160; 11,782,364 test.ds0
2008-12-23&#160; 13:54&#160;&#160;&#160;&#160;&#160;&#160;&#160; 11,782,364 test.ds1
2008-12-23&#160; 13:54&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 524,288 test.log0
2008-12-23&#160; 13:54&#160;&#160;&#160;&#160;&#160;&#160;&#160; 67,108,864 test.res0
2008-12-23&#160; 13:54&#160;&#160;&#160;&#160;&#160;&#160;&#160; 67,108,864 test.res1
2008-12-23&#160; 13:54&#160;&#160;&#160;&#160;&#160;&#160;&#160; 67,108,864 test.res2
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>针对刚创建的test数据源，现在可以直接通过ttisql访问了。</div>
<div>&nbsp;</div>
<div>启动一个Windows命令行控制台：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">D:\&gt;ttisql test</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Copyright (c) 1996-2008, Oracle.&nbsp; All rights reserved.<br />
Type ? or &quot;help&quot; for help, type &quot;exit&quot; to quit ttIsql.<br />
All commands must end with a semicolon character.</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp;</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">connect &quot;DSN=test&quot;;<br />
Connection successful: DSN=test;UID=canoe;DataStore=C:\TimesTen\ds\test;Database<br />
CharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER=C:\TimesTen\tt70_32<br />
\bin\ttdv70.dll;TypeMode=0;<br />
(Default setting AutoCommit=1)<br />
Command&gt;</span></div>
<div>&nbsp;</div>
<div>可以看到连接到test之后，有些相应的反馈信息。比如UID=canoe，因为我们现在没有创建TimesTen的内部用户，所以缺省地使用安装TimesTen时候的操作系统用户，该用户就相当于TimesTen的DBA用户，类似于Oracle的sys用户。另外还可以看到放置DataStore的目录，进入这个目录下查看，发现已有如下的文件存在：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&nbsp;C:\TimesTen\ds 的目录</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">2008-12-23&nbsp; 13:54&nbsp;&nbsp;&nbsp; &lt;DIR&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .<br />
2008-12-23&nbsp; 13:54&nbsp;&nbsp;&nbsp; &lt;DIR&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ..<br />
2008-12-23&nbsp; 13:54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11,782,364 test.ds0<br />
2008-12-23&nbsp; 13:54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11,782,364 test.ds1<br />
2008-12-23&nbsp; 13:54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 524,288 test.log0<br />
2008-12-23&nbsp; 13:54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 67,108,864 test.res0<br />
2008-12-23&nbsp; 13:54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 67,108,864 test.res1<br />
2008-12-23&nbsp; 13:54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 67,108,864 test.res2<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6 个文件&nbsp;&nbsp;&nbsp; 225,415,608 字节<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 个目录&nbsp; 2,556,182,528 可用字节</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">C:\TimesTen\ds&gt;</span></div>
<div>&nbsp;</div>
<div>有两个DataStore的文件(ds0,ds1)，这个是放真实的数据的文件，和内存中的数据想对应，是内存中数据的一个镜像。要创建两个DS文件的目的是为了安全起见，当正在写一个DS文件时，如果因为故障导致该文件被破坏，还可以从另一个文件中恢复。所以每次TimesTen写到DS文件的时候，总是写比较旧的那个。一般的情况下可能两个文件的大小稍微有点差异，当做完checkpoint的时候，两个文件可以确定是一样大的。</div>
<div>&nbsp;</div>
<div>另外还有一个日志文件(test.log0)，如果没有定义LogDir的话，缺省就和DataStore文件放在同一个目录下。日志文件名字的最后一位是阿拉伯数字，随着系统的使用，这个数字会增长。旧的日志会被自动清除。</div>
<div>&nbsp;</div>
<div>还可以看到，有三个res的文件(res0,res1,res2)，res是reserve的缩写，即储备的意思。每个和LogFileSize一样大。它们的作用是保证当某些极端的情况下，如果磁盘因为某些其它原因快被耗尽，TimesTen会从这三个文件中释放出一定的空间来保证最后的事务可以正常提交或者回滚，而不至于导致系统被hang在那。</div>
<div>&nbsp;</div>
<div>另起一个控制台，执行ttstatus命令：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">C:\TimesTen\ds&gt;ttstatus<br />
TimesTen status report as of Tue Dec 23 14:09:22 2008</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Daemon pid 3296 port 17000 instance tt70_32<br />
TimesTen server pid 1860 started on port 17002<br />
TimesTen webserver pid 3308 started on port 17004</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Data store c:\timesten\ds\test<br />
There are 7 connections to the data store<br />
Data store is in shared mode<br />
Shared Memory KEY Global\test.SHM.2 HANDLE 0&#215;240<br />
Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PID&nbsp;&nbsp;&nbsp;&nbsp; Context&nbsp;&nbsp;&nbsp;&nbsp; Connection Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ConnID<br />
Process&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2600&nbsp;&nbsp;&nbsp; 0&#215;00daada8&nbsp; test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2248&nbsp;&nbsp;&nbsp; 0&#215;006cc398&nbsp; Worker&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2042<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2248&nbsp;&nbsp;&nbsp; 0&#215;06661db0&nbsp; Flusher&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2043<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2248&nbsp;&nbsp;&nbsp; 0&#215;066c1040&nbsp; Checkpoint&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2044<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2248&nbsp;&nbsp;&nbsp; 0&#215;067102c8&nbsp; Aging&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2045<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2248&nbsp;&nbsp;&nbsp; 0&#215;0675f550&nbsp; HistGC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2046<br />
Subdaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2248&nbsp;&nbsp;&nbsp; 0&#215;067ae7d8&nbsp; Monitor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2047<br />
Replication policy&nbsp; : Manual<br />
Cache agent policy&nbsp; : Manual<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Access control enabled.<br />
End of report</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">C:\TimesTen\ds&gt;</span></div>
<div>&nbsp;</div>
<div>可以看到 DataStore c:\timesten\ds\test 已经在运行了，且有一些后台的服务线程也已经启动。 且显示了相应的TimesTen监听端口号。比如主守护进程(Daemon)的端口号是17000；Server端的监听端口号是17002，这个端口号是当Client/Server配置的时候，远程Client端连接过来时，Server端这边的服务端口号；还有WebServer的端口号17004，TimesTen自身带有一个自用的webserver的。<br />
&nbsp;</div>
<div>在后台的服务线程中（都是同一个进程号2248），worker子线程负责死锁的检测等相关任务，flusher子线程负责将日志写入磁盘，checkpoint子线程负责做checkpoint，保持数据的完整性，aging子线程负责数据的定时过期，HistGC负责垃圾回收，monitor子线程负责锁的等待相关的机制。</div>
<div>&nbsp;</div>
<div>&nbsp;现在回到ttisql test登录后的控制台界面上，创建一个新的TimesTen内部用户，要注意的是ttisql里面的命令都是以分号作为命令的结束符的：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Command&gt; create user tt identified by &#8216;tt&#8217;;<br />
Command&gt; grant all to tt;<br />
Command&gt;</span></div>
<div>&nbsp;</div>
<div>可以敲入问号(?) 查看所有在ttisql上<a target="popup" href="http://www.ttisql.com/ttref/ttisqlcommand.html"><span style="color: #3333ff"><strong>可用的命令</strong></span></a>，还可以输入procedures查看所有可用的<a target="popup" href="http://www.ttisql.com/ttref/procedures.html"><span style="color: #3333ff"><strong>内部存储过程</strong></span></a>。</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Command&gt;?</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Command&gt;procedures;</span></div>
<div>&nbsp;</div>
<div>可以查看目前系统中所有的表：</div>
<div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Command&gt;tables;</span></div>
<div>&nbsp;</div>
<div>以及创建自己的表和插入数据：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Command&gt; create table student(id int primary key,name char(20));<br />
Command&gt; insert into student values(1,&#8217;china&#8217;);<br />
1 row inserted.<br />
Command&gt; insert into student values(2,&#8217;us&#8217;);<br />
1 row inserted.<br />
Command&gt; commit;<br />
Command&gt; select * from student;<br />
&lt; 1, china&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;<br />
&lt; 2, us&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;<br />
2 rows found.<br />
Command&gt; drop table student;<br />
Command&gt;</span></div>
<div>&nbsp;</div>
<div>所有的语法基本上和Oracle类似，具体可以参考<a target="popup" href="http://www.ttisql.com/download/standarddoc.html"><span style="color: #3333ff"><strong>标准文档</strong></span></a>中的sql.pdf</div>
<div>&nbsp;</div>
</div>
<div>&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/tt-windows-usage-2.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>TimesTen for Windows 使用指南(1)</title>
		<link>http://www.ttisql.com/faq/tt-windows-usage-1.html</link>
		<comments>http://www.ttisql.com/faq/tt-windows-usage-1.html#comments</comments>
		<pubDate>Fri, 19 Dec 2008 14:51:24 +0000</pubDate>
		<dc:creator>canoe</dc:creator>
		
		<category><![CDATA[常 见 问 题]]></category>

		<guid isPermaLink="false">http://www.ttisql.com/?p=353</guid>
		<description><![CDATA[&#160;
基于前面介绍的TimesTen for Windows 安装之后，下面介绍如何登录TimesTen？如何创建数据库？如何创建表？等等相关的概念。
&#160;
在安装完之后，在开始菜单的程序里面有一项是TimesTen的，如下：
&#160;
&#160;








&#160;
其中有很多Demo可以去试试，关于Demo的说明可以参考编程索引，比较典型的一个是Throughput Benchmark Demo，试运行如下：
&#160;
Connecting to the data source
Populating benchmark data store
Beginning execution with 1 process: 80% read, 20% update, 0% insert, 0% delete
Elapsed time:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 171.0 msec
Transaction rate:&#160;&#160;&#160; 58479.5 transactions/second
&#160;
发现性能还是不错的，虽然只是在单CPU的笔记本上运行。可以通过下面的命令来查看这个Demo的参数，比如线程的个数，以及Select 、Update、Insert 和 Delete 的比例等等。
&#160;
C:\TimesTen\tt70_32\demo\PERFOR~1&#62;tptbm -help
&#160;
&#160;所有的文档也都在这里面。以及TimesTen的重要工具，ttisql，它类似于Oracle 的Sqlplus。通过它可以直接访问TimesTen，查看数据，创建表等等。
&#160;
在进行下一步之前，先创建一个TimesTen的数据库，也叫DataStore。打开Windows 的控制面板中的数据源(ODBC)，可以看到在系统DSN（DataStore Name）中已经有很多TimesTen的DSN定义了，这些DataStore是为TimesTen的Demo准备的，我们刚才运行Throughput Benchmark Demo的时候，实际上已经连接了其中的一个库。&#160;
&#160;
&#160;









&#160;

&#160;接下来，创建一个新的DataStore，名字叫 test。在控制面板的 ODBC数据源管理器中，点击添加：
&#160;
&#160;









&#160;
&#160;
有两个针对TimesTen的驱动，一个是Client，一个是Data Manager。Client的选择我们稍候具体介绍，它一般意味着TimesTen的Server端在另一台机子上。现在我们选择 TimesTen Data Manager 。点击完成。&#160;
&#160;
&#160;









&#160;
正式进入到了DSN的配置了，一共有 DataStore / FirstConnection/General Connection/NLS Connection/Cache Connect/Server 六个配置页。第一页是DataStore：
&#160;

DataSource [...]]]></description>
			<content:encoded><![CDATA[<div>&nbsp;</div>
<div>基于前面介绍的<a target="popup" href="http://www.ttisql.com/download/install-on-windows.html"><span style="color: #3333ff"><strong>TimesTen for Windows 安装</strong></span></a>之后，下面介绍如何登录TimesTen？如何创建数据库？如何创建表？等等相关的概念。</div>
<div>&nbsp;</div>
<div>在安装完之后，在开始菜单的程序里面有一项是TimesTen的，如下：<br />
&nbsp;<br />
&nbsp;</div>
<table height="208" cellspacing="1" cellpadding="1" width="536" align="center" border="0">
<tbody>
<tr>
<td><img alt="" src="http://www.ttisql.com/images/win-usage-1.jpg" /></td>
</tr>
</tbody>
</table>
<div>
&nbsp;</div>
<div>其中有很多Demo可以去试试，关于Demo的说明可以参考<a target="popup" href="http://www.ttisql.com/develope/coding-doc-index.html">编程索引</a>，比较典型的一个是Throughput Benchmark Demo，试运行如下：</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Connecting to the data source<br />
Populating benchmark data store<br />
Beginning execution with 1 process: 80% read, 20% update, 0% insert, 0% delete</span></div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">Elapsed time:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 171.0 msec<br />
Transaction rate:&nbsp;&nbsp;&nbsp; 58479.5 transactions/second</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div>发现性能还是不错的，虽然只是在单CPU的笔记本上运行。可以通过下面的命令来查看这个Demo的参数，比如线程的个数，以及Select 、Update、Insert 和 Delete 的比例等等。</div>
<div>&nbsp;</div>
<div style="margin-left: 40px"><span style="background-color: #9999ff">C:\TimesTen\tt70_32\demo\PERFOR~1&gt;tptbm -help</span></div>
<div style="margin-left: 40px">&nbsp;</div>
<div>&nbsp;所有的文档也都在这里面。以及TimesTen的重要工具，ttisql，它类似于Oracle 的Sqlplus。通过它可以直接访问TimesTen，查看数据，创建表等等。</div>
<div>&nbsp;</div>
<div>在进行下一步之前，先创建一个TimesTen的数据库，也叫DataStore。打开Windows 的控制面板中的数据源(ODBC)，可以看到在系统DSN（DataStore Name）中已经有很多TimesTen的DSN定义了，这些DataStore是为TimesTen的Demo准备的，我们刚才运行Throughput Benchmark Demo的时候，实际上已经连接了其中的一个库。&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="376" cellspacing="1" cellpadding="1" width="464" align="center" border="0">
<tbody>
<tr>
<td>
<div><img height="376" alt="" width="464" src="http://www.ttisql.com/images/win-usage-2.jpg" /></div>
</td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>
&nbsp;接下来，创建一个新的DataStore，名字叫 test。在控制面板的 ODBC数据源管理器中，点击添加：</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="341" cellspacing="1" cellpadding="1" width="469" align="center" border="0">
<tbody>
<tr>
<td>
<div><img height="341" alt="" width="469" src="http://www.ttisql.com/images/win-usage-3.jpg" /></div>
</td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>有两个针对TimesTen的驱动，一个是Client，一个是Data Manager。Client的选择我们稍候具体介绍，它一般意味着TimesTen的Server端在另一台机子上。现在我们选择 TimesTen Data Manager 。点击完成。&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<table height="387" cellspacing="1" cellpadding="1" width="508" align="center" border="0">
<tbody>
<tr>
<td>
<div><img alt="" src="http://www.ttisql.com/images/win-usage-4.jpg" /></div>
</td>
</tr>
</tbody>
</table>
<div>&nbsp;</div>
<div>正式进入到了DSN的配置了，一共有 DataStore / FirstConnection/General Connection/NLS Connection/Cache Connect/Server 六个配置页。第一页是DataStore：</div>
<div>&nbsp;</div>
<ul>
<li>DataSource Name ：数据源的名称，我们填上test；</li>
<li>Description：可填可不填，我们这里填上 &lsquo;just for testing&rsquo;，只是一个说明而已。</li>
<li>Data Store Path +：将要放置数据库的地址，外加你想命令的DataStore的名字，为了好记起见，也命名为test。要注意的是，如果通过右边的Browse选择的话，选择好目录之后，一定要文件名里面写上将要命名的DataStore的名字，否则确定不了。</li>
<li>LogDirectory：存放日志的目录，也可以不选，缺省的是和DataStore在同一个目录下。</li>
<li>DatabaseCharacter Set：数据库的字符集，如果选错的话，只能将数据库drop掉，重新创建。现在我们选择 Al32UTF8。</li>
<li>TypeMode&nbsp;：数据类型以哪个为准，Oracle还是TimesTen，这个选项出现的原因是TimesTen以前的版本和Oracle的数据类型是不一样的，为了保证数据类型的兼容而已。缺省是Oracle，一般不选，使用缺省的值。特殊情况下具体定义数据类型。</li>
<li>DataStore Attributes：确定要创建的库是否是临时的，绝大部分情况下，都不选择创建临时库。是否允许Client端的连接，缺省为选上。</li>
<li>OS Group Restrict：哪个操作系统用户组的用户有访问TimesTen的权限。</li>
</ul>
<div>&nbsp;</div>
<div>&nbsp;我们按照上图的样子填上相应的信息，定义Data Store Path +的时候，要注意相关的路进要存在，最后加上DataStore的名字。然后点击确定，会看到多了一个名字叫 test 的数据源。后面就可以通过ttisql来访问这个test数据源了。&nbsp;</div>
<div>&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ttisql.com/faq/tt-windows-usage-1.html/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
