TimesTen ODBC應(yīng)用開發(fā)ppt課件_第1頁
TimesTen ODBC應(yīng)用開發(fā)ppt課件_第2頁
TimesTen ODBC應(yīng)用開發(fā)ppt課件_第3頁
TimesTen ODBC應(yīng)用開發(fā)ppt課件_第4頁
TimesTen ODBC應(yīng)用開發(fā)ppt課件_第5頁
已閱讀5頁,還剩104頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、 2007 - Proprietary and Confidential Information of Amdocs.Security Level Classification - Sensitive TimesTen ODBC zhaojunfeng 2008-03-14 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveAgenda ODBC 程序結(jié)構(gòu) 如何使用ODBC句柄 實(shí)現(xiàn) SQL Statements 異常捕捉 性能方面考慮 其他建議

2、23 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveODBC 程序流程程序流程SQLFreeStmtSQLDisconnectSQLFreeConnectSQLFreeEnvSQLAllocEnvSQLAllocConnectSQLConnectSQLAllocStmtProcess SQL StatementsReceive ResultsCLOSE optionDROP option4 2007 - Proprietary and Con

3、fidential Information of Amdocs. Security Level Classification - SensitiveODBC 應(yīng)用的句柄應(yīng)用的句柄Environment 句柄句柄 初始化 ODBC 調(diào)用接口 ODBC 方法: SQLAllocEnv() 和 SQLFreeEnv()Connection 句柄句柄 存儲(chǔ)數(shù)據(jù)源連接信息 ODBC 方法: SQLAllocConnect() 和 SQLFreeConnect() 隱式分配一個(gè)特定的 Environment 句柄Statement 句柄句柄 存儲(chǔ)SQL statement 信息 ODBC 方法: SQLA

4、llocStmt() 和 SQLFreeStmt() 隱式分配一個(gè)特定的 Connection 句柄5 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Sensitive使用使用 ODBC 應(yīng)用句柄應(yīng)用句柄statement 句柄只能在初始階段分配一次,并在結(jié)束階段釋放. 在使用多線程編程中,statement 和 connection 句柄 應(yīng)該屬于線程結(jié)構(gòu)體內(nèi).句柄不能用于多線程并發(fā)運(yùn)行,如果想實(shí)現(xiàn)在多個(gè)線程在不同的時(shí)間訪問同一個(gè)句柄,那么應(yīng)用必須通過一些信

5、號(hào)量等方式的機(jī)制來實(shí)現(xiàn)。6 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveSQL Statement 執(zhí)行流程執(zhí)行流程SQLPrepareSQLBindParameterSQLExecuteYesInitializeTerminateIf more processingSQLFreeStmtIf repeatNoSQLTransactRepeatable Execution?SQLBindParameterSQLExecDirect7 200

6、7 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Sensitive綁定參數(shù)緩存綁定參數(shù)緩存只需要Prepare 或者編譯 SQL statements 及內(nèi)建procedures一次,然后執(zhí)行或者調(diào)用多次。盡量使用參數(shù)化statements,在運(yùn)行期使用變量方式來應(yīng)用SQL statements和內(nèi)建 procedure。一旦statement被prepared,盡快綁定參數(shù)和列變量。在程序開始的時(shí)候申明/分配一次需要用到的變量。變量屬于全局范圍的。如果使用到多線程,

7、變量申明在線程內(nèi)部。8 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Sensitive綁定參數(shù)緩存示例綁定參數(shù)緩存示例#define CHARLEN 20SQLINTEGER intBuf, nullData = SQL_NULL_DATA;SQLCHAR charBufCHARLEN;SQLFLOAT floatBuf;rc = SQLPrepare(hStmt, (SQLCHAR *) “insert into student.tab values (?

8、,?,?)”, SQL_NTS);rc = SQLBindParameter(hStmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &intBuf, sizeof(intBuf), NULL);rc = SQLBindParameter(hStmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, CHARLEN, 0, charBuf, CHARLEN, SQL_NTS);rc = SQLBindParameter(hStmt, 3, SQL_PARAM_INPUT, SQL_C_DO

9、UBLE, SQL_FLOAT, 0, 0, &floatBuf, sizeof(floatBuf), &nullData);.rc = SQLExecute(hStmt);9 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveC 和和 SQL 數(shù)據(jù)類型的綁定映射數(shù)據(jù)類型的綁定映射SQL_CHARSQL_INTEGER (unsigned)SQL_C_CHARSQL_C_TIMESQL_C_DATESQL_C_BINARYSQL_

