Description
The ALTER SYSTEM SET DATA_BACKUP_DEST statement configures the destination for data backup of a user tenant, namely, the path where data backup is to be performed.
Limitations and considerations
System and meta tenants do not support backup and restore. Therefore, no need to configure a backup target for these tenants.
Currently, OceanBase Database supports backup to NFS, Alibaba Cloud OSS, Tencent Cloud COS, AWS S3, and object storage services compatible with the S3 protocol, such as Huawei Cloud OBS and Google Cloud Storage. Some backup media may have basic requirements. For more information, see the Backup media requirements section in Overview of physical backup and restore.
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. By default:
- In MySQL mode, the default administrator is the
rootuser. - In Oracle mode, the default administrator is the
SYSuser.
Syntax
ALTER SYSTEM SET DATA_BACKUP_DEST = 'data_backup_path' [TENANT = tenant_name];
Parameters
| Parameter | Description |
|---|---|
| data_backup_path | The path where data backups are stored. Currently, OceanBase Database supports NFS, Alibaba Cloud OSS, Tencent Cloud COS, Amazon S3, and object storage services compatible with the S3 protocol, such as Huawei Cloud OBS and Google Cloud Storage. When OSS or COS is used as the backup medium, you can specify the delete_mode parameter after the backup path to configure the file deletion mode for backups. 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.
NoticeOnly the system tenant needs to use the |
Here are four examples of how to set the data backup destination of OceanBase Database according to the preceding syntax pattern, 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 where the data backup file is stored.
nfs://your-nfs-server/your-backup-path: the path of the NFS server that OceanBase Database can access to store data backups.
Example: Alibaba Cloud OSS
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 medium, 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 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. You need to 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 data backup file is stored.
Notice
When you use object storage as the backup medium, the parameters of the object storage path are separated by &. 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 where data backups are stored.host=cos.your-region.myqcloud.com: the domain name for accessing Tencent Cloud COS, whereyour-regionneeds to 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 backup data is stored.
Notice
When you use object storage as the backup media, the parameters in the object storage path are separated with &. Please 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 URI of the Amazon S3 bucket and the backup path where data backups are stored.host=s3.your-region.amazonaws.com: the domain name of the Amazon S3 service. Replaceyour-regionwith the actual AWS region code.
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 files: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 files: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.