BR Recovery Supports Renaming Database Names

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

Original topic: BR恢复支持Rname DB名字

| username: kkpeter

I would like to ask how to operate BR to support renaming the DB name during recovery.

| username: 像风一样的男子 | Original post link

The metadata file backupmeta for backup data records the database name --db, so the data can only be restored to a database with the same name; otherwise, the restoration will fail. If you want to import to a database with a different name, you can use Dumpling for backup.

| username: kkpeter | Original post link

I know, dumpling is too slow.

| username: kkpeter | Original post link

I don’t know if modifying the db name in the backupmeta file is feasible.

| username: 像风一样的男子 | Original post link

That file is binary, right? It can’t be modified. Give it a try.

| username: Kongdom | Original post link

:thinking: Where did you see this? I didn’t see support for --new-db.
BR Command Line Manual

| username: ti-tiger | Original post link

Currently, BR restore does not support renaming database names. If there are duplicate database and table names during backup, a panic may occur during restoration.

If you want to restore a specific database or table, you can use the br restore db or br restore table subcommands and specify the --db or --table parameters. For example:

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"

This can avoid name conflicts that may occur when restoring the entire cluster data.

If you want to rename the database or table after restoration, you can use the rename database or rename table statements. For example:

rename database test to test_new;

rename table test.t1 to test.t2;
| username: 像风一样的男子 | Original post link

Did you all copy this from ChatGPT?? Where did rename database come from?

| username: 随缘天空 | Original post link

The br command line manual you provided also doesn’t mention --ratelimit and --log-file. Why don’t you give it a try? There’s no loss, it’s just providing you with a possible direction.

| username: Kongdom | Original post link

These two parameters mean this :yum: There is an explanation in the referenced link in the link.

| username: 随缘天空 | Original post link

The official documentation does have these two parameters, but I can’t find them in the “br command line manual” link you posted.

| username: Kongdom | Original post link

Note, BR recovery is to restore to a new cluster, so you can change your approach and think about how to modify the database name after recovery.

| username: kkpeter | Original post link

Are you kidding, bro?

| username: andone | Original post link

It can’t be modified, right?

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.