> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-trino-dialect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> UNDROP TABLE のドキュメント

# UNDROP TABLE

テーブルの削除を取り消します。

ClickHouse バージョン 23.3 以降では、`DROP TABLE` の実行後、[`database_atomic_delay_before_drop_table_sec`](/ja/reference/settings/server-settings/settings/other#database_atomic_delay_before_drop_table_sec) で設定された期間中 (デフォルトでは 8 分) 、`Atomic` データベース内のテーブルを `UNDROP TABLE` で復元できます。
`Atomic` データベースから削除されたテーブルは `system.dropped_tables` に一覧表示されます。

ClickHouse Cloud の `Shared` データベースでは、この期間は [`database_shared_drop_table_delay_seconds`](/ja/reference/settings/session-settings/database#database_shared_drop_table_delay_seconds) で制御され、デフォルトは 8 時間です。
`Shared` データベースから削除されたテーブルは `system.dropped_tables` に一覧表示されません。

削除されたテーブルに、`TO` 句を持たない materialized view が関連付けられている場合は、その view の内部テーブルについても UNDROP する必要があります。

<Tip>
  [DROP TABLE](/ja/reference/statements/drop) も参照してください。
</Tip>

構文:

```sql theme={null}
UNDROP TABLE [db.]name [UUID '<uuid>'] [ON CLUSTER cluster]
```

**例**

```sql theme={null}
CREATE TABLE tab
(
    `id` UInt8
)
ENGINE = MergeTree
ORDER BY id;

DROP TABLE tab;

SELECT *
FROM system.dropped_tables
FORMAT Vertical;
```

```response theme={null}
Row 1:
──────
index:                 0
database:              default
table:                 tab
uuid:                  aa696a1a-1d70-4e60-a841-4c80827706cc
engine:                MergeTree
metadata_dropped_path: /var/lib/clickhouse/metadata_dropped/default.tab.aa696a1a-1d70-4e60-a841-4c80827706cc.sql
table_dropped_time:    2023-04-05 14:12:12

1 row in set. Elapsed: 0.001 sec. 
```

````sql theme={null}
UNDROP TABLE tab;

SELECT *
FROM system.dropped_tables
FORMAT Vertical;

```response
Ok.

0 rows in set. Elapsed: 0.001 sec. 
````

```sql theme={null}
DESCRIBE TABLE tab
FORMAT Vertical;
```

```response theme={null}
Row 1:
──────
name:               id
type:               UInt8
default_type:       
default_expression: 
comment:            
codec_expression:   
ttl_expression:     
```
