Mount a Database

List of Contents

When the massive amounts of data are periodically backed up and new data are inserted to prepare for emergency situations, the problems below occur.

  • Increase of disk costs for data storage
  • Limitations on the disk space of currently running machines

In order to prevent these problems, it keeps the necessary data and deletes all data from the database periodically for supporting the current service. When it requires to refer to the old data, the backed up database must be restored. However, it takes a long time to restore very large backup images and additional devices are required for this because the service can only be restored after currently operating database is deleted. The MOUNT command of Machbase simply solves this problem.

The MOUNT command is executed from online. With this feature, a backup database is attached to a primary database which is currently running.

Multiple backup databases can be attached to the primary database, and the user can refer them as one database. However, note that when a database is mounted, it is read-only mode.

Mount database command allows the existing backup database or table data be selected from the current database. Thus, the mounted database can be retrieved by using the same database commands.

When the mount command is executed, the following restrictions apply:

  • Major number of the mounted database and major number of meta data must have compatible versions.
  • It doesn't allow creation, insertion and deletion of indexes and only allows "selection" feature when you try to mount backup databases.
  • Information about the currently mounted database can be found in the V$STORAGE_MOUNT_DATABASES.

MOUNT

To conduct MOUNT command, it is required the information for "backup_database_path" and "mount_name".

For "backup_database_path", input the location information of a newly created database by executing BACKUP command.

When you mount a database, "mount_name" should have a separate name to distinguish itself from the original database.

In "backup_database_path", when the same relative path is inserted like the backup operation, it searches data based on a specified directory from DB_PATH which is set in environment variables of the database.

Syntax:

MOUNT DATABASE 'backup_database_path' TO mount_name;

Example:

MOUNT DATABASE '/home/machbase/backup' TO mountdb;

UNMOUNT

If the mounted database is no longer required, delete it by executing UNMOUNT command.

​Syntax:

UNMOUNT DATABASE mount_name;

Example:

UNMOUNT DATABSE mountdb;

Retrieve Data from Mounted Database

When you run a query against data from the backup database, the same SQL statements are used for querying data from currently operating database.

It only allows SYS user to retrieve data from the mounted database. When you retrieve the data from a table, it is required to input both mount_name and user_name in front of table_name by using "." as a delimiter. mount_name refers to a specified database from the mounted databases and user_name indicates the information of the user who has the authentication over the table of the mounted database.

Syntax:

SELECT column_name FROM mount_name.user_name.table_name;

Example:

SELECT * FROM mountdb.sys.backuptable;

results matching ""

    No results matching ""