OS: Windows 2000 Advanced Server DBMS: Oracle9i Enterprise Edition Release 9.2.0.1.0 작성자: 강명규(kang@dbakorea.pe.kr)
이 기능은 9i부터 사용가능하다. 지금 설명할 내용을 간단히 말하면, FTP의 이어받기 기능과 유사하다고 생각하면 쉬울 것이다.
데이터를 insert, update하는 large, long-running 작업이 있다고 하자. 이 작업이 완료되기 전에 리소스(디스크공간, ..)의 부족현상이 발생했다. long-running작업이 성공적으로 완료되지 못한다면, 문제의 원인을 해결하고나서 재수행해야 할 것이다. 이는 time-consuming작업일뿐 아니라, 아주 짜증나는 일이다. 하지만, 9i부터는 작업의 suspend/resume이 가능하다. 이 놈은 완료되지 못한 작업(트랜잭션)이 문제원인을 제거하고 나면, 처음부터 다시해야 하는것이 아닌 중단된 지점부터 수행된다는 것을 의미한다.
For using the RESUME mode we have do the following;
1. Issue 'GRANT RESUMABLE TO <user>'.
2. Issue 'ALTER SESSION ENABLE RESUMABLE TIMEOUT <seconds>'
Alternatively for disabling RESUME mode;
1. Issue 'REVOKE RESUMABLE TO <user>'.
2. Issue 'ALTER SESSION DISABLE RESUMABLE'
[사용된 SQL문] -- 테스트를 위한 테이블스페이스 생성 create tablespace ts_resume datafile 'c:oracleoradatawin912db s_resume01.dbf' size 1m;
-- 테스트를 위한 테이블 생성 create table syscatalog_clone tablespace ts_resume as select * from syscatalog where 1=2;
-- resumable을 활성화 alter session enable resumable timeout 60 name 'Problem with tablespace: ts_resume';
생성된 테이블스페이스보다 더 큰 데이터를 테이블에 insert해봄(에러남) insert into syscatalog_clone (select * from syscatalog);
테이블스페이스에 용량을 추가하여 insert작업이 계속 수행되도록 함. alter tablespace ts_resume add datafile 'c:oracleoradatawin912db s_resume02.dbf' size 10m;
[실습예] SQL> create tablespace ts_resume 2 datafile 'c:oracleoradatawin912db s_resume01.dbf' size 1m;
테이블 영역이 생성되었습니다.
SQL> create table syscatalog?clone 2 tablespace ts_resume 3 as 4 select * from syscatalog where 1=2;
테이블이 생성되었습니다.
세션을 resumable하게 변경하자. 문제 발생시 60초내에 해결하도록 했다. 60초경과시 트랜잭션은 자동으로 rollback된다. name이후에 지정한 문자열은 alert.log에 기록될 내용으로 자신의 취향에 맞게 적당히 써넣으면 되겠다. SQL> alter session enable resumable 2 timeout 60 name 'Problem with tablespace: ts_resume';
세션이 변경되었습니다.
SQL> insert into syscatalog_clone (select * from syscatalog);
9796 개의 행이 만들어졌습니다.
2번째 insert에서는 테이블스페이스의 공간이 모자라 insert할 수 없고, 60초이후 실패한다. SQL> insert into syscatalog_clone (select * from syscatalog); insert into syscatalog_clone (select * from syscatalog) * 1행에 오류: ORA-30032: 일시 중지된(재시작 가능한) 명령문이 시간 초과되었음 ORA-01653: SYSTEM.SYSCATALOG_CLONE 테이블을 8(으)로 TS_RESUME 테이블스페이스에서 확장할 수 없습니다
alert.log파일에는 다음과 같이 메시지가 기록된다. 우리가 alter session의 name에서 지정한 문자열(Problem with...)가 기록되어 있음을 유의해서 보도록하자. 아무튼, 여기서는 60초내에 문제해결을 하지 못해 timeout되었음(rollback처리)을 보여주고 있다. [alert.log]파일의 내용 - C:oracleadminwin912dbdumpalert_win912db.log Wed Mar 05 17:17:04 2003 statement in resumable session 'Problem with tablespace: ts_resume' was suspended due to ORA-01653: SYSTEM.SYSCATALOG_CLONE 테이블을 8(으)로 TS_RESUME 테이블스페이스에서 확장할 수 없습니다 Wed Mar 05 17:18:06 2003 statement in resumable session 'Problem with tablespace: ts_resume' was timed out
timeout을 30분으로 설정하여 위의 insert를 다시 수행해보자. SQL> alter session enable resumable 2 timeout 1800 name 'Problem with tablespace: ts_resume';
세션이 변경되었습니다.
SQL> insert into syscatalog_clone (select * from syscatalog); suspend 상태...
우리에게 문제해결을 위한 30분의 여유가 있다. 위의 insert문장은 30분동안 해결하지 못하면 실패한다. 해결을 위해 테이블스페이스를 늘여줄 것이다. 여기서는 테이블스페이스에 데이터파일을 추가하여 해결할 것이다. [alert.log]파일의 내용 - C:oracleadminwin912dbdumpalert_win912db.log Wed Mar 05 17:41:12 2003 statement in resumable session 'Problem with tablespace: ts_resume' was suspended due to ORA-01653: SYSTEM.SYSCATALOG_CLONE 테이블을 8(으)로 TS_RESUME 테이블스페이스에서 확장할 수 없습니다
SQL> alter tablespace ts_resume 2 add datafile 'c:oracleoradatawin912db s_resume02.dbf' size 10m;
테이블 영역이 변경되었습니다.
[alert.log]파일의 내용 - C:oracleadminwin912dbdumpalert_win912db.log Wed Mar 05 17:41:53 2003 alter tablespace ts_resume add datafile 'c:oracleoradatawin912db s_resume02.dbf' size 10m Wed Mar 05 17:41:54 2003 Completed: alter tablespace ts_resume add datafile 'c:oracle Wed Mar 05 17:41:55 2003 statement in resumable session 'Problem with tablespace: ts_resume' was resumed
insert 문장이 계속하여 수행된다. SQL> insert into syscatalog_clone (select * from syscatalog);
9796 개의 행이 만들어졌습니다.
dba_resumeable뷰를 통해 진행과정을 파악할 수 있다. SQL> SELECT SQL_TEXT, START_TIME,RESUME_TIME FROM DBA_RESUMABLE;
SQL_TEXT START_TIME RESUME_TIME ------------------------------------------------------------ -------------------- ------------------ SELECT SQL_TEXT, START_TIME,RESUME_TIME FROM DBA_RESUMABLE 03/05/03 17:17:00 03/05/03 17:41:54
원본: Using Resume Operation in Oracle 9i ( http://dbasupport.com/oracle/ora9i/ResumeOperation.shtml )
| This article comes from dbakorea.pe.kr (Leave this line as is)
|