Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  • MOUNT
  • UNMOUNT
  • 마운트된 데이터베이스에서 데이터 읽기

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

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

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

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

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

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

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

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

MOUNT

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

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

...

  • Read data from a mounted database

Continuously storing a large amount of data in order to analyze the data greatly increases its volume, resulting in the following problems:

  • Increased disk cost by storing a large volume of data
  • Running into equipment disk limits for data analysis

To solve the problem, it is necessary to back up old data and periodically delete it. If you need to read old data later and you perform data recovery to read the backed up database, it will not only take a long time to recover, but it will also take a long time to convert the database to offline, There is a problem that requires separate equipment to continue the service. Machase supports the MOUNT command to solve this problem.

The MOUNT command reads the backed up data while the database is in service and creates a new database independent of the currently running database. One server can add multiple backed-up databases to retrieve data at the same time, but the mounted database is read-only and can not add or delete data.

The Database MOUNT command allows you to read both the backup data and the main database contents simultaneously. Therefore, the mounted database can retrieve data in the same way as the existing data retrieval method.

To execute the MOUNT instruction, the following conditions must be met.

  • The backup database version and the metadata version must be compatible.
  • You can not create tables, create/delete indexes, or add/delete data to a mounted backup database.

Information about mounted databases can be obtained from the V$STORAGE_MOUNT_DATABASES meta table.

MOUNT

To run the mount command, the backup database pathname and the name of the database to be mounted must be entered.
The backup database path sets the location of the directory executed by the backup command. The name of the database to be mounted must be given a separate name to distinguish it from the active database.
The backup database pathname can be an absolute pathname (a pathname beginning with the "/" character), or a relative pathname based on $MACHBASE_HOME/dbs with the same rules as the backup command.

Syntax:

Code Block
languagesql
MOUNT DATABASE 'backup_database_path' TO mount_name;

...

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

UNMOUNT

마운드된 데이터베이스 데이터가 더 이상 읽을 필요가 없다면, 마운트 상태를 해제하기 위해 UNMOUNT 명령을 사용한다If the mounded database data no longer needs to be read, use the UNMOUNT command to release the mounted state.

Syntax:

Code Block
languagesql
UNMOUNT DATABASE mount_name;

...

Code Block
languagesql
UNMOUNT DATABASE mountdb;

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

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

...

Reading Data from Mounted Database

When retrieving data from a mounted database, use the same SQL statement as before.
Only the SYS user can read the mounted data. To specify the mounted database table in an SQL statement, the mount_name and user_name must be set connected to a "." character.

Syntax:

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

...