理解TimesTen記憶體資料庫DBI檔案的作用以及相關故障處理

tangyunoracle發表於2015-01-21


     DBI(DataBase Information)的作用是記錄TimesTen例項的DSN註冊資訊,在Daemon程式啟動時會讀取該註冊資訊,顯示DSN的元件啟動策略。我們在實際運維過程中,基本沒有人會關心DBI檔案的存在,甚至有一些童鞋做了一兩年的TimesTen運維,都不知道有這麼一個檔案存在。但是,我們在實際故障處理中,如果需要用到該檔案進行處理時,都是比較嚴重的故障,而且TimesTen一般承載的業務都是比較核心的,分分鐘都會直接影響客戶的感知度;在我看的點中,也有不少地方出現過,每次客戶打電話給我的時候都是非常的緊張,群友也有問到過,這裡根據各種不同的情況總結說明。

1.      主機異常重啟,Checkpoint檔案目錄沒有掛載

所有關於這種型別的故障基本上都屬於這種情況,由於考慮到I/O問題,我們經常都會在系統規劃階段,將Checkpoint檔案系統和TransLog檔案系統與軟體安裝目錄分開,採用外部的儲存來存放Checkpoint檔案和TransLog檔案;但是由於儲存方面的考慮,這些檔案系統一般都不會設定成自動掛載,當主機異常重啟時,由於故障期間運維人員容易第一時間恢復資料庫,而忽略了啟動之前的一些檢查;此時,如果在Checkpoint檔案系統沒有掛載的情況下啟動daemon程式,Daemon程式讀取註冊資訊時找不到註冊資訊中記錄的Checkpoint檔案,TimesTen會將原來的DBI檔案重新命名為原來檔名加'~'的檔案,同時會生成一個新的DBI檔案,由於此時Checkpoint目錄不存在,所以根據sys.odbc.ini檔案的配置資訊也無法建立新的DSN;原來的DSN也無法載入,由於DBI檔案已經修改,所以即使再次重啟也只會讀取已經被修改過的DBI檔案讀取最新的註冊資訊。

 

2.      主機異常重啟,DBI檔案丟失/損壞

這種情況是比較極端的,一般情況下改檔案不會出現丟失,因為丟失或被刪除後,在有會話連線到DSN時,Daemon程式會自動生成新的同名的DBI檔案;但是如果該檔案損壞就悲劇了,因為檔案存在的情況下不會自動修復損壞的檔案,所以我們在運維過程中,建立完DSN後建議備份該檔案。

 

下面我們模擬以上場景及其解決辦法

1.      主機異常重啟,Checkpoint檔案目錄沒有掛載

-首先模擬主機異常當機或Daemon程式異常

透過ttstatus找到Daemon程式號,並直接kill

$ ttstatus|grep -E "Daemon pid"

Daemon pid 15752 port 53396 instance tt1122

$ kill -9 15752

 

$ ttstatus|grep -E "Daemon pid"

ttStatus: Could not connect to the TimesTen daemon.

If the TimesTen daemon is not running, please start it

by running "ttDaemonAdmin -start".

 

-模擬主機檔案系統沒有掛載

$ cd $TT_HOME/info

 

$ cat sys.odbc.ini|grep -E "DataStore="

DataStore=/ttchk/tt1122/DataStore/TYINFO/tyinfodata   #當然,這裡如果有配置多個DSN的話需要自己區分一下

 

$ cd /ttchk/tt1122/DataStore

$ ls

TYINFO

$ mv TYINFO TYINFO1

-然後我們先看一下info目錄中的檔案

$ cd $TT_HOME/info

$ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3520 Jan 20 08:51 DBI54928054.0

-rw------- 1 timesten timesten  3520 Jan  1 01:53 DBI54928054.01~

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     6 Jan 20 08:51 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

-啟動daemon程式

$ ttDaemonAdmin -start

Pid file exists: /TimesTen/tt1122/info/timestend.pid.

To start anyway, use -force.

$ ttDaemonAdmin -start -force

/TimesTen/tt1122/info/timestend.pid file exists, attempt start due to -force option.

TimesTen Daemon startup OK.

