Purpose
You can use this statement to configure a backup destination, namely, a data backup path, for a user tenant.
The backup and restore feature is not supported for the sys tenant and meta tenants. Therefore, you do not need to configure a backup destination for them.
Required privileges
You must execute this statement as the root user of the sys tenant (namely root@sys) or as the administrator of a user tenant.
- The default administrator is the
rootuser in MySQL mode. - The default administrator is the
SYSuser in Oracle mode.
Syntax
ALTER SYSTEM SET DATA_BACKUP_DEST = 'data_backup_path' [TENANT = tenant_name];
Parameters
| Parameter | Description |
|---|---|
| data_backup_path | The data backup path. OceanBase Database allows you to use Network File System (NFS), Alibaba Cloud Object Storage Service (OSS), Tencent Cloud Object Storage (COS), Amazon Simple Storage Service (S3), and object storage services that are compatible with the S3 protocol, such as Huawei Object Storage Service (OBS) and Google Cloud Storage (GCS), as the backup media. When you use OSS or COS as the backup media, you can use the delete_mode parameter behind the backup path to configure the backup file cleanup mode. Join the delete_mode parameter and the backup path with an ampersand (&). Valid values of delete_mode:
|
| tenant_name | The name of the tenant for which a backup destination is to be configured from the sys tenant.
NoticeYou must use the |
The following examples show how to configure data backup destinations in OceanBase Database when NFS, OSS, COS, and S3 are used as the backup media.
Parameter examples
Example of data_backup_path for NFS backup
ALTER SYSTEM SET DATA_BACKUP_DEST = 'nfs://your-nfs-server/your-backup-path' [TENANT = your-tenant-name];
data_backup_path consists of the following parts:
nfs://your-nfs-server/your-backup-path: the path of the NFS server accessible to OceanBase Database, which stores data backups.
Example of data_backup_path for OSS backup
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];
data_backup_path consists of the following parts:
oss://your-oss-bucket-name/your-backup-path: the name of the OSS bucket and the backup path, which stores data backups.host=oss-your-region.aliyuncs.com: the domain name used to access OSS.your-regionmust be replaced with the actual OSS region code.access_id=your-access-idandaccess_key=your-access-key: the AccessKey ID and AccessKey secret used for authentication.
Example of data_backup_path for COS backup
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];
data_backup_path consists of the following parts:
cos://your-cos-bucket-name/your-backup-path: the name of the COS bucket and the backup path, which stores data backups.host=cos.your-region.myqcloud.com: the domain name used to access COS.your-regionmust be replaced with the actual COS region code.access_id=your-access-idandaccess_key=your-access-key: the AccessKey ID and AccessKey secret used for authentication.appid=your-appid: the AppID of your Tencent Cloud account.
Example of data_backup_path for S3 backup
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];
data_backup_path consists of the following parts:
s3://your-s3-bucket-name/your-backup-path: the name of the S3 bucket and the backup path, which stores data backups.host=s3.your-region.amazonaws.com: the domain name used to access S3.your-regionmust be replaced with the actual AWS region code.access_id=your-access-idandaccess_key=your-access-key: the AccessKey ID and AccessKey secret for AWS.s3_region=your-s3-region: the region where the S3 bucket is deployed.
Examples
sys tenant
In the sys tenant, configure a backup destination for the
mysql_tenanttenant. Use NFS as the backup media.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'file:///data/nfs/backup/data' TENANT = mysql_tenant;In the sys tenant, configure a backup destination for the
mysql_tenanttenant. Use OSS as the backup media and set the backup file cleanup mode todelete.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;In the sys tenant, configure a backup destination for the
mysql_tenanttenant. Use COS as the backup media and set the backup file cleanup mode todelete.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;- Here,
appidindicates the AppID of your Tencent Cloud account.
- Here,
In the sys tenant, configure a backup destination for the
mysql_tenanttenant. Use S3 as the backup media and set the backup file cleanup mode totagging.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;Here,
s3_regionindicates the region where the S3 bucket is deployed.
User tenant
In the
mysql_tenanttenant, configure a backup destination for the current tenant. Use NFS as the backup media.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'file:///data/nfs/backup/data';In the
mysql_tenanttenant, configure a backup destination for the current tenant. Use OSS as the backup media and set the backup file cleanup mode todelete.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';In the
oracle_tenanttenant, configure a backup destination for the current tenant. Use COS as the backup media and set the backup file cleanup mode todelete.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';Here,
appidindicates the AppID of your Tencent Cloud account.In the
mysql_tenanttenant, configure a backup destination for the current tenant. Use S3 as the backup media and set the backup file cleanup mode totagging.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';Here,
s3_regionindicates the region where the S3 bucket is deployed.