Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: TiDB如何对分区表的历史分区做备份恢复
We have many tables partitioned by day or month, and many historical partitions need to be backed up and deleted, then restored as needed by the application based on the specified date. How is partition backup and recovery generally handled in production for partitioned tables? Is it only possible to do logical exports using Dumpling, and is it true that you can’t specify partition names but have to filter them one by one using the WHERE condition?
You can switch data to a non-partitioned table through exchange, and br can back up the non-partitioned table.
Additionally, in dumpling, you can specify the SQL as SELECT * FROM ry.t1_partition
PARTITION (p202307).
Wouldn’t that work too?
There’s nothing inconvenient about using “where” in dumpling.
Create a script with regular variables.
Specifying a partition is also feasible: SELECT * FROM [table_name] PARTITION (******)
You can use scripts for backup.
Additional processing with scripts.
Thank you, I wrote a script to back up using Dumpling with specified partition SQL.
Okay, I’ll write the script myself, thanks.
Yes, that’s how it’s done.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.