$ ttstatus

TimesTen status report as of Tue Jan 20 09:14:48 2015

 

Daemon pid 15902 port 53396 instance tt1122

TimesTen server pid 15917 started on port 53397

------------------------------------------------------------------------

Accessible by group timesten

End of report

 

-這個時候悲劇發生了,ttstatus看不到例項的DSN註冊資訊,而且無論我們怎麼重啟,怎麼折騰都找不到。

 

$ ttisql tyinfo

Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

 

connect "DSN=tyinfo";

  830: Cannot create data store file. OS-detected error: No such file or directory

The command failed.

Done.

$ ttadmin -ramload tyinfo

ttAdmin: TimesTen Error: 10002; No record of a data store located in '/ttchk/tt1122/DataStore/TYINFO/tyinfodata'

-我們這個時候模擬檔案系統掛載回來

$ mv TYINFO1 TYINFO

-接著我們再怎麼折騰,都找不到例項DSN的註冊資訊

$ ttstatus

TimesTen status report as of Tue Jan 20 09:21:29 2015

 

Daemon pid 15902 port 53396 instance tt1122

TimesTen server pid 15917 started on port 53397

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ ttisql tyinfo

Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

 

connect "DSN=tyinfo";

10003: Unexpected data store file exists for new data store: /ttchk/tt1122/DataStore/TYINFO/tyinfodata.ds0.

The command failed.

Done.

$ ttadmin -ramload tyinfo

ttAdmin: TimesTen Error: 10002; No record of a data store located in '/ttchk/tt1122/DataStore/TYINFO/tyinfodata'

$ ttdaemonadmin -restart

TimesTen Daemon stopped.

TimesTen Daemon startup OK.

$ ttstatus

TimesTen status report as of Tue Jan 20 09:22:03 2015

 

Daemon pid 16028 port 53396 instance tt1122

TimesTen server pid 16044 started on port 53397

------------------------------------------------------------------------

Accessible by group timesten

End of report

 

-下面再看一下info目錄中的檔案

$ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3520 Jan 20 08:51 DBI54928054.0~

-rw------- 1 timesten timesten  3520 Jan  1 01:53 DBI54928054.01~

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     6 Jan 20 09:14 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

-原來的DBI54928054.0已經被重新命名為DBI54928054.0~

-透過還原原來的DBI檔案,重啟Daemon程式,恢復故障

 

$ mv DBI54928054.0~ DBI54928054.0

$ ttstatus

TimesTen status report as of Tue Jan 20 09:29:21 2015

 

Daemon pid 16028 port 53396 instance tt1122

TimesTen server pid 16044 started on port 53397

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ ttdaemonadmin -restart

TimesTen Daemon stopped.

TimesTen Daemon startup OK.

$ ttstatus

TimesTen status report as of Tue Jan 20 09:29:39 2015

 

Daemon pid 16112 port 53396 instance tt1122

TimesTen server pid 16132 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are no connections to the data store

RAM residence policy: Manual

Data store is manually unloaded from RAM

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ ttadmin -ramload tyinfo

RAM Residence Policy            : manual

Manually Loaded In RAM          : True

Replication Agent Policy        : manual

Replication Manually Started    : False

Cache Agent Policy              : manual

Cache Agent Manually Started    : False

 

 

2.      主機異常重啟,DBI檔案丟失/損壞

-首先模擬DBI檔案丟失

$ ttstatus

TimesTen status report as of Wed Jan 21 08:38:44 2015

 

Daemon pid 3014 port 53396 instance tt1122

TimesTen server pid 3023 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are 11 connections to the data store

Shared Memory KEY 0x1f01f762 ID 32769

Type            PID     Context             Connection Name              ConnID

Subdaemon       3020    0x0000000001fb4d00  Manager                         127

Subdaemon       3020    0x000000000200bba0  Rollback                        126

Subdaemon       3020    0x00000000020d9fc0  Flusher                         125

Subdaemon       3020    0x000000000212ee70  Monitor                         124

Subdaemon       3020    0x00000000021a4510  Deadlock Detector               123

Subdaemon       3020    0x00000000021f93c0  Checkpoint                      122