10、C_BINARYSQL_C_BINARYSQL_C_DOUBLESQL_C_DOUBLESQL_C_FLOATSQL_C_CHARSQL_C_ULONGSQL_VARCHARSQL_LONGVARCHARSQL_DECIMALSQL_NUMERICSQL_BITSQL_TINYINT (signed)SQL_TINYINT (unsigned)SQL_SMALLINT (signed)SQL_SMALLINT (unsigned)SQL_INTEGER (signed)SQL_BIGINTSQL_REALSQL_FLOATSQL_DOUBLESQL_BINARYSQL_VARBINARYSQL

11、_LONGVARBINARYSQL_DATESQL_TIMESQL_TIMESTAMPSQL_C_CHARSQL_C_CHARSQL_C_CHARSQL_C_CHARSQL_C_BITSQL_C_STINYINTSQL_C_UTINYINTSQL_C_SSHORTSQL_C_USHORTSQL_C_SLONGSQL_C_TIMESTAMP10 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveODBC 異常捕捉異常捕捉所有 ODBC 方法都會(huì)有一

12、個(gè)返回代碼 確保程序中已經(jīng)捕捉!如果返回代碼是SQL_ERROR 或者SQL_SUCCESS_WITH_INFO,那么調(diào)用ODBC方法 SQLError() 獲取詳細(xì)信息獲取(TimesTen)本地錯(cuò)誤代碼和錯(cuò)誤信息獲取 SQLSTATE (ODBC 錯(cuò)誤代碼)#define ERRMSGLEN 255SQLUCHAR sqlstate6;SQLINTEGER native_error = 0;SQLUCHAR ErrorMsgERRMSGLEN;SQLSMALLINT cbErrorMsg;rc = SQLError(hEnv, hDbc, hStmt, sqlstate, &nat

13、ive_error,ErrorMsg, ERRMSGLEN, &cbErrorMsg);11 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Sensitive應(yīng)用性能方面考慮應(yīng)用性能方面考慮 (1/3)使用TimesTen ODBC直連方式會(huì)獲得最佳性能盡量多次執(zhí)行Prepare statements可以避免沒有必要的參數(shù)重復(fù)綁定可使用 SQLBindCol() 來代替 SQLGetData() 這樣可以減少運(yùn)行期系統(tǒng)表鎖的占用時(shí)間盡量避免數(shù)據(jù)轉(zhuǎn)換盡量

14、使用定長數(shù)據(jù)類型12 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Sensitive應(yīng)用性能方面考慮應(yīng)用性能方面考慮(2/3)盡量避免ALTER TABLE 操作 更新優(yōu)化統(tǒng)計(jì)表盡量利用你創(chuàng)建的索引盡量使用短交易來減少鎖沖突有規(guī)則的進(jìn)行checkpoint操作有規(guī)則的進(jìn)行backups操作 (如果使用增量備份,那么這個(gè)操作尤為重要)13 2007 - Proprietary and Confidential Information of Amdocs. Se

15、curity Level Classification - Sensitive其他建議其他建議檢查連接屬性配置文件 (sys.odbc.ini / .odbc.ini 文件).檢查表的所屬者owners.方法調(diào)用順序或者游標(biāo)狀態(tài)不正確往往是應(yīng)用程序不正確的信號(hào)。 游標(biāo)都和特定的statement句柄關(guān)聯(lián), (隱式和connection句柄關(guān)聯(lián)) Transactions和特定的 connection 句柄關(guān)聯(lián) 如果statements 或者 connections 是跨線程共享的,那么需要應(yīng)用來避免方法調(diào)用順序和游標(biāo)狀態(tài)錯(cuò)誤。14 2007 - Proprietary and Confiden

