database backup textiledb -...

11
Page 1 of 11 Database Backup – Textile database Both Datacolor Match Textile and DatacolorTools use the Sybase Adaptive Server database management system. The document will explain the different methods that can be used to back up the Datacolor Match Textile and Datacolor Tools database “dci_itm.db”. All the information in a Datacolor Match Textile system is stored in a single Adaptive Server Anywhere database file “dci_itm.db”, which can be copied from one machine to another. In addition to the database file, “dci_itm.db”, Adaptive Server Anywhere uses another file when it is running a database. This file is the transaction log. The transaction log is a separate file, which contains a record of all the operations performed on the database. It stores all changes to the database. Inserts, updates, deletes, commit, rollbacks, and database schema changes are all logged. Normally, it has the same name as the database file, except that it ends with the suffix .log instead of .db. The transaction log is a key component of backup and recovery, since you can recreate your database from a backup together with the transaction log if the database file is damaged. Backups can be categorized in several ways: Full backup and incremental backup A full backup is a backup of both the database file and of the transaction log. An incremental backup is a backup of the transaction log only. Typically, full backups are interspersed with several incremental backups. Online and offline backup Backing up a running database provides a snapshot of a consistent database, even though the database is being modified by other users. An offline backup consists simply of copying the files. You should only carry out an offline backup when the database is not running, and when the database server was shut down properly Offline Full Backup The database can be backed up by copying the database file “Dci_itm.db” and the transaction log “dci_itm.Log”. The database can be copied only when the database is shut down. When a database is shut down, the database file holds a complete and current copy of all the data in the database. To make an Offline Full Backup of Dci_itm.db and Dci_itm.log: 1. Shut down the database server by closing all Datacolor Match Textile/Datacolor Tools programs. Use the “Exit and Log Off” option in the Data Navigator. Note: If you are running the database server on a network using a Windows service to start the network server, you would need to shut down the server in order to perform a manual backup. In this case, it would be better to use either the automated event backup or use the backup utility to perform an online backup. 2. Copy the file Dci_itm.db and Dci_itm.log from your Datacolor Match Textile database directory (normally C:\Program Files\Datacolor\Database) to your backup directory. 3. You can delete the current transaction log “Dci_itm.log” in your Datacolor Match Textile database directory. When you restart Datacolor Match Textile, a new “Dci_itm.log” will be created which will be much smaller in size. All new transactions will be saved in this new transaction log.

Upload: hoangdan

Post on 07-Jul-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1 of 11

Database Backup – Textile database Both Datacolor Match Textile and DatacolorTools use the Sybase Adaptive Server database management system. The document will explain the different methods that can be used to back up the Datacolor Match Textile and Datacolor Tools database “dci_itm.db”. All the information in a Datacolor Match Textile system is stored in a single Adaptive Server Anywhere database file “dci_itm.db”, which can be copied from one machine to another. In addition to the database file, “dci_itm.db”, Adaptive Server Anywhere uses another file when it is running a database. This file is the transaction log. The transaction log is a separate file, which contains a record of all the operations performed on the database. It stores all changes to the database. Inserts, updates, deletes, commit, rollbacks, and database schema changes are all logged. Normally, it has the same name as the database file, except that it ends with the suffix .log instead of .db. The transaction log is a key component of backup and recovery, since you can recreate your database from a backup together with the transaction log if the database file is damaged.

Backups can be categorized in several ways:

• Full backup and incremental backup A full backup is a backup of both the database file and of the transaction log. An incremental backup is a backup of the transaction log only. Typically, full backups are interspersed with several incremental backups.

• Online and offline backup Backing up a running database provides a snapshot of a consistent database, even though the database is being modified by other users. An offline backup consists simply of copying the files. You should only carry out an offline backup when the database is not running, and when the database server was shut down properly

Offline Full Backup The database can be backed up by copying the database file “Dci_itm.db” and the transaction log “dci_itm.Log”. The database can be copied only when the database is shut down. When a database is shut down, the database file holds a complete and current copy of all the data in the database. To make an Offline Full Backup of Dci_itm.db and Dci_itm.log:

1. Shut down the database server by closing all Datacolor Match Textile/Datacolor Tools programs. Use the “Exit and Log Off” option in the Data Navigator. Note: If you are running the database server on a network using a Windows service to start the network server, you would need to shut down the server in order to perform a manual backup. In this case, it would be better to use either the automated event backup or use the backup utility to perform an online backup.

