Versions Compared

Key

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

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

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

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

...

마운트된 데이터베이스들에 대한 정보는 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마운트 명령을 실행하기 위해서는 백업 데이터베이스 경로명과 마운트할 데이터베이스 이름을 입력해야 한다.

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

백업 데이터베이스 경로명은 절대 경로명 ("/"문자로 시작되는 경로명)을 입력하거나, 백업 명령과 동일한 규칙으로 $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:

Example:

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

마운트된 데이터베이스에서 데이터를 검색할 때는 기존과 동일한 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;

...