16、tial Information of Amdocs. Security Level Classification - Sensitive檢查點(diǎn)和日志文件檢查點(diǎn)和日志文件 Oracle TimesTen定期將數(shù)據(jù)存儲(chǔ)區(qū)和事務(wù)日志的更改寫入磁盤 如果需要恢復(fù)數(shù)據(jù)存儲(chǔ)區(qū),Oracle TimesTen將把磁盤上的數(shù)據(jù)存儲(chǔ)區(qū)檢查點(diǎn)與仍位于日志文件中的已完成事務(wù)合并在一起 檢查點(diǎn)和日志文件使用普通的磁盤文件系統(tǒng) 15 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Se

17、nsitiveReplication TimesTen to TimesTen Replication TimesTen to TimesTen是 Oracle TimesTen In-Memory Database的一個(gè)選項(xiàng),它支持服務(wù)器間的實(shí)時(shí)數(shù)據(jù)復(fù)制,以獲得高可用性和負(fù)載共享。 數(shù)據(jù)復(fù)制可以是雙機(jī)熱備份 (active-standby)或負(fù)載均衡 (active-active) 數(shù)據(jù)復(fù)制可以使用異步或同步傳輸, 數(shù)據(jù)復(fù)制可以包含沖突檢測和沖突解決以及在故障服務(wù)器恢復(fù)后自動(dòng)重新同步。16 2007 - Proprietary and Confidential Information of

18、Amdocs. Security Level Classification - Sensitive復(fù)制代理復(fù)制代理17 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveReplication 配置復(fù)制后,將為每個(gè)數(shù)據(jù)存儲(chǔ)區(qū)啟動(dòng)復(fù)制代理進(jìn)程。如果為復(fù)制而配置了同一服務(wù)器上的多個(gè)數(shù)據(jù)存儲(chǔ)區(qū),則每個(gè)數(shù)據(jù)存儲(chǔ)區(qū)將有一個(gè)單獨(dú)的復(fù)制代理 每個(gè)復(fù)制代理能夠向一個(gè)或多個(gè)用戶服務(wù)器發(fā)送更新,并從一個(gè)或多個(gè)主服務(wù)器那里接收更新 復(fù)制代理通過 TCP/IP流套接字進(jìn)

19、行通信 18 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveCache Connect to Oracle Cache Connect to Oracle 是 Oracle TimesTen In- Memory Database的一個(gè)選項(xiàng),它為位于應(yīng)用程序?qū)又械?Oracle 磁盤數(shù)據(jù)創(chuàng)建實(shí)時(shí)、可更新的高速緩存 Cache Connect to Oracle 能夠?qū)?Oracle 磁盤數(shù)據(jù)的子集加載到 TimesTen中,能夠雙向傳播更新

20、Cache Connect to Oracle 能夠使對(duì)非高速緩存數(shù)據(jù)的 SQL請(qǐng)求的透傳自動(dòng)化 Cache Connect to Oracle 能夠在故障之后自動(dòng)重新同步數(shù)據(jù)19 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveCache Connect to Oracle 高速緩存組是由一個(gè)或多個(gè)通過主鍵/外鍵關(guān)系以邏輯層次結(jié)構(gòu)排列的表的集合。高速緩存組中的每個(gè)表都與 Oracle 數(shù)據(jù)庫表相關(guān) 一個(gè)高速緩存組表可以包含相關(guān) Oracle

21、表中的所有行和列或行和列的一個(gè)子集 可以通過 SQL 語句創(chuàng)建和修改高速緩存組 20 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveCache Connect to Oracle 高速緩存組支持以下特性: 應(yīng)用程序可以對(duì)高速緩存組執(zhí)行讀取和寫入操作 可以自動(dòng)或手動(dòng)刷新高速緩存組(將 Oracle 數(shù)據(jù)庫數(shù)據(jù)置于高速緩存組中) 可以自動(dòng)或手動(dòng)清理高速緩存組(將高速緩存更新傳播到 Oracle 表) 可以自動(dòng)跟蹤對(duì) Oracle 表或高速緩存組的

22、更改 21 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Sensitive多種靈活的多種靈活的cache group A.只讀的cache group,定時(shí)把Oracle數(shù)據(jù)刷新到TimesTen里面,TimesTen里面的數(shù)據(jù)是只讀的.可以通過改變PassThrough的屬性,把對(duì)TimesTen的數(shù)據(jù)變更到Oracle里面,然后再通過Oracle刷新到TimesTen里面 B.同步的cahe group ,寫TimesTen的數(shù)據(jù)會(huì)先同步更新完Oracl