Subdaemon       3020    0x000000000224e270  Aging                           121

Subdaemon       3020    0x00000000022a3120  Log Marker                      120

Subdaemon       3020    0x00000000022f7fd0  AsyncMV                         119

Subdaemon       3020    0x000000000234ce80  HistGC                          118

Subdaemon       3020    0x00000000023a1d30  IndexGC                         117

RAM residence policy: Manual

Data store is manually loaded into RAM

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3520 Jan 21 08:38 DBI54928054.0

-rw------- 1 timesten timesten  3524 Jan 21 05:41 DBI54928054.0~

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     5 Jan 21 08:37 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

-我們看到上面DSN正常執行,而且DBI檔案存在,下面刪除DBI檔案

$ rm -f DBI*

$ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     5 Jan 21 08:37 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

-這個時候DBI檔案已經丟失,下面測試只有有會話連線到DSN,Daemon程式會自動建立DBI檔案,而且檔名與原來相同

$ ttisql tyinfo

Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

 

connect "DSN=tyinfo";

Connection successful: DSN=TYINFO;UID=timesten;DataStore=/ttchk/tt1122/DataStore/TYINFO/tyinfodata;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;LogFileSize=128;DRIVER=/TimesTen/tt1122/lib/libtten.so;SMPOptLevel=1;LogDir=/ttlog/tt1122/TYINFO;PermSize=128;TempSize=64;Connections=80;CkptFrequency=600;RecoveryThreads=4;TypeMode=0;PLSQL=0;CacheGridEnable=0;LogBufMB=64;ReceiverThreads=1;

(Default setting AutoCommit=1)

Command> exit

Disconnecting...

Done.

$ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3520 Jan 21 08:42 DBI54928054.0

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     5 Jan 21 08:37 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

-可以看到有會話連線DSN後,Daemon程式生成了新的DBI檔案。

 

 

-下面模擬DSN正常執行,但是DBI檔案損壞

$ ttstatus

TimesTen status report as of Wed Jan 21 08:55:42 2015

 

Daemon pid 3014 port 53396 instance tt1122

TimesTen server pid 3023 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are 11 connections to the data store

Shared Memory KEY 0x1f01f762 ID 32769

Type            PID     Context             Connection Name              ConnID

Subdaemon       3020    0x0000000001fb4d00  Manager                         127

Subdaemon       3020    0x000000000200bba0  Rollback                        126

Subdaemon       3020    0x00000000020d9fc0  Flusher                         125

Subdaemon       3020    0x000000000212ee70  Monitor                         124

Subdaemon       3020    0x00000000021a4510  Deadlock Detector               123

Subdaemon       3020    0x00000000021f93c0  Checkpoint                      122

Subdaemon       3020    0x000000000224e270  Aging                           121

Subdaemon       3020    0x00000000022a3120  Log Marker                      120

Subdaemon       3020    0x00000000022f7fd0  AsyncMV                         119

Subdaemon       3020    0x000000000234ce80  HistGC                          118

Subdaemon       3020    0x00000000023a1d30  IndexGC                         117

RAM residence policy: Manual

Data store is manually loaded into RAM

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3520 Jan 21 08:42 DBI54928054.0

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     5 Jan 21 08:37 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

-這裡看到例項是正常執行的,而且DSN也是裝載的,可以看到DBI檔案的大小為3520Bytes,下面手動編輯DBI檔案,模擬檔案損壞

$ vi DBI54928054.0 

^K^@^B^@^B^@^G^@^D^

"DBI54928054.0" [converted] 1L, 3578C written                 

 $ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3550 Jan 21 08:58 DBI54928054.0

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     5 Jan 21 08:37 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

-這個時候DBI檔案已經被手動編輯,大小也變為3550Bytes,例項和DSN都不會受到影響,有新的session連線和退出是Daemon程式也不會更新DBI檔案,但是如果這個時候解除安裝DSN並停止Daemon程式,悲劇就發生了。

 

$ ttadmin -ramunload tyinfo

RAM Residence Policy            : manual

Manually Loaded In RAM          : False

Replication Agent Policy        : manual

Replication Manually Started    : False

