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.
The backup and restore feature is not supported for the sys tenant and meta tenants. Therefore, you do not need to configure an archive destination for them.
Limitations and considerations
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.
- The default administrator is the
rootuser in MySQL mode. - The default administrator is the
SYSuser in Oracle mode.
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. At present, OceanBase Database supports Network File System (NFS), Alibaba Cloud Object Storage Service (OSS), and Tencent Cloud Object Storage (COS) as the storage media for log archiving. When you use OSS or COS as the storage media, you can configure the delete_mode parameter behind the archive path to specify the cleanup mode for archive files. The delete_mode parameter and archive path are joined by using an ampersand (&). Valid values of delete_mode:
|
| 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
sys tenant
Configure an archive destination for the
mysql_tenanttenant from the sys tenant. Set the storage media for log archiving to NFS, 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 the sys tenant. Set the storage media for log archiving to OSS 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 the sys tenant. Set the storage media for log archiving to COS and the archive file cleanup mode todelete, 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. Set the storage media for log archiving to NFS, 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. Set the storage media for log archiving to OSS 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. Set the storage media for log archiving to COS and the archive file cleanup mode todelete, 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';