The ALTER SYSTEM BACKUP statement is used to initiate a data backup. Data backups include full backups and incremental backups.
A full backup backs up all macroblocks. An incremental backup, based on the previous full backup, backs up all newly added and modified macroblocks.
Limitations and considerations
Before initiating a data backup, ensure that the archiving mode is enabled and the
STATUSof the archiving task isDOING.For more information about how to view the status of a log archiving task, see View archiving progress.
For the syntax to enable archive mode, see ARCHIVELOG.
To perform an incremental data backup, you must have a full data backup available. If you initiate an incremental backup without a full backup, the system will automatically convert it into a full backup by default.
For scenarios where a cluster of an earlier version is upgraded to a cluster of the current version, even if a full backup was performed by the current tenant in the earlier version, when an incremental backup is directly initiated after the upgrade, the system will by default convert the incremental backup into a full backup.
Privilege requirements
This statement must be executed by the root user of the sys tenant (root@sys) or the administrator user of a user tenant (root user).
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 | Add to Data Backup PLUS ARCHIVELOG After the keywords, you can back up the archive logs during data backup. Ultimately, a complete dataset including the archive logs will be generated in the backup directory. Since this dataset is recoverable, you can use it to restore tenant data to the MIN_RESTORE_SCN point (the latest recoverable SCN of the backup set) without relying on the archive logs. |
| tenant_name | The system tenant specifies the name of the tenant to be backed up. Multiple tenant names can be specified, separated by commas (,). To specify all user tenants, execute the command under the system tenant. ALTER SYSTEM BACKUP [INCREMENTAL] DATABASE statement.
NoticeOnly the system tenant can specify the tenant to operate on using the |
| INCREMENTAL | Indicates an incremental backup. |
| desprition | Optional. Specifies the description of the operation. |
Examples
Assume that the current cluster has two tenants, namely sys and mysql_tenant, and that tenant mysql_tenant has completed all preparations before initiating a data backup.
System tenant
The system tenant initiates 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_tenanttenant in the cluster.The system tenant initiates a full data backup for the
mysql_tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP TENANT = mysql_tenant;The system tenant initiates a full data backup with archived logs for the
mysql_tenant,obclient [oceanbase]> ALTER SYSTEM BACKUP TENANT = mysql_tenant PLUS ARCHIVELOG;After the statement is executed, the system generates a complete dataset with archived logs in the data backup path of the tenant.
The system tenant initiates incremental data backup for all tenants in the cluster.
obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL DATABASE;In this example, after the statement is executed, the system initiates an incremental data backup for the
mysql_tenanttenant in the cluster.The system tenant initiates an incremental data backup for the
mysql_tenant.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL TENANT = mysql_tenant;
User tenant
The
mysql_tenanttenant initiates a full data backup for itself.obclient [oceanbase]> ALTER SYSTEM BACKUP DATABASE;The tenant
mysql_tenantinitiates an incremental data backup for itself.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL DATABASE;
References
Create a standby tenant by using the BACKUP DATABASE PLUS ARCHIVELOG feature