23、e數(shù)據(jù)庫然后再更新到TimesTen C.異步的cache group,直接更新到TimesTen里面,TimesTen定時(shí)通過replication agent把數(shù)據(jù)批量更新到Oracle里面。如果Oracle當(dāng)了,等Oracle起來后,TimesTen會(huì)自動(dòng)同步到Oracle上面。 D.用戶管理的cahe group ,用戶自定義刷新,加載,卸載等。22 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen對(duì)行業(yè)標(biāo)準(zhǔn)的支持對(duì)行業(yè)

24、標(biāo)準(zhǔn)的支持 支持多種操作系統(tǒng),比如Linux,AIX,Solaris,Windows,HP-Unix等32位或者64位操作系統(tǒng) 支持用戶的權(quán)限和認(rèn)證管理,支持create user,grant,revoke操作 沒有tablespace的概念,使用的DSN的概念,沒有存儲(chǔ)過程,函數(shù),嵌入式c 支持多種常用的字符集,如ZHS16GBK,UTF8,US7ASCII等23 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen對(duì)行業(yè)標(biāo)準(zhǔn)的支

25、持對(duì)行業(yè)標(biāo)準(zhǔn)的支持 支持常用的數(shù)據(jù)對(duì)象,比如table,index,view,materialized view,sequence 支持常用的數(shù)據(jù)類型,比如number,char,varchar2,date等 支持sql92標(biāo)準(zhǔn)來進(jìn)行DDL操作,比如create table,drop table,或者是改變對(duì)象屬性比如alter table 等 支持標(biāo)準(zhǔn)DML語法,如select ,insert ,update,delete,truncate24 2007 - Proprietary and Confidential Information of Amdocs. Security Level

26、Classification - SensitiveTimesten安裝安裝 (hp平臺(tái))平臺(tái)) 1. 內(nèi)核參數(shù)調(diào)整 semmns 是系統(tǒng)內(nèi)系統(tǒng)用戶可用的IPC信號(hào)總數(shù),設(shè)置為大于或者等于4096(或8192等,推薦公式SEMMNS=SEMMNU=(SEMMNI * SEMMSL) shmmax 最大的共享內(nèi)存段,以字節(jié)為單位,一般設(shè)置為內(nèi)存的實(shí)際大小 64位機(jī)上檢測目錄是否支持大文件系統(tǒng)(如果要設(shè)置DataStore大于2G,就必須設(shè)置大文件系統(tǒng)):#fsadm -F vxfs /dir_name設(shè)置大文件系統(tǒng)#/usr/sbin/fsadm -F xvfs -o largefiles /d

27、ir_name 25 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesten安裝安裝 2.目錄,用戶及組 增加組TimesTen(也可通過sam):#groupadd g 600 TimesTen 增加用戶timesten并加入到sys,TimesTen組中:#useradd -u 600 -g TimesTen -G sys d /ttinstall/TimesTen timesten 如果有Oracle安裝組的話,也可以現(xiàn)在把ti

28、mesten用戶加入到Oracle安裝組dba中,因?yàn)镃ache Group需要對(duì)Oracle目錄有訪問的權(quán)限 26 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesten安裝安裝 相關(guān)目錄:# mkdir /etc/TimesTen# chmod 775 /etc/TimesTen# chgrp R TimesTen /etc/TimesTen#chown R timesten:TimesTen /etc/TimesTen /etc

29、/TimesTen目錄用于TimesTen實(shí)例的注冊(cè) 27 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesten安裝安裝 3. FTP到需要安裝TimesTen的主機(jī)上的一個(gè)目錄,要求可用空間在500M以上,然后解包:tar xvf timesten604.hp64ipf.tar4. 解包后會(huì)在當(dāng)前目錄下生成hp64ipf/目錄,執(zhí)行該目錄下面的setup.sh命令 5.輸入Instance name6. 選擇產(chǎn)品類型 Oracle

