【 使用环境 】测试环境
【 OB】
【 使用版本 】4.3.5.3
obclient(root@sys)[oceanbase]> \s
obclient Ver 2.2.10 Distrib 10.4.18-MariaDB, for Linux (x86_64) using readline 5.1
Connection id: 3221603975
Current database: oceanbase
Current user: root@192.168.207.18
SSL: Not in use
Current pager: stdout
Using outfile: ‘’
Using delimiter: ;
Server version: OceanBase 4.3.5.3 (r103040032025092501-bcea1d40bd48deb5da7b483709579d2f8ea84ee6) (Built Sep 25 2025 01:27:34)
Protocol version: 10
Connection: 192.168.207.18 via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
TCP port: 2881
Protocol: Compressed
Active --------------
【问题描述】参考文档4.4.1手动清理指定的备份或归档数据
https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000003977429
无法清理历史备份,执行命令报错,4.3.5上面不支持该功能吗?如果要手动清理,如何操作?
OBE-00900: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘BACKUPSET 1’ at line 1
和
ERROR 1235 (0A000): need to specify a tenant name not supported
`
[root@ob backup_sets]# obclient -h192.168.207.18 -ugistar@lnzyob -p’res#pwd’ -P2881
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221556778
Server version: OceanBase 4.3.5.3 (r103040032025092501-bcea1d40bd48deb5da7b483709579d2f8ea84ee6) (Built Sep 25 2025 01:27:34)
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]> select BACKUP_SET_ID,START_TIMESTAMP,END_TIMESTAMP,STATUS,PATH FROM SYS.DBA_OB_BACKUP_SET_FILES;
±--------------±--------------------±--------------------±--------±---------------------------+
| BACKUP_SET_ID | START_TIMESTAMP | END_TIMESTAMP | STATUS | PATH |
±--------------±--------------------±--------------------±--------±---------------------------+
| 1 | 2025-10-29 13:23:55 | 2025-10-29 14:18:50 | SUCCESS | file:///backup/lnzyob/data |
| 2 | 2025-11-10 10:42:02 | 2025-11-10 11:33:22 | SUCCESS | file:///backup/lnzyob/data |
| 3 | 2025-11-14 11:31:40 | 2025-11-14 12:19:21 | SUCCESS | file:///backup/lnzyob/data |
±--------------±--------------------±--------------------±--------±---------------------------+
3 rows in set (0.110 sec)
obclient(GISTAR@lnzyob)[GISTAR]> ALTER SYSTEM DELETE BACKUPSET 1;
OBE-00900: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘BACKUPSET 1’ at line 1
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]> ALTER SYSTEM DELETE BACKUPSET 1;
OBE-00900: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘BACKUPSET 1’ at line 1
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]> select BACKUP_SET_ID,START_TIMESTAMP,END_TIMESTAMP,STATUS,PATH FROM SYS.DBA_OB_BACKUP_SET_FILES;
±--------------±--------------------±--------------------±--------±---------------------------+
| BACKUP_SET_ID | START_TIMESTAMP | END_TIMESTAMP | STATUS | PATH |
±--------------±--------------------±--------------------±--------±---------------------------+
| 1 | 2025-10-29 13:23:55 | 2025-10-29 14:18:50 | SUCCESS | file:///backup/lnzyob/data |
| 2 | 2025-11-10 10:42:02 | 2025-11-10 11:33:22 | SUCCESS | file:///backup/lnzyob/data |
| 3 | 2025-11-14 11:31:40 | 2025-11-14 12:19:21 | SUCCESS | file:///backup/lnzyob/data |
±--------------±--------------------±--------------------±--------±---------------------------+
3 rows in set (0.004 sec)
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]> SELECT * FROM sys.DBA_OB_BACKUP_DELETE_POLICY;
±------------±----------------+
| POLICY_NAME | RECOVERY_WINDOW |
±------------±----------------+
| default | 7d |
±------------±----------------+
1 row in set (0.066 sec)
obclient(GISTAR@lnzyob)[GISTAR]> select BACKUP_SET_ID,START_TIMESTAMP,END_TIMESTAMP,STATUS,PATH FROM SYS.DBA_OB_BACKUP_SET_FILES;
±--------------±--------------------±--------------------±--------±---------------------------+
| BACKUP_SET_ID | START_TIMESTAMP | END_TIMESTAMP | STATUS | PATH |
±--------------±--------------------±--------------------±--------±---------------------------+
| 1 | 2025-10-29 13:23:55 | 2025-10-29 14:18:50 | SUCCESS | file:///backup/lnzyob/data |
| 2 | 2025-11-10 10:42:02 | 2025-11-10 11:33:22 | SUCCESS | file:///backup/lnzyob/data |
| 3 | 2025-11-14 11:31:40 | 2025-11-14 12:19:21 | SUCCESS | file:///backup/lnzyob/data |
±--------------±--------------------±--------------------±--------±---------------------------+
3 rows in set (0.031 sec)
obclient(GISTAR@lnzyob)[GISTAR]> ALTER SYSTEM DELETE BACKUPSET 1;
OBE-00900: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘BACKUPSET 1’ at line 1
obclient(GISTAR@lnzyob)[GISTAR]> ALTER SYSTEM DELETE BACKUPSET 1 TENANT = lnzyob;
OBE-00900: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘BACKUPSET 1 TENANT = lnzyob’ at line 1
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]>
obclient(GISTAR@lnzyob)[GISTAR]> exit
Bye
[root@ob backup_sets]# obclient -h192.168.207.18 -P2881 -uroot@sys -p’linux2025.’ -Doceanbase -A
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221603975
Server version: OceanBase 4.3.5.3 (r103040032025092501-bcea1d40bd48deb5da7b483709579d2f8ea84ee6) (Built Sep 25 2025 01:27:34)
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
obclient(root@sys)[oceanbase]>
obclient(root@sys)[oceanbase]> SELECT * FROM DBA_OB_BACKUP_DELETE_POLICY;
Empty set (0.006 sec)
obclient(root@sys)[oceanbase]> SELECT * FROM CDB_OB_BACKUP_DELETE_POLICY;
±----------±------------±----------------+
| TENANT_ID | POLICY_NAME | RECOVERY_WINDOW |
±----------±------------±----------------+
| 1002 | default | 7d |
±----------±------------±----------------+
1 row in set (0.019 sec)
obclient(root@sys)[oceanbase]>
obclient(root@sys)[oceanbase]> select BACKUP_SET_ID,START_TIMESTAMP,END_TIMESTAMP,STATUS,PATH FROM SYS.DBA_OB_BACKUP_SET_FILES;
ERROR 1146 (42S02): Table ‘SYS.DBA_OB_BACKUP_SET_FILES’ doesn’t exist
obclient(root@sys)[oceanbase]> select BACKUP_SET_ID,START_TIMESTAMP,END_TIMESTAMP,STATUS,PATH FROM CDB_OB_BACKUP_SET_FILES;
±--------------±---------------------------±---------------------------±--------±---------------------------+
| BACKUP_SET_ID | START_TIMESTAMP | END_TIMESTAMP | STATUS | PATH |
±--------------±---------------------------±---------------------------±--------±---------------------------+
| 1 | 2025-10-29 13:23:54.969878 | 2025-10-29 14:18:49.743895 | SUCCESS | file:///backup/lnzyob/data |
| 2 | 2025-11-10 10:42:01.799105 | 2025-11-10 11:33:21.944992 | SUCCESS | file:///backup/lnzyob/data |
| 3 | 2025-11-14 11:31:39.747239 | 2025-11-14 12:19:21.404765 | SUCCESS | file:///backup/lnzyob/data |
±--------------±---------------------------±---------------------------±--------±---------------------------+
3 rows in set (0.030 sec)
obclient(root@sys)[oceanbase]> select tenant_id,BACKUP_SET_ID,START_TIMESTAMP,END_TIMESTAMP,STATUS,PATH FROM CDB_OB_BACKUP_SET_FILES;
±----------±--------------±---------------------------±---------------------------±--------±---------------------------+
| tenant_id | BACKUP_SET_ID | START_TIMESTAMP | END_TIMESTAMP | STATUS | PATH |
±----------±--------------±---------------------------±---------------------------±--------±---------------------------+
| 1002 | 1 | 2025-10-29 13:23:54.969878 | 2025-10-29 14:18:49.743895 | SUCCESS | file:///backup/lnzyob/data |
| 1002 | 2 | 2025-11-10 10:42:01.799105 | 2025-11-10 11:33:21.944992 | SUCCESS | file:///backup/lnzyob/data |
| 1002 | 3 | 2025-11-14 11:31:39.747239 | 2025-11-14 12:19:21.404765 | SUCCESS | file:///backup/lnzyob/data |
±----------±--------------±---------------------------±---------------------------±--------±---------------------------+
3 rows in set (0.017 sec)
obclient(root@sys)[oceanbase]> SELECT TENANT_NAME,TENANT_ID FROM DBA_OB_TENANTS;
±------------±----------+
| TENANT_NAME | TENANT_ID |
±------------±----------+
| sys | 1 |
| META$1002 | 1001 |
| lnzyob | 1002 |
| META$1004 | 1003 |
| mysqlob | 1004 |
±------------±----------+
5 rows in set (0.005 sec)
obclient(root@sys)[oceanbase]> SELECT TENANT_NAME,TENANT_ID FROM DBA_OB_TENANTS where TENANT_ID=1002;
±------------±----------+
| TENANT_NAME | TENANT_ID |
±------------±----------+
| lnzyob | 1002 |
±------------±----------+
1 row in set (0.013 sec)
obclient(root@sys)[oceanbase]>
obclient(root@sys)[oceanbase]> ALTER SYSTEM DELETE BACKUPSET 1 TENANT = lnzyob;
ERROR 1235 (0A000): need to specify a tenant name not supported
obclient(root@sys)[oceanbase]>
`
