> For the complete documentation index, see [llms.txt](https://docs.tibero.com/tibero-manuals/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tibero.com/tibero-manuals/7.2.6.manuals/sql-reference-guide/data-definition-language/flashback-table.md).

# FLASHBACK TABLE

테이블을 특정 시점으로 되돌리거나 제거한 테이블을 복원합니다. 특정 시점으로 테이블을 복원할 경우, 복원할 테이블의 이름을 원래 테이블 이름과 다르게 지정해 복구 후에도 기존 테이블이 남아 있도록 합니다. 따라서 기존 테이블에 대해 다른 시점의 FLASHBACK TABLE을 다시 수행할 수 있습니다.

**FLASHBACK TABLE**은 특정 시점의 데이터만 복원하며, 테이블과 관련된 인덱스, 트리거, 제약조건은 복원되지 않습니다. 또한 초기화 파라미터 `UNDO_RETENTION` 시점까지 **FLASHBACK TABLE**이 가능하지만 `_TSN_TIME_MAP_SIZE`의 크기가 `UNDO_RETENTION`보다 같거나 커야 합니다. 이는 `$TB_SID.tip` 파일에서 옵션으로 값을 설정할 수 있습니다.

**FLASHBACK TABLE**은 DDL이 수행된 이전 시점으로는 사용할 수 없으며, 테이블 이외의 객체에는 수행되지 않습니다.

다음은 FLASHBACK TABLE이 불가능한 테이블입니다.

* 시스템 테이블
* 가상 테이블
* AQ 테이블
* 파티션 테이블
* Cluster에 속한 테이블
* TEMP 테이블
* External 테이블
* DB Link를 통해 조회할 수 있는 테이블

제거한 테이블을 복원할 경우에는 초기화 파라미터 `USE_RECYCLEBIN`을 `Y`로 설정해 `RECYCLEBIN` 기능을 사용해야 합니다. 단, 다음과 같은 경우에는 `USE_RECYCLEBIN`을 `Y`로 설정하더라도 `RECYCLEBIN`으로 객체가 들어가지 않아 **FLASHBACK TABLE**을 사용할 수 없습니다.

* TEMP 테이블을 DROP할 경우
* SYS 계정의 객체를 DROP할 경우
* **ALTER MOVE**한 경우의 원본 테이블

`RECYCLEBIN` 기능을 사용할 때 테이블을 제거하면 시스템이 테이블, 인덱스, 트리거, 제약조건의 이름을 새로 생성해 변경만 하고 실제로는 제거하지 않습니다. 단, 제거할 테이블과 관련된 외래 키 제약조건은 제거됩니다.

`RECYCLEBIN` 기능을 사용하면 테이블을 제거했을 때 `RECYCLEBIN` 뷰에 포함된 테이블을 복원할 수 있습니다. 테이블을 복원하면 테이블 이름은 이전 상태로 복구되거나 지정한 대로 변경되지만, 인덱스, 트리거, 제약조건의 이름은 원래 이름으로 복구되지 않습니다.

**FLASHBACK TABLE**의 세부 내용은 다음과 같습니다.

* **문법**

<div align="left"><figure><img src="https://content.gitbook.com/content/evqs7Ne3nMyXQFkBSQWR/blobs/IuVuJx3XsngWLEmMmPjC/image.png" alt=""><figcaption></figcaption></figure></div>

* **구성요소**

<table><thead><tr><th width="214.88885498046875">구성요소</th><th>설명</th></tr></thead><tbody><tr><td>schema</td><td><ul><li>복원할 테이블을 포함하고 있는 스키마의 이름</li><li>생략하면 현재 사용자의 스키마로 인식</li></ul></td></tr><tr><td>table_name</td><td><ul><li>복원할 테이블의 이름</li><li>테이블을 제거하기 전의 이름 또는 <code>RECYCLEBIN</code> 뷰를 참조하여 제거한 후 시스템이 변경한 이름으로 지정할 수 있음</li><li>단, 같은 이름의 테이블이 <code>RECYCLEBIN</code> 뷰에 여러 개가 존재하는 경우 원래 이름을 지정하면 가장 최근의 이름으로 사용됨</li></ul></td></tr><tr><td>TSN</td><td>특정 TSN으로 복원할 때 사용</td></tr><tr><td>TIMESTAMP</td><td>특정 TIMESTAMP로 복원할 때 사용</td></tr><tr><td>expression</td><td><ul><li><code>TSN</code>과 <code>TIMESTAMP</code> 구문으로 복원할 때 필요한 구문</li><li><code>TSN</code>의 경우 특정 시점의 TSN이며, <code>TIMESTAMP</code>의 경우 특정 시간을 의미하는 구문</li></ul></td></tr><tr><td>BEFORE DROP</td><td><ul><li>제거된 테이블을 복원</li><li><code>RENAME TO table_name</code>을 사용하지 않을 때는 생략할 수 있음</li></ul></td></tr><tr><td>RENAME TO table_name</td><td><ul><li>복원할 테이블의 이름을 원래 이름과 다르게 변경할 때 사용</li><li>특히 이전에 사용하던 이름을 다른 테이블이 사용하고 있는 경우에 필요</li></ul></td></tr></tbody></table>

* **예제**

다음은 **FLASHBACK TABLE**을 사용해 테이블을 복원하는 예입니다.

```
SQL> ALTER SYSTEM SET USE_RECYCLEBIN=Y;
System altered.

SQL> CREATE TABLE t (a NUMBER);
Table 'T' created.

SQL> INSERT INTO t VALUES (1);
1 row inserted.

SQL> COMMIT;
Commit completed.

SQL> SELECT * FROM t;
A
----------
1

1 row selected.

SQL> EXEC DBMS_LOCK.SLEEP(11);
PSM completed.

SQL> INSERT INTO t VALUES (2);
1 row inserted.

SQL> COMMIT;
Commit completed.

SQL> SELECT * FROM t;
A
----------
1
2

2 rows selected.

SQL> FLASHBACK TABLE t TO TIMESTAMP (SYSTIMESTAMP - INTERVAL '10' SECOND) RENAME TO t_timestamp;
Flashbacked.

SQL> SELECT * FROM t;
A
----------
1
2

2 rows selected.

SQL> SELECT * FROM t_timestamp;
A
----------
1

1 row selected.

SQL> DROP TABLE t;
Table 'T' dropped.

-- 삭제된 테이블 t를 t2라는 이름으로 복원
SQL> FLASHBACK TABLE t TO BEFORE DROP RENAME TO t2;
Flashbacked.

SQL> SELECT * FROM t2;
A
----------
1
2

2 rows selected.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tibero.com/tibero-manuals/7.2.6.manuals/sql-reference-guide/data-definition-language/flashback-table.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