30、 TimesTen In-Memory Database:完全的內(nèi)存數(shù)據(jù)庫,和oracle數(shù)據(jù)庫沒有關(guān)系Cache Connect to Oracle:從oracle數(shù)據(jù)庫cache數(shù)據(jù)到TimesTen內(nèi)存數(shù)據(jù)庫;也支持直接在內(nèi)存數(shù)據(jù)庫中建立實(shí)體表。28 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesten安裝安裝 7. 選擇組件 1 Client/Server and Data Manager 2 Data Manager On

31、ly 3 Client Only Client/Server 模式下的三個(gè)選擇:客戶端、服務(wù)器端、客戶端 + 服務(wù)器端 8. 選擇安裝路徑 9. 選擇TimesTen Daemon 監(jiān)聽端口,默認(rèn)為 17000 29 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesten安裝安裝 10.設(shè)置Access Control Access Control 提供了一個(gè)對(duì)TimesTen的初級(jí)的權(quán)限保護(hù)功能,它只是對(duì)誰能通過正常的途徑(比如tt

32、isql、JDBC及ODBC)訪問到相應(yīng)的Data Store做了初級(jí)的限制;并不是說,它對(duì)在操作系統(tǒng)級(jí)別上對(duì)Data Store的文件 以及 Log 文件的訪問做除了安全保障。比如 root 用戶,即使它不是TimesTen的用戶,root用戶可以做他想做的任何事情,比如刪除Data Store文件等。所以安裝的時(shí)候一定要注意,一般建議設(shè)置為 yes,Yes時(shí)才允許TimesTen創(chuàng)建新的用戶 30 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Sensit

33、iveTimesten安裝安裝 11.設(shè)置Cache Connect to Oracle 12.后面按照提示默認(rèn)安裝 31 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen 系統(tǒng)變量系統(tǒng)變量 下列為TimesTen安裝之后,可能需要設(shè)置的系統(tǒng)變量: 1. LIB、LIBPATH、LD_LIBRARY_PATH、SHLIB_PATH:指向TimesTen所用到的共享庫,即 $INSTALL_DIR/LIB 目錄;如用到Cache

34、Group,還需包含$ORACLE_HOME/LIB,不同的平臺(tái)該變量的名字各有差異: SOLARIS LD_LIBRARY_PATH AIX LIBPATH HP-UX 32Bit SHLIB_PATH HP-UX 64Bit LD_LIBRARY_PAT ( $INSTALL_DIR/LIB) SHLIB_PATH ( $ORACLE_HOME/LIB) Tru64 UNIX LD_LIBRARY_PATH32 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification -

35、 SensitiveTimesTen 系統(tǒng)變量系統(tǒng)變量 2. CLASSPATH :如用到JDK,則需要設(shè)置該變量指向相應(yīng)的Jar文件 目前支持的JDK有 JDK1.4、JDK5.0、BEA Weblogic Jrockit 5.0 3. ODBCINI :指向 .odbc.ini 配置文件。當(dāng)用戶連接TimesTen的時(shí)候,TimesTen會(huì)按照下面的順序查找相關(guān)的配置文件: 1.環(huán)境變量ODBCINI所指向的 .odbc.ini文件 2.運(yùn)行TimesTen的用戶主目錄下的 .odbc.ini 文件 3.環(huán)境變量SYSODBCINI所指向的 sys.odbc.ini文件 4./var/Ti

36、mesTen/sys.odbc.ini 5.install_dir/info/sys.odbc.ini(非root用戶才會(huì)執(zhí)行該步)33 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen 系統(tǒng)變量系統(tǒng)變量 ORACLE_HOME 指向Oracle 數(shù)據(jù)庫的安裝目錄,如果要用到Cache Group,該變量必須設(shè)置 PATH 指向TimesTen的bin 目錄,即$INSTALL_DIR/bin;如果用到Cache Group的話

37、,還要包含Oracle的bin目錄 SYSODBCINI 指向 SYS.ODBC.INI 配置文件,具體說明見 ODBCINI34 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen 系統(tǒng)變量系統(tǒng)變量 SYSTTCONNECTINI :當(dāng)用Client/Server 模式訪問TimesTen的時(shí)候,該變量指向客戶端的 sys.ttconnect.ini 配置文件。客戶端查找配置文件的順序是: 1. 環(huán)境變量SYSTTCONNECT