Cache Agent Policy              : manual

Cache Agent Manually Started    : False

$ ttstatus

TimesTen status report as of Wed Jan 21 09:01:53 2015

 

Daemon pid 3014 port 53396 instance tt1122

TimesTen server pid 3023 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are no connections to the data store

RAM residence policy: Manual

Data store is manually unloaded from RAM

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ ttdaemonadmin -stop

TimesTen Daemon stopped.

$ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3550 Jan 21 09:01 DBI54928054.0

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

$ ttdaemonadmin -start

TimesTen Daemon startup OK.

$ ttstatus

TimesTen status report as of Wed Jan 21 09:02:19 2015

 

Daemon pid 3196 port 53396 instance tt1122

TimesTen server pid 3216 started on port 53397

------------------------------------------------------------------------

Accessible by group timesten

End of report

 

-透過ttstatus已經看不到DSN的註冊資訊了,而且已經回到前面的CheckPoint檔案丟失的現象,這個時候已經再沒有辦法恢復了,只能透過備份的DBI檔案來恢復DSN的註冊資訊。當然,如果實在沒有備份的情況下,我們可以嘗試從其他地方複製一個DBI檔案來修改,當然,DBI檔案是二進位制檔案,可能修改起來比較麻煩。

$ ttstatus

TimesTen status report as of Wed Jan 21 09:59:15 2015

 

Daemon pid 4203 port 53396 instance tt1122

TimesTen server pid 4218 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are 11 connections to the data store

Shared Memory KEY 0x0301f765 ID 360449

Type            PID     Context             Connection Name              ConnID

Subdaemon       4216    0x0000000018c52070  Manager                         127

Subdaemon       4216    0x0000000018ca8dd0  Rollback                        126

Subdaemon       4216    0x0000000018d569a0  Flusher                         125

Subdaemon       4216    0x0000000018dab850  Monitor                         124

Subdaemon       4216    0x0000000018e00700  Deadlock Detector               123

Subdaemon       4216    0x0000000018e555b0  Checkpoint                      122

Subdaemon       4216    0x0000000018eaa460  Aging                           121

Subdaemon       4216    0x0000000018f0b230  Log Marker                      120

Subdaemon       4216    0x0000000018f5fec0  AsyncMV                         119

Subdaemon       4216    0x0000000018fb4b50  HistGC                          118

Subdaemon       4216    0x00000000190097e0  IndexGC                         117

RAM residence policy: Manual

Data store is manually loaded into RAM

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ kill -9 4203

$ rm DBI*

$ ttdaemonadmin -start -force

/TimesTen/tt1122/info/timestend.pid file exists, attempt start due to -force option.

TimesTen Daemon startup OK.

[timesten@tony5 info]$ ttstatus

TimesTen status report as of Wed Jan 21 10:00:43 2015

 

Daemon pid 4309 port 53396 instance tt1122

TimesTen server pid 4324 started on port 53397

------------------------------------------------------------------------

Accessible by group timesten

End of report

-DBI檔案丟失,例項異常當機,這個時候又無法看到註冊資訊,也無法載入DSN

$ ttisql tyinfo

 

Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

 

connect "DSN=tyinfo";

10003: Unexpected data store file exists for new data store: /ttchk/tt1122/DataStore/TYINFO/tyinfodata.ds0.

The command failed.

Done.

$ ttadmin -ramload tyinfo

ttAdmin: TimesTen Error: 10002; No record of a data store located in '/ttchk/tt1122/DataStore/TYINFO/tyinfodata'

-下面透過其他地方複製DBI檔案,恢復DSN註冊資訊。

$ ls -l

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3520 Jan 21 10:03 DBI54928054.0

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     5 Jan 21 10:00 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

$ ttdaemonadmin -restart

TimesTen Daemon stopped.

TimesTen Daemon startup OK.

$ ttstatus

TimesTen status report as of Wed Jan 21 10:04:05 2015

 

Daemon pid 4394 port 53396 instance tt1122

TimesTen server pid 4409 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are no connections to the data store

RAM residence policy: Manual

Data store is manually unloaded from RAM

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

