Description
The ALTER SYSTEM SET LOG_ARCHIVE_DEST statement configures an archive destination for a user tenant. The parameters for configuring an archive destination include LOCATION, BINDING, and PIECE_SWITCH_INTERVAL.
Backup and restore are not supported for system and meta tenants, so these tenants do not need to configure archive destinations.
Limitations and considerations
When you configure the
LOCATION,BINDING, andPIECE_SWITCH_INTERVALparameters, separate them with spaces and do not add spaces around the equal sign (=).After an archive destination is configured, incremental configuration is not supported. That is, when you execute the
ALTER SYSTEM SET LOG_ARCHIVE_DESTstatement, you must specify all parameters. Otherwise, the default values will be used for the unspecified parameters.
Privilege requirements
You must use the root user of the sys tenant (root@sys) or the administrator of each tenant to perform the operation. By default:
- 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 path where the archive file is stored. Currently, OceanBase Database supports NFS, Alibaba Cloud OSS, and Tencent Cloud COS as archive media.
NoticeWhen using object storage as the archive media, separate the parameters in the object storage path with When using OSS or COS as the archive media, you can specify the delete_mode parameter after the archive path to configure the deletion mode of the archive file. The delete_mode parameter is separated from the archive path with the & symbol. The delete_mode parameter supports the following two values:
|
| archive_mode | The priority mode for configuring archiving and business. It is an optional parameter. Currently, Optional and Mandatory are supported. The default value is Optional.
|
| piece_switch_interval | The cycle period for switching pieces. It is an optional parameter and the value range is [1d, 7d]. The default value is 1d. For more information about pieces, see Overview of log archive. |
| tenant_name | The name of the tenant to which the specified tenant belongs.
NoticeOnly the system tenant needs to use the |
Examples
System tenant
The system tenant configures an archive destination for the
mysql_tenanttenant. The archive medium is NFS. The user business priority mode is adopted. A piece is generated 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;The system tenant configures an archive destination for the
mysql_tenanttenant. The archive medium is OSS. The cleanup mode of archive files istagging.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;The system tenant configures an archive destination for the
mysql_tenanttenant. The archive medium is COS. The cleanup mode of archive files isdelete. The archive priority mode is adopted. A piece is generated every other day.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
The
mysql_tenanttenant configures an archive destination for the current tenant. The archive medium is NFS. The user business priority mode is adopted. A piece is generated every other day.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d';The
mysql_tenanttenant configures an archive destination for the current tenant. The archive medium is OSS. The cleanup mode of archive files istagging.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';The
mysql_tenanttenant configures an archive destination for the current tenant. The archive medium is COS. The cleanup mode of archive files isdelete. The archive priority mode is adopted. A piece is generated every other day.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';