Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

UNDROP

يلغي إسقاط الجدول.

اعتبارًا من إصدار ClickHouse 23.3، يمكنك استعادة جدول في قاعدة بيانات Atomic باستخدام UNDROP TABLE خلال الفترة التي يحددها database_atomic_delay_before_drop_table_sec (8 دقائق افتراضيًا) بعد تنفيذ DROP TABLE. تُدرَج الجداول المُسقَطة من قواعد بيانات Atomic في system.dropped_tables.

بالنسبة إلى قاعدة بيانات Shared في ClickHouse Cloud، تتحكم database_shared_drop_table_delay_seconds في هذه الفترة بدلًا من ذلك، وتبلغ 8 ساعات افتراضيًا. لا تُدرَج الجداول المُسقَطة من قواعد بيانات Shared في system.dropped_tables.

إذا كان لديك عرض مادي من دون عبارة TO مرتبط بالجدول المُسقَط، فستحتاج أيضًا إلى تنفيذ UNDROP للجدول الداخلي لهذا العرض.

الصيغة:

UNDROP TABLE [db.]name [UUID '<uuid>'] [ON CLUSTER cluster]

مثال

CREATE TABLE tab
(
    `id` UInt8
)
ENGINE = MergeTree
ORDER BY id;

DROP TABLE tab;

SELECT *
FROM system.dropped_tables
FORMAT Vertical;
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.
UNDROP TABLE tab;

SELECT *
FROM system.dropped_tables
FORMAT Vertical;

```response
Ok.

0 rows in set. Elapsed: 0.001 sec.
DESCRIBE TABLE tab
FORMAT Vertical;
Row 1:
──────
name:               id
type:               UInt8
default_type:
default_expression:
comment:
codec_expression:
ttl_expression:

ذو صلة: DROP، DETACH، ATTACH

Navigation