You can use the ALTER SYSTEM BACKUP statement to initiate data backup. Two data backup types are supported: full backup and incremental backup.
Full backup backs up all macroblocks. Incremental backup backs up all new and modified macroblocks on the basis of the previous full backup.
Limitations and considerations
Before you initiate data backup, make sure that ARCHIVELOG has been enabled and the archiving job is in the
DOINGstate.For more information about how to view the status of a log archiving job, see View the archiving progress.
For more information about the syntax for enabling ARCHIVELOG, see ARCHIVELOG.
Make sure that full data backup has been performed. By default, if you initiate incremental backup when no full data backup is available, the system converts the incremental backup job to a full backup job.
By default, if you directly initiate an incremental backup job without performing a full backup job after you upgrade a cluster to a later version (the current version), the system converts the incremental backup job to a full backup job, even if a full backup job has been performed for the tenant in the earlier version.
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 backup_action [DESCRIPTION [=] 'desprition'];
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 | Backs up archive logs during data backup. After this keyword is specified in the statement, a complete dataset with archive logs will be generated in the backup directory. You can directly use this dataset, without the need for archive logs, to restore the data of the tenant to the SCN specified by MIN_RESTORE_SCN, which is the latest restorable SCN of the backup set. |
| tenant_name | The name of the tenant whose data is to be backed up when you execute this statement in the sys tenant. You can specify multiple tenant names separated with commas (,). To initiate data backup for all user tenants, you can execute the ALTER SYSTEM BACKUP [INCREMENTAL] DATABASE statement in the sys tenant.
NoticeYou must use the |
| INCREMENTAL | Performs incremental backup. |
| desprition | Optional. The description of the operation. |
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.
sys tenant
Initiate full data backup for all user tenants in the cluster from the sys tenant.
obclient [oceanbase]> ALTER SYSTEM BACKUP DATABASE;After the statement is executed, the system initiates a full data backup job for the
mysql_tenantandoracle_tenanttenants in the cluster.Initiate full data backup for the
mysql_tenanttenant from the sys tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP TENANT = mysql_tenant;Initiate full backup that backs up both data and archive logs for the
mysql_tenanttenant from the sys tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP TENANT = mysql_tenant PLUS ARCHIVELOG;After the statement is executed, the system will generate a complete dataset that contains archive logs in the data backup path of the tenant. In OceanBase Database Community Edition or a standalone OceanBase database, you can use this dataset to create a standby tenant in a Physical Standby Database scenario. For more information about how to use a complete dataset that contains archive logs to create a standby tenant, see Create a standby tenant by using the BACKUP DATABASE PLUS ARCHIVELOG feature.
Initiate incremental data backup for all tenants in the cluster from the sys tenant.
obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL DATABASE;In this example, after the statement is executed, the system will initiate an incremental data backup job for the
mysql_tenantandoracle_tenanttenants in the cluster.Initiate incremental data backup for the
mysql_tenanttenant from the sys tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL TENANT = mysql_tenant;
User tenant
Initiate full data backup for the
mysql_tenanttenant from the current tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP DATABASE;Initiate full backup that backs up both data and archive logs for the
oracle_tenanttenant from the current tenant.obclient [SYS]> ALTER SYSTEM BACKUP DATABASE PLUS ARCHIVELOG;Initiate incremental data backup for the
mysql_tenanttenant from the current tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL DATABASE;