38、INI所指向的 sys.ttconnect.ini 配置文件。 2. /var/TimesTen/sys.ttconnect.ini 3. $INSTALL_DIR/info/sys.ttconnect.ini(非root用戶安裝) TMP/TMPDIR:指向TimesTen的臨時(shí)目錄。TimesTen的某些操作,比如ttRepAdmin duplicate 、大的刪除等會(huì)用到臨時(shí)目錄。 該參數(shù)缺省設(shè)置為:HP-UX 和AIX 是 /var/tmp;而Solaris、Linux、Tru64 UNIX 則是 /tmp35 2007 - Proprietary and Confidential I

39、nformation of Amdocs. Security Level Classification - SensitiveTimesTen 使用使用(1) - 啟動(dòng)和關(guān)閉啟動(dòng)和關(guān)閉 TimesTen 安裝完之后,缺省是已經(jīng)起來了的 啟動(dòng)TimesTen :ttdaemonadmin -start 關(guān)閉TimesTen : ttdaemonadmin stop 關(guān)閉TimesTen前,建議先斷開所有連接TimesTen的應(yīng)用,如果啟動(dòng)了Cache Agent和Replication Agent,建議也都先停掉 36 2007 - Proprietary and Confidential In

40、formation of Amdocs. Security Level Classification - SensitiveTimesTen 使用使用(1) - 啟動(dòng)和關(guān)閉啟動(dòng)和關(guān)閉 ps -ef|grep timesten /tstenv/timeten/TimesTen/tt70/bin/timestend /tstenv/timeten/TimesTen/tt70/bin/timestenws /tstenv/timeten/TimesTen/tt70/bin/timestensubd /tstenv/timeten/TimesTen/tt70/bin/timestensubd /tst

41、env/timeten/TimesTen/tt70/bin/timestensubd /tstenv/timeten/TimesTen/tt70/bin/timestensubd37 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen 使用使用(1) - 啟動(dòng)和關(guān)閉啟動(dòng)和關(guān)閉 ttstatus TimesTen status report as of Wed Dec 5 11:12:54 2007 Daemon pid 24468

42、 port 18001 instance tt70 TimesTen server pid 24474 started on port 18003 TimesTen webserver pid 24473 started on port 18005 - Data store /tstenv/timeten/TimesTen/tt70/info/IOMS There are no connections to the data store Replication policy : Manual Cache agent policy : Manual - Access control enable

43、d. End of report38 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen 使用使用(1) - 啟動(dòng)和關(guān)閉啟動(dòng)和關(guān)閉 缺省的有: TimesTen的后臺(tái)守護(hù)進(jìn)程(timestensubd) TimesTen的主守護(hù)進(jìn)程(Daemon) Client/Server中的Server守護(hù)進(jìn)程 TimesTen的一個(gè)WebServer 進(jìn)程39 2007 - Proprietary and Confidential Info

44、rmation of Amdocs. Security Level Classification - SensitiveTimesTen 使用使用(2) -增加數(shù)據(jù)庫用戶增加數(shù)據(jù)庫用戶 安裝好系統(tǒng)后,系統(tǒng)有個(gè)自帶的DSN,和access control結(jié)合起來用,一般創(chuàng)建用戶,變更密碼,授予權(quán)限等相關(guān)權(quán)限、用戶控制在這個(gè)DSN來做 對(duì)于需要權(quán)限控制,創(chuàng)建用戶等,安裝的時(shí)候要把a(bǔ)ccess control 安裝上,如果安裝的時(shí)候沒有安裝上,那么可以等安裝后執(zhí)行: ttmodinstall enableAccessControl ttmodinstall也可以重新指定監(jiān)控的port端口,重新設(shè)置環(huán)

45、境變量ORACLE_HOME 可以使用 ttmodinstall h 來查看該功能的使用40 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen 使用使用(2) -增加數(shù)據(jù)庫用戶增加數(shù)據(jù)庫用戶 TimesTen支持的創(chuàng)建后用戶的權(quán)限有下面幾種 1.Admin 2.Connect 3.create datastore 4.ddl 5.write 6.select41 2007 - Proprietary and Confidenti

