目前 BR 恢复不支持重命名数据库名字,如果备份时有重复的数据库和表名,恢复时可能会出现 panic。
如果想要恢复一个指定的数据库或表,可以使用 br restore db 或 br restore table 子命令,并指定 --db 或 --table 参数。例如:
br restore db --pd “$ {PD_IP}:2379”
–db “test”
–storage “local://tmp/bk01”
br restore table --pd “$ {PD_IP}:2379”
–db “test”
–table “t1”
–storage “local://tmp/bk01”
这样可以避免恢复整个集群数据时可能出现的重名冲突。
如果想要在恢复后修改数据库或表的名字,可以使用 rename database 或 rename table 语句。例如:
rename database test to test_new;
rename table test.t1 to test.t2;