02.Oracle/DataBase

오라클 - 실수로 Delete 후 commit 한 자료 복원하기

1010 2009. 4. 13. 13:18
반응형

작성일 : 2008.02.20 11:07



Oracle Commit 한 데이터 복구방법



C:\>sqlplus scott/tiger

SQL*Plus: Release 9.2.0.5.0 - Production on 토 Jan 26 01:09:34 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


다음에 접속됨:
Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production

SQL> select * from emp;


     EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM   DEPTNO
---------- ---------- --------- ---------- -------- ---------- ---------- ----------

         7369       SMITH     CLERK          7902 80/12/17           800                             20  

.

.

.

14 개의 행이 선택되었습니다.


SQL> delete from emp;

14 행이 삭제되었습니다.


SQL> commit;

커밋이 완료되었습니다.


// 실수로 Table Data를 삭제한 뒤 commit 명령 까지  실행 함.  (--);


SQL> select * from emp;


선택된 레코드가 없습니다.



SQL> insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)
    2     select empno, ename, job, mgr, hiredate, sal, comm, deptno
    3        from emp as of timestamp ( systimestamp - interval '10' minute) ;


14 개의 행이 만들어졌습니다.


SQL> select * from emp;


     EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM   DEPTNO
---------- ---------- --------- ---------- -------- ---------- ---------- ----------

         7369       SMITH     CLERK          7902 80/12/17           800                             20  

.

.

.

14 개의 행이 선택되었습니다.


SQL>


SQL> commit;

커밋이 완료되었습니다.



-- 실수로 삭제 한 데이터 복구 완료 .. (^^);