46、al Information of Amdocs. Security Level Classification - SensitiveTimesTen 使用使用(2) -增加數(shù)據(jù)庫用戶增加數(shù)據(jù)庫用戶 $ttisql TT_tt70_train Command create user tt_train identified by tt_train; Command grant ddl,admin to tt_train; Command grant write to tt_train; Command grant SELECT to tt_train; Command quit 42 2007

47、- Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen 使用使用(3) - DataStore 介紹介紹 DataStore 是指TimesTen中的表、索引等放在內(nèi)存段中的一個(gè)集合,類似與Oracle中庫的概念 一個(gè)TimesTen Data Manager可以管理多個(gè)DataStore DataStore由放在相應(yīng)ODBC配置文件中的一個(gè)DSN(Data Source Name)所定義,該DSN由一個(gè)名字和相關(guān)的屬性組成,如下:名為TT_t

48、t70_train的 DataStore的定義43 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveDataStore 介紹介紹 ODBC Data Sources TT_tt70_train=TimesTen 7.0 Driver TT_tt70_train Driver=/tstenv/timeten/zjf/TimesTen/tt70_train/lib/libtten.so DataStore=/tstenv/timeten/zjf/T

49、imesTen/tt70_train/info/TT_tt70_train DatabaseCharacterSet=US7ASCII PermSize=50 TempSize=1044 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveDataStore 介紹介紹 ODBC配置文件分為兩種:系統(tǒng)級(jí)ODBC文件(可通過環(huán)境變量SYSODBCINI另行設(shè)置)和用戶級(jí)ODBC配置文件(可通過環(huán)境變量ODBCINI另行設(shè)置)。系統(tǒng)級(jí)的ODBC可以被任何

50、用戶所引用,而用戶級(jí)的只能被該用戶所引用。系統(tǒng)級(jí)的ODBC文件在Windows平臺(tái)下可以通過控制面板-ODBC數(shù)據(jù)源管理-系統(tǒng)DSN 定義;而UNIX平臺(tái)下,則一般是通過定義文件 $INSTALL_DIR/sys.odbc.ini完成45 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveDataStore 介紹介紹 當(dāng)用戶連接一個(gè)DataStore的時(shí)候,TimesTen會(huì)按照下面的順序查找配置文件: 1.環(huán)境變量ODBCINI所指的 .odb

51、c.ini文件 2.運(yùn)行TimesTen的用戶主目錄下的 .odbc.ini 文件 3.環(huán)境變量SYSODBCINI所指的 sys.odbc.ini文件 4. /var/TimesTen/sys.odbc.ini 5. $INSTALL_DIR /info/sys.odbc.ini(非root用戶才會(huì)執(zhí)行該步)$INSTALL_DIR為TimesTen的安裝目錄46 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveDataStore 介紹介紹

52、在上面的 TT_tt70_train 定義里面,有兩個(gè)重要的屬性: Driver=/tstenv/timeten/zjf/TimesTen/tt70_train/lib/libtten.so 指操作該數(shù)據(jù)源所需要的驅(qū)動(dòng) DataStore=/tstenv/timeten/zjf/TimesTen/tt70_train/info/TT_tt70_train 指的是放置Checkpoint文件的磁盤地址 TimesTen雖然運(yùn)行的時(shí)候?qū)⑺械臄?shù)據(jù)都預(yù)先裝載在內(nèi)存中,但它也有自己的數(shù)據(jù)文件、日志文件等47 2007 - Proprietary and Confidential Information

53、 of Amdocs. Security Level Classification - SensitiveDataStore 介紹介紹 數(shù)據(jù)文件叫checkpoint 文件,是TimesTen內(nèi)存中數(shù)據(jù)在磁盤上的一個(gè)鏡像,相當(dāng)于Oracle數(shù)據(jù)庫中的數(shù)據(jù)文件DBF TimesTen會(huì)在一定條件下自動(dòng)做Check point ,它會(huì)將內(nèi)存中的臟數(shù)據(jù)和磁盤上的數(shù)據(jù)文件做增量同步。 當(dāng)首次登陸到該DSN,或者TimesTen異常中止/失敗時(shí),TimesTen需要這些讀取這些文件做恢復(fù)48 2007 - Proprietary and Confidential Information of Amdoc