-這樣就完成透過備份或者是其他地方複製還原的DBI檔案恢復DSN的註冊資訊,載入DSN了。

-當然,在這種異常當機,同時DBI檔案又丟失的極端情況,我們還可以用另外一種方式恢復;就是先移開Trans Log檔案和CheckPoint檔案,建立新的DSN後,停止Daemon程式替換原來的Trans Log檔案和CheckPoint檔案;但是,這種方式千萬要小心,一旦操作失誤,將無法補救。下面演示一下操作方法:

 

$ ttstatus

TimesTen status report as of Wed Jan 21 10:19:12 2015

 

Daemon pid 4722 port 53396 instance tt1122

TimesTen server pid 4739 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are 11 connections to the data store

Shared Memory KEY 0x1d01f765 ID 622596

Type            PID     Context             Connection Name              ConnID

Subdaemon       4729    0x000000001af9dd00  Manager                         127

Subdaemon       4729    0x000000001aff4ba0  Rollback                        126

Subdaemon       4729    0x000000001b0c2fc0  Flusher                         125

Subdaemon       4729    0x000000001b117e70  AsyncMV                         119

Subdaemon       4729    0x000000001b138660  Monitor                         124

Subdaemon       4729    0x000000001b18d510  Deadlock Detector               123

Subdaemon       4729    0x000000001b1e23c0  Checkpoint                      122

Subdaemon       4729    0x000000001b237270  Aging                           121

Subdaemon       4729    0x000000001b28c120  Log Marker                      120

Subdaemon       4729    0x000000001b321010  HistGC                          118

Subdaemon       4729    0x000000001b375ca0  IndexGC                         117

RAM residence policy: Manual

Data store is manually loaded into RAM

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ kill -9 4722

$ ttstatus

ttStatus: Could not connect to the TimesTen daemon.

If the TimesTen daemon is not running, please start it

by running "ttDaemonAdmin -start".

$ rm DBI*

$ ttdaemonadmin -start -force

/TimesTen/tt1122/info/timestend.pid file exists, attempt start due to -force option.

TimesTen Daemon startup OK.

$ ttstatus

TimesTen status report as of Wed Jan 21 10:19:54 2015

 

Daemon pid 4810 port 53396 instance tt1122

TimesTen server pid 4830 started on port 53397

------------------------------------------------------------------------

Accessible by group timesten

End of report

-DSN資訊已經註冊不到了

 

$ ls -l

total 48

-rw------- 1 timesten timesten  3520 Jan 21 05:23 aa

-rw------- 1 timesten timesten  3520 Jan 21 05:55 bb

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Dec  4 10:51 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

-rw-r--r-- 1 timesten timesten     5 Jan 21 10:19 timestend.pid

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

-DBI檔案也不存在了。

 

$ ttdaemonadmin -stop

TimesTen Daemon stopped.

 

-下面將原來的Trans Log檔案和CheckPoint檔案移開

$ cd /ttchk/tt1122/DataStore

$ mv TYINFO/ TYINFO1

$ mkdir TYINFO

$ cd /ttlog/tt1122/

$ mv TYINFO/ TYINFO1

$ mkdir TYINFO

$ ttdaemonadmin -start

TimesTen Daemon startup OK.

$ ttstatus

TimesTen status report as of Wed Jan 21 10:21:49 2015

 

Daemon pid 4886 port 53396 instance tt1122

TimesTen server pid 4901 started on port 53397

------------------------------------------------------------------------

Accessible by group timesten

End of report

 

-這裡考慮到檔案系統空間和恢復時間問題,修改sys.odbc.ini檔案將PermSize修改小一些

 

$ ttisql tyinfo

Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

 

connect "DSN=tyinfo";

Connection successful: DSN=TYINFO;UID=timesten;DataStore=/ttchk/tt1122/DataStore/TYINFO/tyinfodata;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;LogFileSize=128;DRIVER=/TimesTen/tt1122/lib/libtten.so;SMPOptLevel=1;LogDir=/ttlog/tt1122/TYINFO;PermSize=100;TempSize=64;Connections=80;CkptFrequency=600;RecoveryThreads=4;TypeMode=0;PLSQL=0;CacheGridEnable=0;LogBufMB=64;ReceiverThreads=1;

