티스토리 뷰

DB Admin

180329 FLASHBACK DB 실습 1

쿵도리 2018. 3. 29. 15:38

<FLASHBACK DATABASE>



Flashback 실습을 하기 위해 망가뜨릴 계획



SYS@orcl>create user tflash identified by tflash; // 새로 유저를 만들고


User created.


SYS@orcl>grant connect, resource to tflash;  //권한도 주고


Grant succeeded.


SYS@orcl>conn tflash/tflash 

Connected.


TFLASH@orcl>create table ftest //로그인해서 테이블도 만들어 보고

  2  (a number);


Table created.


TFLASH@orcl>insert into ftest values(10); // 테이블에 값도 넣어보고


1 row created.


TFLASH@orcl>commit; //커밋!


Commit complete.


TFLASH@orcl>conn hr/hr     //hr로 들어가서

Connected.

HR@orcl>create table ftest2

  2  as select * from locations;   // 테이블도 만들고


Table created.


HR@orcl>drop table emp2;    //다른 테이블도 지워본다


Table dropped.


SYS@orcl>select current_scn from v$database;   //현재 내 SCN 확인


CURRENT_SCN

-----------

    1867596


SYS@orcl>drop user tflash cascade;     // 아까 만든 tflash 유저 지워보기


User dropped.



SYS@orcl>shutdown immediate;      // 스텝 1. shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@orcl>startup mount                // 스텝 2. 마운트상태까지만 열기

ORACLE instance started.


Total System Global Area  849530880 bytes

Fixed Size                  1339824 bytes

Variable Size             545263184 bytes

Database Buffers          297795584 bytes

Redo Buffers                5132288 bytes

Database mounted.


SYS@orcl>flashback database to timestamp           // 플래시백 명령어 사용

  2  to_timestamp('2018/03/29 15:20:00','yyyy/mm/dd hh24:mi:ss');


Flashback complete.     // 끝


불완전 복구와 비슷해서 그냥 못 열고 SYS@orcl>alter database open resetlogs; 이걸로 열어야 함


SYS@orcl>alter database open resetlogs;


Database altered.


SYS@orcl>conn tflash/tflash

Connected.

 지운 유저가 되살아남 (짝짝짝!)






공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함