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, while an incremental backup backs up all new and modified macroblocks since the last full backup.
Limitations and considerations
Before initiating a data backup, ensure that the archive mode is enabled and the status of the archive task is
DOING.For more information about how to view the status of log archive tasks, see View the archive progress.
For more information about how to enable the archive mode, see ARCHIVELOG.
To perform an incremental data backup, ensure that a full data backup already exists. If you initiate an incremental backup without a full backup, the system will automatically convert the incremental backup into a full backup.
In scenarios where a low-version cluster is upgraded to a high-version cluster, even if a full backup has been performed on the low-version tenant, initiating an incremental backup in the high-version cluster will automatically convert the incremental backup into a full backup.
Privilege requirements
The operation must be performed by the root user of the sys tenant (root@sys) or the administrator of each tenant. Specifically:
- In MySQL mode, the default administrator is the
rootuser. - In Oracle mode, the default administrator is the
SYSuser.
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 | When you add the PLUS ARCHIVELOG keyword to the data backup, the system will back up the archive logs during the data backup process. A complete dataset containing the archive logs will be generated in the final backup directory. This dataset has the capability to restore data to the MIN_RESTORE_SCN point (the latest SCN that can be restored from the backup set) without relying on the archive logs. |
| tenant_name | Specifies the name of the tenant to be backed up. You can specify multiple tenant names separated by commas (,). If you want to back up all user tenants, execute the ALTER SYSTEM BACKUP [INCREMENTAL] DATABASE statement in the sys tenant.
NoticeOnly the |
| INCREMENTAL | Specifies an incremental backup. |
| desprition | Optional. Specifies the description for this operation. |
Examples
Assume that the current cluster has three tenants: sys, mysql_tenant, and oracle_tenant, and both mysql_tenant and oracle_tenant have completed the necessary preparations before initiating a data backup.
For the
systenant:Initiate a full data backup for all user tenants in the cluster.
obclient [oceanbase]> ALTER SYSTEM BACKUP DATABASE;After executing this statement, the system will initiate a full data backup for the
mysql_tenantandoracle_tenanttenants in the cluster.Initiate a full data backup for the
mysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM BACKUP TENANT = mysql_tenant;Initiate a full data backup for the
mysql_tenanttenant, including archive logs.obclient [oceanbase]> ALTER SYSTEM BACKUP TENANT = mysql_tenant PLUS ARCHIVELOG;After executing this statement, the system will generate a complete dataset containing archive logs in the data backup directory of the
mysql_tenanttenant. For community edition and standalone edition users, in a physical standby database scenario, you can use this dataset to create a standby tenant. For detailed operations on how to create a standby tenant using a dataset with archive logs, see Create a standby tenant using the BACKUP DATABASE PLUS ARCHIVELOG feature.Initiate an incremental data backup for all tenants in the cluster.
obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL DATABASE;After executing this statement, the system will initiate an incremental data backup for the
mysql_tenantandoracle_tenanttenants in the cluster.Initiate an incremental data backup for the
mysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL TENANT = mysql_tenant;
For user tenants:
Initiate a full data backup for the
mysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM BACKUP DATABASE;Initiate a full data backup for the
oracle_tenanttenant, including archive logs.obclient [SYS]> ALTER SYSTEM BACKUP DATABASE PLUS ARCHIVELOG;Initiate an incremental data backup for the
mysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM BACKUP INCREMENTAL DATABASE;
