Purpose
You can use the ALTER SYSTEM SET LOG_ARCHIVE_DEST statement to configure an archive destination for a user tenant. You can configure an archive destination by using the LOCATION, BINDING, and PIECE_SWITCH_INTERVAL parameters.
Limitations and considerations
The backup and restore feature is not supported for the
systenant and meta tenants. Therefore, you do not need to configure an archive destination for them.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 other object storage services that are compatible with the S3 protocol, such as Huawei Object Storage Service (OBS) and Google Cloud Storage (GCS), as the archive media. Some backup media can be used only after certain basic requirements are met. For more information about backup media, see Introduction to physical backup and restore.
When you configure the
LOCATION,BINDING, andPIECE_SWITCH_INTERVALparameters, separate the parameters with spaces and do not leave spaces before and after the equal sign (=) that is used to join the parameter name and value.After you configure an archive destination, you must specify values for all parameters each time when you execute the
ALTER SYSTEM SET LOG_ARCHIVE_DESTstatement. Otherwise, the default value is used for a parameter for which no value is specified.
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.
- In MySQL mode, the default administrator is the
rootuser. - In Oracle mode, the default administrator is the
SYSuser.
Syntax
ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=archive_path [BINDING=archive_mode] [PIECE_SWITCH_INTERVAL=piece_switch_interval]' [TENANT = tenant_name];
Parameters
| Parameter | Description |
|---|---|
| archive_path | The archive path. OceanBase Database allows you to use NFS, Alibaba Cloud OSS, Tencent Cloud COS, Amazon S3, and other object storage services that are compatible with the S3 protocol, such as Huawei OBS and Google GCS, as the archive media. $des:// specifies the type of the archive media and is followed by the bucket name and path. The question mark (?) is used to separate other parameters of the path. host specifies the host address of the archive media, namely, the endpoint (without the bucket name) of the bucket. access_id and access_key specify the AccessKey pair of the archive media. appid is required when Tencent Cloud COS is used as the archive media and specifies the APPID of the Tencent Cloud account. Note that this parameter is not required if you specify to use Tencent Cloud COS through the S3 protocol. addressing_model is optional when an object storage service compatible with the S3 protocol is used as the archive media and specifies the URL of the object storage service. Valid values:
delete_mode is an optional parameter when Alibaba Cloud OSS or Tencent Cloud COS is used as the archive media, and specifies the cleanup mode of archive files. delete_mode is concatenated with the archive path by using an ampersand (&). Valid values:
|
| archive_mode | Optional. The prioritizing mode of archiving and business. This parameter has two values: Optional and Mandatory. If you do not specify this parameter, the default value Optional is used.
|
| piece_switch_interval | The interval for generating a new log piece. Value range: [1d, 7d]. If you do not specify this parameter, the default value 1d is used. For more information about pieces, see Overview. |
| tenant_name | The name of the tenant for which the archive destination is configured.
NoticeYou must use the |
Examples
systenantConfigure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an NFS path, and specify to prioritize user business and generate a new log piece every other day.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an OSS path and the archive file cleanup mode totagging.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=oss://oceanbase-test-bucket/backup/archive?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=tagging' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to a COS path and the archive file cleanup mode todelete, and specify to prioritize archiving and generate a new log piece every other two days.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST = 'LOCATION=cos://oceanbase-test-bucket/archive?host=cos.ap-xxx.myqcloud.com&access_id=xxx&access_key=xxx&appid=xxx&delete_mode=delete BINDING=Mandatory PIECE_SWITCH_INTERVAL=2d' TENANT = mysql_tenant;
User tenant
Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an NFS path, and specify to prioritize user business and generate a new log piece every other day.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an OSS path and the archive file cleanup mode totagging.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=oss://oceanbase-test-bucket/backup/archive?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=tagging';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to a COS path and the archive file cleanup mode todelete, and specify to prioritize archiving and generate a new log piece every other two days.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST = 'LOCATION=cos://oceanbase-test-bucket/archive?host=cos.ap-xxx.myqcloud.com&access_id=xxx&access_key=xxx&appid=xxx&delete_mode=delete BINDING=Mandatory PIECE_SWITCH_INTERVAL=2d';