(Default setting AutoCommit=1)

Command> exit

Disconnecting...

Done.

$ ttstatus

TimesTen status report as of Wed Jan 21 10:23:32 2015

 

Daemon pid 4886 port 53396 instance tt1122

TimesTen server pid 4901 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are no connections to the data store

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ ttdaemonadmin -stop

TimesTen Daemon stopped.

 

 

-將sys.odbc.ini檔案的PermSize修改回來

$ cd /ttlog/tt1122

$ mv TYINFO TYINFO2

$ mv TYINFO1 TYINFO

$ cd /ttchk/tt1122/DataStore

$ mv TYINFO TYINFO2

$ mv TYINFO1 TYINFO

$ ttstatus

ttStatus: Could not connect to the TimesTen daemon.

If the TimesTen daemon is not running, please start it

by running "ttDaemonAdmin -start".

$ cd $TT_HOME/info

-rw-r----- 1 timesten timesten  3251 Dec  4 09:54 cluster.oracle.ini

-rw------- 1 timesten timesten  3520 Jan 21 10:23 DBI54bf0d81.0

-rw-r----- 1 timesten timesten   349 Dec  4 09:54 snmp.ini

-rw-rw---- 1 timesten timesten 12946 Jan 21 10:23 sys.odbc.ini

-rw-rw---- 1 timesten timesten   422 Dec  4 09:54 sys.ttconnect.ini

drwxr-x--- 2 timesten timesten  4096 Jul  8  2014 ttcacheadvisor

-rw-r----- 1 timesten timesten   316 Dec  4 10:42 ttendaemon.options

 

-啟動Daemon程式

$ ttdaemonadmin -start

TimesTen Daemon startup OK.

 

-下面就可以看到DSN的註冊資訊了

$ ttstatus

TimesTen status report as of Wed Jan 21 10:25:30 2015

 

Daemon pid 4995 port 53396 instance tt1122

TimesTen server pid 5015 started on port 53397

------------------------------------------------------------------------

Data store /ttchk/tt1122/DataStore/TYINFO/tyinfodata

There are no connections to the data store

Replication policy  : Manual

Cache Agent policy  : Manual

------------------------------------------------------------------------

Accessible by group timesten

End of report

$ ttadmin -ramload tyinfo

ttAdmin: TimesTen Error: 10009; RAM load ignored due to ramPolicy setting

$ ttadmin -rampolicy manual tyinfo

RAM Residence Policy            : manual

Manually Loaded In RAM          : False

Replication Agent Policy        : manual

Replication Manually Started    : False

Cache Agent Policy              : manual

Cache Agent Manually Started    : False

$ ttadmin -ramload tyinfo

RAM Residence Policy            : manual

Manually Loaded In RAM          : True

Replication Agent Policy        : manual

Replication Manually Started    : False

Cache Agent Policy              : manual

Cache Agent Manually Started    : False

$ ttisql tyinfo

Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

 

connect "DSN=tyinfo";

Connection successful: DSN=TYINFO;UID=timesten;DataStore=/ttchk/tt1122/DataStore/TYINFO/tyinfodata;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;LogFileSize=128;DRIVER=/TimesTen/tt1122/lib/libtten.so;SMPOptLevel=1;LogDir=/ttlog/tt1122/TYINFO;PermSize=128;TempSize=64;Connections=80;CkptFrequency=600;RecoveryThreads=4;TypeMode=0;PLSQL=0;CacheGridEnable=0;LogBufMB=64;ReceiverThreads=1;

(Default setting AutoCommit=1)

Command> select * from tangyun.t;

< 1, snc >

1 row found.

Command> exit

Disconnecting...

Done.

-可以看到已經恢復原來的DSN資訊。

-透過上面的不同場景,在使用DBI恢復和處理故障都會存在一定的麻煩和風險;所以,在我們實際運維中,建議備份DBI檔案,做到有備無患。


Created by Tony.Tang[TangYun]2015.01 

--------End-------------------



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24930246/viewspace-1410008/,如需轉載,請註明出處,否則將追究法律責任。

相關文章