TimesTen命令—ttrestore

联系:手机/微信(+86 17813235971) QQ(107644445)QQ咨询惜分飞

标题:TimesTen命令—ttrestore

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

ttrestore使用说明

E:\>ttrestore -h
Usage:
  ttrestore [-h | -help | -?]
  ttrestore [-V | -version]
  ttrestore [-fname <filePrefix>] [-noconn] -dir <directory>
                 {<DSN> | [-connstr] <connStr>}
  ttrestore -i [-noconn] {<DSN> | [-connstr] <connStr>}

options:
  -h | -help | -?      Prints this message and exits.
  -V | -version        Prints the release number and exits.
  -fname <filePrefix>  The file prefix for the backup files in the backup
                       directory. Default is the base filename portion of the
                       DataStore parameter of the data store to be restored.
  -dir <directory>     The directory in which the backup files are stored.
  -noconn              Do not test-connect after restoring the data store.
  -i                   Read from standard input for stream data.
  <DSN>, <connStr>     The DSN or ODBC connection string of the data store
                       to be restored.

查看库中当前情况

Command> tables;
  XIFENFEI.REP_TABLE
  XIFENFEI.T1
  XIFENFEI.T2
  XIFENFEI.T3
  XIFENFEI.T4
  XIFENFEI.V4
  XIFENFEI.XFF
7 tables found.
Command> select * from t2;
< 3 >
< 5 >
< 3 >
< 5 >
< 3 >
< 5 >
< 3 >
< 5 >
< 3 >
< 5 >
< 3 >
< 5 >
12 rows found.

删除数据文件和日志文件

E:\oracle\timesten\mytt_db>dir
 驱动器 E 中的卷没有标签。
 卷的序列号是 38D0-2A35

 E:\oracle\timesten\mytt_db 的目录

2012/02/23  22:58    <DIR>          .
2012/02/23  22:58    <DIR>          ..
2012/02/11  19:06    <DIR>          data
2012/02/23  22:57    <DIR>          log
               0 个文件              0 字节
               4 个目录  9,478,365,184 可用字节

E:\>ttisql my_ttdb

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



connect "DSN=my_ttdb";
  821: No readable checkpoint files.  OS error: '系统找不到指定的文件。'.  Consi
der connecting with Overwrite=1 to create new data store
The command failed.
Done.

还原数据库

E:\>ttrestore -dir E:\oracle\timesten\tt_back\full   -fname xifenfei01_ my_ttdb
Restore started ...
Restore complete

E:\oracle\timesten\mytt_db>dir
 驱动器 E 中的卷没有标签。
 卷的序列号是 38D0-2A35

 E:\oracle\timesten\mytt_db 的目录

2012/02/23  23:01    <DIR>          .
2012/02/23  23:01    <DIR>          ..
2012/02/11  19:06    <DIR>          data
2012/02/23  23:01        21,119,936 data.ds0
2012/02/23  23:01        21,119,936 data.ds1
2012/02/23  23:01    <DIR>          log
               2 个文件     42,239,872 字节
               4 个目录  9,222,610,944 可用字节

测试还原结果

E:\>ttisql my_ttdb

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



connect "DSN=my_ttdb";
Connection successful: DSN=my_ttdb;UID=XIFENFEI;DataStore=E:\oracle\timesten\myt
t_db\data;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;DRIVER=E
:\oracle\timesten\bin\ttdv1122.dll;LogDir=E:\oracle\timesten\mytt_db\log;PermSiz
e=64;TempSize=32;RACCallback=0;TypeMode=0;OracleNetServiceName=XFF;
(Default setting AutoCommit=1)
Command> tables;
  XIFENFEI.REP_TABLE
  XIFENFEI.T1
  XIFENFEI.T2
  XIFENFEI.T3
  XIFENFEI.T4
  XIFENFEI.V4
  XIFENFEI.XFF
7 tables found.
Command> select * FROM T2;
< 3 >
< 5 >
< 3 >
< 5 >
< 3 >
< 5 >
< 3 >
< 5 >
< 3 >
< 5 >
< 3 >
< 5 >
12 rows found.

补充说明
1)ttRestore 除了可以作为数据库还原操作外,还可以用来做数据库复制

ttBackup -dir /users/rob/tmp -fname restored "dsn=origDSN"
ttRestore -dir /users/rob/tmp -fname restored "dsn=restoredDSN"

2)对于在Linux或者unix系统使用streamFull备份恢复方式

dd bs=64k if=/dev/rmt0 | ttRestore -i DSN=FastIns

3)该命令是用来数据库还原,那么对于备份之后到数据库异常这段时间的数据该如何处理,是否会丢失暂时还未知。

此条目发表在 TimesTen 分类目录。将固定链接加入收藏夹。

评论功能已关闭。