You can use this statement to initiate a data backup. OceanBase Database supports full backup and incremental backup.
A full backup backs up all macroblocks. An incremental backup backs up all macroblocks generated and modified since the last full backup.
Limitations and considerations
Before you initiate a data backup, make sure that the archive mode is enabled and
STATUSof the log archive job isDOING.For more information about how to view the status of a log archive job, see View the archiving progress.
For more information about the syntax for enabling the archive mode, see ARCHIVELOG.
Make sure that a full backup has been performed. If you initiate an incremental backup when no full backup is available, the system converts the incremental backup to a full backup by default.
If you directly initiate an incremental backup without performing a full backup after you upgrade a cluster to a later version (the current version), the system converts the incremental backup to a full backup by default, even if a full backup has been performed for the tenant in the earlier version.
Required privileges
Only the root user of the sys tenant (root@sys) or the administrator user of a user tenant can execute this statement.
- The default administrator user in MySQL mode is
root. - The default administrator user in Oracle mode is
SYS.
Syntax
ALTER SYSTEM backup_action [DESCRIPTION [=] 'description'];
backup_option:
BACKUP DATABASE [PLUS ARCHIVELOG]
| BACKUP TENANT [=] {tenant_name[, tenant_name]...} [PLUS ARCHIVELOG]
| BACKUP INCREMENTAL DATABASE
| BACKUP INCREMENTAL TENANT [=] {tenant_name[, tenant_name]...}
Parameters
| Parameter | Description |
|---|---|
| PLUS ARCHIVELOG | If you specify the PLUS ARCHIVELOG keyword, the archive logs are also backed up during data backup, and a complete data set with archive logs will be generated in the backup directory. You can use this data set to restore the tenant data to the latest SCN that supports restore specified by MIN_RESTORE_SCN. |
| tenant_name | The name of the tenant to be backed up. This parameter is used in the sys tenant. If you specify multiple tenants, separate the tenant names with commas (,). If you want to specify all user tenants, you must execute the ALTER SYSTEM BACKUP [INCREMENTAL] DATABASE statement in the sys tenant.
NoticeWhen you execute this statement in the |
| INCREMENTAL | Indicates an incremental backup. |
| description | The description of the operation. This parameter is optional. |
Examples
Assume that the current cluster contains three tenants: sys, mysql_tenant, and oracle_tenant, and that backup preparations have been completed for the mysql_tenant and oracle_tenant tenants.
systenantIn the
systenant, initiate a full data backup for all user tenants in the cluster.obclient [oceanbase]> ALTER SYSTEM BACKUP DATABASE;After the statement is executed, the system initiates a full data backup for the
mysql_tenantandoracle_tenanttenants.In the
systenant, initiate a full data backup for themysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM BACKUP TENANT = mysql_tenant;In the
systenant, initiate a full data backup that also backs up archive logs for themysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM BACKUP TENANT = mysql_tenant PLUS ARCHIVELOG;After the statement is executed, the system generates a complete data set with archive logs in the data backup path of the tenant. If you use OceanBase Database Community Edition or OceanBase Database in standalone mode, you can use this data set to create a standby tenant in the Physical Standby Database scenario. For more information, see Create a standby tenant by using the BACKUP DATABASE PLUS ARCHIVELOG feature.
In the
systenant, initiate an incremental data backup for all user tenants in the cluster.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL DATABASE;After the statement is executed, the system initiates an incremental data backup for the
mysql_tenantandoracle_tenanttenants.In the
systenant, initiate an incremental data backup for themysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL TENANT = mysql_tenant;
User tenant
In the
mysql_tenanttenant, initiate a full data backup for the current tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP DATABASE;In the
oracle_tenanttenant, initiate a full data backup that also backs up archive logs for the current tenant.obclient [SYS]> ALTER SYSTEM BACKUP DATABASE PLUS ARCHIVELOG;In the
mysql_tenanttenant, initiate an incremental data backup for the current tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL DATABASE;