2. Copy the file Dci_itm.db and Dci_itm.log from your Datacolor Match Textile database directory (normally C:\Program Files\Datacolor\Database) to your backup directory.

3. You can delete the current transaction log “Dci_itm.log” in your Datacolor Match Textile database directory. When you restart Datacolor Match Textile, a new “Dci_itm.log” will be created which will be much smaller in size. All new transactions will be saved in this new transaction log.

Page 2 of 11

Online Full Backup

Online backups can be made in a number of different ways.

1. Using Sybase Central and the Backup Database utility wizard. 2. Using the command line utility “dbbackup”. 3. Using SQL to perform a backup operation.

The easiest method however, is to create a database “event” and automate the backup procedure.

Online Backups Using an Event

1. Start Sybase Central

From the Programs menu, select Program Files then Sybase SQL Anywhere 9 then Sybase Central 4.3. Or run the program from: "C:\Program Files\Sybase\Shared\Sybase Central 4.3\java\scjview.exe". 2. Connect to the Database

From the Tools menu, select “Connect”.

Click OK to continue.

Page 3 of 11

From the Connect dialog, select the radio button “ODBC DATA Source Name” and select the ODBC connection “DCI_ITM”. If there isn’t a connection showing, select the Browse button and select “DCI_ITM” from the connections available.

If you connected to the database, you should see the connection name “dci_itm” with the SQL icon.

You should then see the database name “dci_itm (dci)” with the database icon.

Page 4 of 11

3. Create an Event

Type a name for this event. In this example, we will use “Daily Backup”. Then click the Next button to continue.

Click on the “+” to expand.

Double-Click on the “Events” option.

Then double-click on “Add Event”.

Page 5 of 11

Select “Scheduled event” for the type of event.

Click on the Add button to add an event schedule.

Page 6 of 11

The schedule name can be the same as the event name “Daily Backup”. You can start the event at a specific time or between certain times. In this example, it is set to start at 15:00 hrs on February 18, 2003.

Page 7 of 11

Next, click on the Recurrence tab to set how often the event happens.

At this point, we need to add the event handler, which is the SQL code that will be executed when the event fires. This will be the actual backup commands.

Check “Repeat every”.

Enter “24”.

Click OK to continue.

Click Next to continue.

Page 8 of 11

Type the following between the BEGIN and END keywords: BACKUP DATABASE DIRECTORY ‘c:\backup’ Put your actual backup directory path in single quotes following the DIRECTORY keyword.

Click Next to continue.

Page 9 of 11

The event “Daily Backup” is now created. The database file “Dci_itm.db” and the “Dci_itm.log” will now be automatically be backed up everyday. This is an online backup procedure so the database does not need to be shut down.

Click Next to continue.

Click Finish to continue.

Page 10 of 11

This completes the setup of the Daily Backup event.

Event Handler Backup Options The event handler can be configured in different ways depending on the backup requirements. These are the most common options: 1. Backing Up Database and Transaction Log – Leaving Original Transaction Log

Untouched

BACKUP DATABASE DIRECTORY directory_name

This will only make a backup of the database file “DCI_ITM.DB” and the transaction log “DCI_ITM.LOG”. The original transaction log is not changed. This is how the preceding example was set up. This would be the recommended method to start with.

2. Backing Up Database and Transaction Log – Deleting Original Transaction Log and

Creating a New One

BACKUP DATABASE DIRECTORY directory_name TRANSACTION LOG TRUNCATE

Page 11 of 11

This will make a backup of the database file “DCI_ITM.DB” and the transaction log “DCI_ITM.LOG”. This original transaction log “DCI_ITM.LOG” is deleted and a new transaction log “DCI_ITM.LOG” is started. This will save disk space since the transaction log is always reset.

3. Backing Up Database and Transaction Log – Renaming Original Transaction Log and Creating a New One

BACKUP DATABASE DIRECTORY directory_name TRANSACTION LOG RENAME In addition to making backup copies of the database file “DCI_ITM.DB” and the transaction log “DCI_ITM.LOG”, the transaction log at backup time is renamed to an offline log “YYMMDDnn.log”, and a new transaction log “DCI_ITM.LOG” is started, with the same name as the log in use at backup time.