How to Backup Views in TiDB Since the Dumpling Tool Does Not Backup Views by Default

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb的dumpling工具默认不备份视图,tidb中视图大家都是怎么备份的

| username: ablewang_xiaobo

【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】

| username: Raymond | Original post link

Will my dumper export the system database?

| username: Raymond | Original post link

You can try the TiDB DM tool to see if it can export the system database.

| username: ablewang_xiaobo | Original post link

I noticed that Dumpling doesn’t back up views. Do you all back up views separately?

| username: ddhe9527 | Original post link

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.

| username: ablewang_xiaobo | Original post link

Views need to be backed up using other tools. Backup tools do not back up views by default.

| username: cs58_dba | Original post link

I tried mydumper and it can export system databases, including mysql and sys, but it cannot export MySQL views, triggers, and stored procedures.

| username: Raymond | Original post link

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.

| username: cs58_dba | Original post link

# 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
| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.