Description
The ALTER SYSTEM SET DATA_BACKUP_DEST statement configures a backup destination, which is the backup path, for a user tenant.
Backup and restore are not supported for the sys tenant and the meta tenant. Therefore, you do not need to configure a backup destination for these tenants.
Privilege requirements
You must perform this operation either as the root user of the sys tenant (root@sys), or as the administrator of the tenant. The default administrator is:
rootin MySQL modeSYSin Oracle mode
Syntax
ALTER SYSTEM SET DATA_BACKUP_DEST = 'data_backup_path' [TENANT = tenant_name];
Parameters
| Parameter | Description |
|---|---|
| data_backup_path | The backup path where data backups are stored. Currently, OceanBase Database supports backup to NFS, Alibaba Cloud OSS, Tencent Cloud COS, and Amazon S3. For more information, see the data_backup_path examples below.When using OSS, COS, or S3 as the backup media, you can specify the delete_mode parameter after the backup path to configure the file deletion mode for backup files that meet the deletion criteria. The delete_mode parameter is connected to the backup path with the & symbol. Currently, the delete_mode parameter supports the following two values:
|
| tenant_name | The name of the tenant to which the backup destination belongs. In the case of a system tenant, you must specify the TENANT = tenant_name clause in the command to indicate the tenant to be operated on. For more information, see the
|
Here are four examples of setting the data backup destination of OceanBase Database according to the preceding syntax, using NFS, Alibaba Cloud OSS (Object Storage Service), Tencent Cloud COS (Cloud Object Storage), and Amazon S3 (Simple Storage Service) respectively.
Examples of parameter definitions
Example of an NFS data_backup_path
ALTER SYSTEM SET DATA_BACKUP_DEST = 'nfs://your-nfs-server/your-backup-path' [TENANT = your-tenant-name];
The data_backup_path parameter specifies the path for storing backup data.
nfs://your-nfs-server/your-backup-path: the path of the NFS server that OceanBase Database can access to store data backups.
Alibaba Cloud OSS example:
ALTER SYSTEM SET DATA_BACKUP_DEST = 'oss://your-bucket-name/your-archive-path?host=oss-your-region.aliyuncs.com&access_id=your-access-id&access_key=your-access-key' [TENANT = your-tenant-name];
The data_backup_path parameter specifies the path where data backup files are stored.
Notice
When you use object storage as the backup media, the parameters in the object storage path are separated with &. Make sure that the parameters you enter contain only uppercase and lowercase English letters, numbers, /-_$+=, and wildcard characters. If you enter characters other than the preceding ones, the setup may fail.
oss://your-oss-bucket-name/your-backup-path: the URL of the bucket and backup path on Alibaba Cloud OSS for storing data backups.host=oss-your-region.aliyuncs.com: the domain name for accessing the Alibaba Cloud OSS service. Replaceyour-regionwith the actual region code of OSS.access_id=your-access-idandaccess_key=your-access-key: the access key ID and access key for authentication.
Tencent Cloud COS example:
ALTER SYSTEM SET DATA_BACKUP_DEST = 'cos://your-bucket-name/your-archive-path?host=cos.your-region.myqcloud.com&access_id=your-access-id&access_key=your-access-key&appid=your-appid' [TENANT = your-tenant-name];
The data_backup_path parameter specifies the path where the backup data is stored.
Notice
When you use object storage as the backup media, the parameters in the object storage path are separated with &. Make sure that the parameters you enter contain only uppercase and lowercase English letters, numbers, /-_$+=, and wildcard characters. If you enter characters other than the preceding ones, the setup may fail.
cos://your-cos-bucket-name/your-backup-path: the bucket and backup path on Tencent Cloud COS for storing data backups.host=cos.your-region.myqcloud.com: the domain name for accessing Tencent Cloud COS, whereyour-regionshould be replaced with the actual region code.access_id=your-access-idandaccess_key=your-access-key: the access ID and access key for authentication.appid=your-appid: the AppID of your Tencent Cloud account.
Amazon S3 example:
ALTER SYSTEM SET DATA_BACKUP_DEST = 's3://your-bucket-name/your-archive-path?host=s3.your-region.amazonaws.com&access_id=your-access-id&access_key=your-access-key&s3_region=your-s3-region' [TENANT = your-tenant-name];
The data_backup_path parameter specifies the path where the data backup files are stored.
Notice
When you use object storage as the backup media, the parameters in the object storage path are separated with &. Make sure that the parameters you enter contain only uppercase and lowercase English letters, numbers, /-_$+=, and wildcard characters. If you enter characters other than the preceding ones, the setup may fail.
s3://your-s3-bucket-name/your-backup-path: the Amazon S3 bucket and backup path where data backups are stored.
Examples
System tenant
The system tenant configures a backup destination for the
mysql_tenanttenant. The backup medium is NFS.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'file:///data/nfs/backup/data' TENANT = mysql_tenant;The system tenant configures a backup destination for the
mysql_tenanttenant. The backup medium is OSS. Thedeletecleanup mode is also configured for the backup files.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'oss://oceanbase-test-bucket/backup/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=delete' TENANT = mysql_tenant;The system tenant configures a backup destination for the
mysql_tenanttenant. The backup medium is COS. Thedeletecleanup mode is also configured for the backup files.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'cos://oceanbase-test-bucket/backup/?host=cos.ap-xxx.myqcloud.com/&access_id=xxx&access_key=xxx&appid=xxx&delete_mode=delete' TENANT = mysql_tenant;appidindicates the AppID of the Tencent cloud account. You need to replace it with the actual AppID.
The system tenant configures a backup destination for the
mysql_tenanttenant. The backup medium is S3. Thetaggingcleanup mode is also configured for the backup destination:obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test-bucket/backup/data?host=s3.<region>.amazonaws.com&access_id=xxx&access_key=xxx&s3_region=xxx&delete_mode=tagging' TENANT = mysql_tenant;s3_regionindicates the region where the S3 bucket is located.
User tenant
The
mysql_tenanttenant configures a backup destination for the current tenant. The backup medium is NFS.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'file:///data/nfs/backup/data';The
mysql_tenanttenant configures a backup destination for the current tenant. The backup medium is OSS. Thedeletecleanup mode is also configured for the backup files.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'oss://oceanbase-test-bucket/backup/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=delete';The
oracle_tenanttenant configures a backup destination for the current tenant. The backup medium is COS. Thedeletecleanup mode is also configured for the backup files.obclient [SYS]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'cos://oceanbase-test-bucket/backup/?host=cos.ap-xxx.myqcloud.com/&access_id=xxx&access_key=xxx&appid=xxx&delete_mode=delete';appidindicates the AppID of the Tencent cloud account. You need to replace it with the actual AppID.
The
mysql_tenanttenant configures a backup destination for the current tenant. The backup medium is S3. Thetaggingcleanup mode is also configured for the backup destination:obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test-bucket/backup/data?host=s3.<region>.amazonaws.com&access_id=xxx&access_key=xxx&s3_region=xxx&delete_mode=tagging';s3_regionindicates the region where the S3 bucket is located.