Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb的dumpling工具默认不备份视图,tidb中视图大家都是怎么备份的
【TiDB Usage Environment】Production Environment
【TiDB Version】v4.0.9
【Encountered Problem】The dumpling tool in TiDB does not back up views by default. How do you all back up views?
【Reproduction Path】What operations were performed that led to the problem
【Problem Phenomenon and Impact】
Will my dumper export the system database?
You can try the TiDB DM tool to see if it can export the system database.
I noticed that Dumpling doesn’t back up views. Do you all back up views separately?
By default, system tables are not backed up, so you can use --database or --tables-list to explicitly specify them. Actually, only the mysql database is worth backing up separately.
Views need to be backed up using other tools. Backup tools do not back up views by default.
I tried mydumper and it can export system databases, including mysql and sys, but it cannot export MySQL views, triggers, and stored procedures.
Do we need to add any parameters? For example, when using MySQL’s backup tool mysqldump to back up MySQL stored procedures and triggers, you need to add the -R parameter. You can check by using mydumper --help.
# Backup all databases, including triggers, events, stored procedures, and functions
mydumper -u root -p 123456 -o /mysql_backup/all/
mydumper -G -E -R --skip-tz-utc --complete-insert -h 100.64.101.81 -P 3307 -u root -p xxx -t 16 -o /tmp/riskdb -D -L /tmp/mydumper.log
# Full backup will include mysql, sys system databases, and other user-created databases
This topic was automatically closed 1 minute after the last reply. No new replies are allowed.