> ## 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.

> Documentação para UNDROP TABLE

# UNDROP TABLE

Cancela a exclusão da tabela.

A partir da versão 23.3 do ClickHouse, você pode recuperar uma tabela em um banco de dados `Atomic` com `UNDROP TABLE`
durante o período definido por [`database_atomic_delay_before_drop_table_sec`](/pt-BR/reference/settings/server-settings/settings/other#database_atomic_delay_before_drop_table_sec) (8 minutos por padrão) após emitir `DROP TABLE`.
As tabelas excluídas de bancos de dados `Atomic` são listadas em `system.dropped_tables`.

Para um banco de dados `Shared` no ClickHouse Cloud, esse período é controlado por [`database_shared_drop_table_delay_seconds`](/pt-BR/reference/settings/session-settings/database#database_shared_drop_table_delay_seconds), cujo padrão é 8 horas.
As tabelas excluídas de bancos de dados `Shared` não são listadas em `system.dropped_tables`.

Se você tiver uma visão materializada sem uma cláusula `TO` associada à tabela excluída, também precisará executar UNDROP na tabela interna dessa visão.

<Tip>
  Veja também [DROP TABLE](/pt-BR/reference/statements/drop)
</Tip>

Sintaxe:

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

**Exemplo**

```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:     
```
