One of the TimesTen series: TT migration and backup, one of the timesten Series

Source: Internet
Author: User

One of the TimesTen series: TT migration and backup, one of the timesten Series
TimesTen can use ttMigrate for migration, similar to Oracle exp/imp.
The usage document is very detailed, or you can execute ttMigrate -- help to view it.
I will only record several common application scenarios here.


1) Export a single table:
You can use the following format:
TtMigrate-c |-a DSN | Name of the ConnectStr file name object
-C indicates that the created format is exported.
-A indicates append and export.
The exported object can be cachegroup/table/sequence/view.
For example, export a table
[Root @ test ~] # TtMigrate-c TT_1122/backup/a TEST_USER.TBL_PRODUCTS
Saving cached table TEST_USER.TBL_PRODUCTS
Cache group successfully saved.

The table is exported to/backup/.
Note: to export a table in Cachegroup, you must specify it as CG. Otherwise, an error is returned:
[Root @ test ~] # TtMigrate-c TT_1122/backup/a TEST_USER.TBL_PRODUCTS
TtMigrate: Error received while processing table TEST_USER.TBL_PRODUCTS -- table can only be saved by saving cache group TEST_USER.GC_TBL_PRODUCTS.
[Root @ test ~] # TtMigrate-c TT_1122/backup/a TEST_USER.GC_TBL_PRODUCTS
Saving cache group TEST_USER.GC_TBL_PRODUCTS
Saving cached table TEST_USER.TBL_PRODUCTS
Cache group successfully saved.
You can use ttMigrate-l/-L/-d/-D to view the exported file.
TtMigrate can also be used for restoration. The specific format is:
TtMigrate-r DSN filename
For example, restore the exported file:
[Root @ test ~] # TtMigrate-r TT_1122/backup/


Restoring cache group TEST_USER.GC_TBL_PRODUCTS
Restoring cached table TEST_USER.TBL_PRODUCTS
TtMigrate: Error received while restoring cache group running -- 37000: [TimesTen] [TimesTen 11.2.2.8.0 ODBC Driver] [TimesTen] TT8224: Cache group GC_TBL_PRODUCTS already exists -- file "plittddl. c ", lineno 737, procedure" plittCreate "(TimesTen error code = 8224 ).
* ** Cache group TEST_USER.GC_TBL_PRODUCTS was not restored.
There were errors restoring the following objects:
Cache group TEST_USER.GC_TBL_PRODUCTS
At this point, the prompt that the CG already exists in TT, so we will delete the CG and then restore it:
Command> select count (*) from tbl_products; --- View data volume before deletion
& Lt; 10150 & gt;
1 row found.
Command>
Command> drop cache group TEST_USER.GC_TBL_PRODUCTS;
[Root @ test ~] # TtMigrate-r "dsn = TT_1122; uid = TEST_USER; oraclepwd = TEST_USER"/backup/
Enter password for 'test _ user ':


Restoring cache group TEST_USER.GC_TBL_PRODUCTS
Restoring cached table TEST_USER.TBL_PRODUCTS
1/1 cached table restored.
Cache group successfully restored.
The import is successful.
But now we can view the table and find that the data has not been loaded from the database.


Command> select count (*) from tbl_products;
<0>
1 row found.


Originally, ttMigrate only backs up definitions for cg, and the data is still loaded from the Oracle database
Command> alter cache group GC_TBL_PRODUCTS set AUTOREFRESH interval 5 seconds;


Command> call ttcachestart
>;
Command> select count (*) from tbl_products;
<0>
1 row found.


1 row found.
Command> alter cache group GC_TBL_PRODUCTS set AUTOREFRESH interval 5 seconds;
Command> select count (*) from tbl_products;
<0>
1 row found.
Command> alter cache group GC_TBL_PRODUCTS set AUTOREFRESH state paused;
Command> load cache group GC_TBL_PRODUCTS commit every 500 rows;
10154 cache instances affected.
Command> load cache group GC_TBL_PRODUCTS commit every 500 rows;
The preceding example shows how to export a single object.


2) Export the entire database
If you do not specify the object to be exported, ttMigrate will export the entire database, for example
[Root @ test ~] # TtMigrate-c TT_1122/backup/


Physical backup and recovery:
Timesten uses two tools ttBackup and ttRestore for physical Backup recovery. The document details how to use these two tools,
Below is a simple record of the process of full backup and recovery for the database.
Syntax:
TtBackup-dir path-type bktype-fname fileprefix DSN
For example:
[Root @ test ~] # TtBackup-dir/backup-type fileFull-fname ttbak TT_1122
Backup started...
Backup complete


After the full backup is completed, the backup file is produced in/backup.
Perform the following restoration.
Systax:
TtRestore-fname ttbak-dir/backup TT_1122
[Root @ test ~] # TtRestore-fname fileprefix-dir path TT_1122
Restore started...
Restore failed:
Error 12133: TT12133: Data store file already exists -- file "restore. c", lineno 1006, procedure "doRestore" --- Error
[Root @ test TimesTen] # rm-rf/var/TimesTen/tt1122/tt_1_2.ds * --- Delete the ds File
[Root @ test TimesTen] # ttRestore-fname ttbak-dir/backup TT_1122
Restore started...
Restore failed:
Error 12134: TT12134: Log file (s) already exist -- file "restore. c", lineno 1040, procedure "doRestore" --- Error logfile exists
You have new mail in/var/spool/mail/root


[Root @ test TimesTen] #
[Root @ test TimesTen] # rm-rf/var/TimesTen/tt1122/tt_1_2.log13 * --- Delete the log file
[Root @ test TimesTen] # ttRestore-fname ttbak-dir/backup TT_1122
Restore started...
Restore failed:
Error 12116: TT12116: Cannot create database for restore -- file "restore. c", lineno 1808, procedure "dsCreate"
Error 839: TT0839: Cannot access data store because it is in use. A data store may be considered to be in use due to its RAM Policy setting, even though there are no active connections to it. -- file "db. c ", lineno 20680, procedure" sbDbDestroy"
Error 830: TT0830: Cannot create data store file. OS-detected error: cocould not destroy previous data store -- file "db. c", lineno 7788, procedure "sbDbCreate"
--- In this case, a connection exists and is not released. You cannot create DS.
[Root @ test TimesTen] #
[Root @ test TimesTen] # ttDaemonAdmin-stop
TimesTen Daemon stopped.
[Root @ test TimesTen] # ttstatus
TtStatus: cocould not connect to the TimesTen daemon.
If the TimesTen daemon is not running, please start it
By running "ttDaemonAdmin-start ".
[Root @ test TimesTen] # ttRestore-fname ttbak-dir/backup TT_1122
TtRestore: TimesTen daemon is not running
[Root @ test TimesTen] # ttDaemonAdmin-start ---- restart Daemon
TimesTen Daemon startup OK.
[Root @ test TimesTen] # ttRestore-fname ttbak-dir/backup TT_1122
Restore started...
Restore complete
[Root @ test TimesTen] # --- complete restore
Command> select count (*) from x;
& Lt; 22000 & gt;
1 row found.
Command> ---- verify that data is not lost

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.