The backed-up database can be used as an existing database through a recovery process. This recovery method is called Restore. This Restore function deletes the damaged database and restores the backed up database image to the Primary Database. Therefore, when recovering, delete the existing database and restore it using machadmin -r.
The mount / unmount function is an online function that attaches a backed up database to the currently running database.
Machbase offers two options for backing up your data. It provides DATABASE backup function which backs up information of running DB and TABLE backup function which can select only necessary tables to back up.
The backup command provided by DB is as follows.
When performing a DB backup, the backup type, time duration, and path must be entered as options. When backing up DATABASE entirely, type DATABASE for the backup type. To backup only a specific table, enter TABLE, and then enter the name of the table to be backed up. The TIME_DURATION statement can be set to back up only the data for the required period. In the FROM field, enter the start time of the date you want to back up, and enter the time of the last date in the TO field. In Example 3, the TIME_DURATION is set to FROM, "July 14, 2014, 0, 0, 0", and TO "July 14, 2015, 23:59:59" meaning only 14 days of data are set to be backed up. If information is not entered for the DURATION item, the FROM item is set to 'January 1, 1970, 9:00:00,' and the TO item is automatically set to the time to execute the command.
Finally, a storage medium to store needs to be configured to store the results of the backup. If you want to create a backup in a single file, set the creation type to IBFILE, or enter DISK to create it in directory units. Note that you can specify the PATH information to store the product. If you enter a relative path, it will be created in the path specified in the DB_PATH item of the current DB configuration. If you want to store it somewhere other than DB_PATH, you must enter an absolute path starting with '/'.
The Database Restore feature is not provided as a syntax, and can be recovered offline using machadmin -r. You must check the following before restoration.
- Has Machbase been shutdown?
- Has the previously created DB been deleted?
Extract Single File
A single backup file created in the form of INTO IBFILE can not be restored immediately, and must be converted to a directory using machadmin.
After the conversion, files in the form of directory backup are created in the path of target_path/backup_file_name.
Single Backup File Information Retrieval
Information about a single backup file created by the backup command can be retrieved with the machadmin -w command.
The following problems arise when periodically backing up a large number of databases and adding data continuously in preparation for a system failure.
- Increased disk cost to store data
- Limitations of the physical disk space of the running machine
In order to solve this problem, periodical deletion is performed by leaving only data necessary for the current service. However, if you need to refer to the past data, you need to restore the backed up database. In case of a very large backup image, recovery time is long and additional equipment is needed. This is because the Restore function can only be performed by deleting the currently running database. To solve this problem, Machbase provides the Database Mount function.
The Database Mount function is an online function that attaches a backed up database to the currently running database. By attaching multiple backup databases to the primary database, the user can refer to multiple backup databases as if they were one database. The mounted database is read-only.
The Mount DATABASE command is a function that prepares the database or table DATA created by Backup in a state that it can be viewed from the currently running database. So, Mounted DATABASE can query the data using the same DB command.
The current Database Mount function restrictions are as follows.
- The backup information must be compatible with the database to be mounted, the DB major number, and the Meta major number.
- When mounting backup data, it is read-only and does not support index creation, data insertion or deletion.
- Information about the currently mounted DATABASE can be found by querying V$STORAGE_MOUNT_DATABASES.
To execute the mount command, Backup_database_path information and DatabaseName are required. Backup_database_path is the location information of the DB created by Backup command. DatabaseName is the name that can be distinguished when mounting to Database. Backup_database_path is searched based on the directory specified in the DB_PATH set in the environment variable of the DB when the relative path is entered in the same way as when performing the backup.
If the mounted database will no longer be used, it can be removed using the unmount command.
MOUNT DB Data Retrieval
When querying DATA of Backup DB, it can be retrieved by using the same SQL statement when querying the DATA of the DB in operation.
The mounted DB can retrieve data only by the SYS admin user of the DB in operation. To retrieve the data, you must put MountDBName and UserName in front of the TableName to be queried, and use '.' for each delimiter. MountDBName is used to refer to a specific DB among currently mounted DBs, and UserName refers to the information of the user that owns the mounted DB table.