Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  • MOUNT
  • UNMOUNT
  • Retrieve data from mounted database

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

...

  • 마운트된 데이터베이스에서 데이터 읽기

데이터를 분석하기 위해서 대량의 데이터를 지속적으로 저장하면 그 양이 매우 증가하므로 다음의 문제가 발생한다.

  • 대량의 데이터 저장에 의한 디스크 비용 증가
  • 데이터 분석용 장비의 디스크 한계

문제 해결을 위해서는 오래된 데이터를 백업하고, 주기적으로 삭제할 필요가 있다. 이후에 오래된 데이터를 읽을 필요가 있을 때, 백업된 데이터베이스를 읽기 위해서 데이터 복구를 실행하면 복구 과정에서 실행 시간이 오래 걸리는 것 뿐만 아니라, 데이터베이스를 오프라인 상태로 변환하고 현재 데이터를 모두 삭제한 상태에서 복구를 실행해야 하므로 서비스를 계속 진행하기 위해서는 별도의 장비가 필요한 문제점이 있다. 마크베이스는 이 문제를 해결하기 위해서 MOUNT 명령을 지원한다.

MOUNT명령은 데이터베이스가 서비스를 진행하면서도 백업된 데이터를 읽어들여서 현재 실행중인 데이터베이스와 별개로 새로운 데이터베이스를 생성한다. 하나의 서버에서 여러 개의 백업된 데이터베이스를 추가하여 동시에 데이터를 검색할 수 있으나, 마운트된 데이터베이스는 읽기 전용으로 데이터의 추가와 삭제는 불가능하다.

데이터베이스 MOUNT명령은 백업 데이터와 주 데이터베이스 내용을 동시에 읽을 수 있도록 한다. 따라서 마운트된 데이터베이스는 기존의 데이터 검색 방법과 동일하게 데이터를 검색할 수 있다.

MOUNT 명령을 실행하기 위해서는 다음의 제약조건을 만족시켜야 한다.

  • 백업 데이터베이스의 버전과 메타데이터 버전이 호환 가능해야 한다.
  • 마운트된 백업 데이터베이스에는 테이블 생성, 인덱스 생성 및 삭제, 데이터 추가 및 삭제를 실행할 수 없다.

마운트된 데이터베이스들에 대한 정보는 V$STORAGE_MOUNT_DATABASES 메타 테이블에서 얻을 수 있다.

MOUNT

마운트 명령을 실행하기 위해서는 백업 데이터베이스 경로명과 마운트할 데이터베이스 이름을 입력해야 한다.

백업 데이터베이스 경로는 백업 명령으로 실행한 디렉토리의 위치를 설정한다. 마운트할 데이터베이스 이름은 운영중인 데이터베이스와 구별하기 위해서 별도의 이름을 부여해야 한다.

백업 데이터베이스 경로명은 절대 경로명 ("/"문자로 시작되는 경로명)을 입력하거나, 백업 명령과 동일한 규칙으로 $MACHBASE_HOME/dbs를 기준으로 한 상대 경로명을 이용할 수 있다.

Syntax:

Code Block
languagesql
MOUNT DATABASE 'backup_database_path' TO mount_name;

...

Code Block
languagesql
MOUNT DATABASE '/home/machbase/backup' TO mountdb;

UNMOUNT

Ifthemounteddatabaseisnolongerrequired,deleteitbyexecutingUNMOUNT command. 마운드된 데이터베이스 데이터가 더 이상 읽을 필요가 없다면, 마운트 상태를 해제하기 위해 UNMOUNT 명령을 사용한다.

Syntax:

Code Block
languagesql
UNMOUNT DATABASE mount_name;

...

Code Block
languagesql
UNMOUNT DATABSEDATABASE 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:

...

마운트된 데이터베이스에서 데이터 읽기

마운트된 데이터베이스에서 데이터를 검색할 때는 기존과 동일한 SQL문을 이용한다.

SYS유저만 마운트된 데이터를 읽을 수 있다. SQL문에서 마운트된 데이터베이스의 테이블을 지정하기 위해서는 mount_name과 user_name을 "." 문자로 연결하여 지정해야 한다.

Syntax:

Code Block
languagesql
SELECT column_name FROM mount_name.user_name.table_name;

Example:

Code Block
languagesql
SELECT * FROM mountdb.sys.backuptable;

...