- MOUNT
- UNMOUNT
- 마운트된 데이터베이스에서 데이터 읽기
데이터를 분석하기 위해서 대량의 데이터를 지속적으로 저장하면 그 양이 매우 증가하므로 다음의 문제가 발생한다.
- 대량의 데이터 저장에 의한 디스크 비용 증가
- 데이터 분석용 장비의 디스크 한계
이 문제들을 해결하기 위해 현재의 서비스를 지속하면서, 오래된 데이터는 주기적으로 데이터를 삭제할 필요가 있다. 오래된 데이터를 읽을 필요가 있을 때, 백업된 데이터베이스를 읽기 위해서 데이터 복구를 실행하면 복구 과정에서 실행 시간이 오래 걸리는 것 뿐만 아니라, 데이터베이스를 오프라인 상태로 변환하고 현재 데이터를 모두 삭제한 상태에서 복구를 실행해야 하므로 서비스를 계속 진행하기 위해서는 별도의 장비가 필요한 문제점이 있다. 마크베이스는 이 문제를 해결하기 위해서 MOUNT 명령을 지원한다.
MOUNT명령은 데이터베이스가 서비스를 진행하면서도 백업된 데이터를 읽어들여서 현재 실행중인 데이터베이스와 별개로 새로운 데이터베이스를 생성한다. 하나의 서버에서 여러 개의 백업된 데이터베이스를 추가하여 동시에 데이터를 검색할 수 있으나, 마운트된 데이터베이스는 읽기 전용으로 데이터의 추가와 삭제는 불가능하다.
데이터베이스 MOUNT명령은 백업 데이터와 주 데이터베이스 내용을 동시에 읽을 수 있도록 한다. 따라서 마운트된 데이터베이스는 기존의 데이터 검색 방법과 동일하게 데이터를 검색할 수 있다.
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.
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:
Example:
SELECT column_name FROM mount_name.user_name.table_name;
SELECT * FROM mountdb.sys.backuptable;