Description
This statement is used to configure the destination of log archive, and to enable and disable log archive mode. Both system and user tenants can perform log archive operations. For more information about how to perform log archive operations in OceanBase Database, see Manage Database > Backup and Restore.
Syntax
Configure the destination of log archive
/* Configure the destination of log archive for a specified tenant (excluding the sys tenant). */
ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=xxx [PIECE_SWITCH_INTERVAL=xxx] [BINDING=xxx]' TENANT = tenant_name;
/* Configure the destination of log archive for the current tenant. */
ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=xxx [PIECE_SWITCH_INTERVAL=xxx] [BINDING=xxx]';
Enable log archive mode
/* Enable log archive mode for all tenants in the cluster. */
ALTER SYSTEM ARCHIVELOG [TENANT = ALL];
/* Enable log archive mode for the specified tenant. */
ALTER SYSTEM ARCHIVELOG TENANT = tenant_name;
/* Enable log archive mode for the current tenant. */
ALTER SYSTEM ARCHIVELOG;
Disable log archive mode
/* Disable log archive mode for all tenants in the cluster. */
ALTER SYSTEM NOARCHIVELOG [TENANT = ALL];
/* Disable log archive mode for the specified tenant. */
ALTER SYSTEM NOARCHIVELOG TENANT = tenant_name;
/* Disable log archive mode for the current tenant. */
ALTER SYSTEM NOARCHIVELOG;
Parameters
| Parameter | Description |
|---|---|
| LOG_ARCHIVE_DEST | The destination of log archive. |
| LOCATION | The specified destination. |
| At present, OceanBase Database supports using NFS and Alibaba Cloud OSS as the destination of log archive. | |
| BINDING | The priority mode of log archive and business operations. Currently, Optional and Mandatory are supported. If not specified, the default value Optional applies.
|
| PIECE_SWITCH_INTERVAL | The cycle for switching pieces. The value range is [1d, 7d]. If not specified, the default value 1d applies. |
| tenant_name | The name of the tenant. |
Examples
Configure the destination of log archive for the
mysql_tenanttenant. The destination is an NFS server. User business operations take precedence. Apieceof logs is generated every other day.obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d' TENANT = mysql_tenant;Configure the destination of log archive for the
mysql_tenanttenant. The destination is an Alibaba Cloud OSS bucket. In addition, specify the log cleanup mode for the archive destination.obclient> 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;Enable log archive mode for the
mysql_tenanttenant.obclient> ALTER SYSTEM ARCHIVELOG TENANT = mysql_tenant;Disable log archive mode for the
mysql_tenanttenant.obclient> ALTER SYSTEM NOARCHIVELOG TENANT = mysql_tenant;