54、s. Security Level Classification - SensitiveDataStore 介紹介紹下面是DataStore TT_tt70_train 在磁盤上的相應(yīng)文件: $ pwd /tstenv/timeten/zjf/TimesTen/tt70_train/info $ ls -al|grep TT_tt70_train -rw-rw-rw- 1 timeten users 14785240 Dec 5 18:46 TT_tt70_train.ds0 -rw-rw-rw- 1 timeten users 14785240 Dec 5 18:38 TT_tt70_tra

55、in.ds1 -rw-rw-rw- 1 timeten users 753664 Dec 5 18:46 TT_tt70_train.log0 -rw-rw-rw- 1 timeten users 67108864 Dec 5 18:28 TT_tt70_train.res0 -rw-rw-rw- 1 timeten users 67108864 Dec 5 18:28 TT_tt70_train.res1 -rw-rw-rw- 1 timeten users 67108864 Dec 5 18:28 TT_tt70_train.res249 2007 - Proprietary and Co

56、nfidential Information of Amdocs. Security Level Classification - SensitiveDataStore 介紹介紹 針對(duì)TT_tt70_train這個(gè)DataStore,磁盤上對(duì)應(yīng)由兩個(gè)checkpoint 文件,TT_tt70_train.ds0,TT_tt70_train.ds1 一個(gè)日志文件,TT_tt70_train.log0 三個(gè)保留文件(reservation) TT_tt70_train.res0,TT_tt70_train.res1,TT_tt70_train.res250 2007 - Proprietary a

57、nd Confidential Information of Amdocs. Security Level Classification - SensitiveCheckpoint文件文件 針對(duì)Checkpoint文件,TimesTen會(huì)以DataStore屬性的最后一節(jié)為文件名,創(chuàng)建相應(yīng)的Checkpoint文件 TimesTen每次做Checkpoint的時(shí)候,會(huì)輪換著寫這兩個(gè)文件,每次都寫較舊的那個(gè),所以在某些時(shí)間段內(nèi),這兩個(gè)文件不是完全一致的。每次做Checkpoint的時(shí)候,TimesTen先在這兩個(gè)文件之間做一個(gè)同步,然后把最新的更新,寫到舊的Checkpoint文件中。 為什么不

58、同時(shí)寫入兩個(gè)文件呢? 如果同時(shí)往兩個(gè)文件寫入,而寫入過程發(fā)生異常,會(huì)導(dǎo)致兩個(gè)文件同時(shí)被損壞,帶來災(zāi)難性的后果51 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveTimesTen如何創(chuàng)建日志文件和保留文件呢如何創(chuàng)建日志文件和保留文件呢? 在ODBC配置文件里面,通過屬性 LogDir 來定義日志文件,沒有顯式設(shè)置LogDir時(shí),日志文件將和Checkpoint文件位于同一目錄下,且以DataStore屬性中定義的目錄的最后一節(jié)為文件名,后綴中按

59、數(shù)字序列遞增命名,例如TT_tt70_train.log0,TT_tt70_train.log1。等。 具體定義了LogDir后,日志文件將位于該目錄下,且以該屬性值所指向的目錄的最后一節(jié)為文件名,例如:52 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - SensitiveCheckpoint文件文件 LogDir=/tstenv/timeten/zjf/TimesTen/tt70_train/log 此時(shí),TimesTen將在目錄 /tstenv/timet

60、en/zjf/TimesTen/tt70_train/log 下創(chuàng)建名為TT_tt70_traincache的日志和保留文件 日志文件會(huì)和保留文件始終位于同一個(gè)目錄下 強(qiáng)烈建議將日志文件和Checkpoint文件分開放在不同磁盤上,且處于不同的磁盤控制器下,以盡量減少磁盤IO的影響53 2007 - Proprietary and Confidential Information of Amdocs. Security Level Classification - Sensitive保留文件保留文件 保留文件始終和日志文件位于同一目錄下,它的大小由屬性Log定義。缺省的Log是64M 當(dāng)由于某些原因?qū)е挛募到y(tǒng)沒有空余的磁盤空間

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論