执行以下语句,开始执行恢复任务。
语句如下:
-
恢复到指定时间戳
obclient> ALTER SYSTEM RESTORE dest_tenant_name FROM uri UNTIL TIME=timestamp WITH restore_option [DESCRIPTION description];
-
恢复到指定 SCN
obclient> ALTER SYSTEM RESTORE dest_tenant_name FROM uri UNTIL SCN=scn WITH restore_option [DESCRIPTION description];
-
恢复到最新位点
obclient> ALTER SYSTEM RESTORE dest_tenant_name FROM uri WITH restore_option [DESCRIPTION description];
其中 uri
需要分别指定数据备份路径和日志归档路径, UNTIL [TIME|SCN]
指用户指定的恢复终点,恢复到该位点为止,但不包括该位点。restore_option
支持指定 pool_list
、locality
、primary_zone
、kms_encrypt
,pool_list
为必选项,其余为可选项。 语句中各参数的详细说明请参见 RESTORE。
恢复示例如下:
-
NFS
-
从数据备份路径
file:///data/nfs/backup/data
与日志归档路径file:///data/nfs/backup/archive
恢复租户mysql
到指定时间戳2022-06-1 00:00:00
, 指定资源池为restore_pool
obclient> ALTER SYSTEM RESTORE mysql FROM 'file:///data/nfs/backup/data,file:///data/nfs/backup/archive' until TIME='2022-06-1 00:00:00' WITH 'pool_list=restore_pool';
-
从数据备份路径
file:///data/nfs/backup/data
与日志归档路径file:///data/nfs/backup/archive
恢复租户mysql
恢复到当前最新的归档位点, 指定资源池为restore_pool
obclient> ALTER SYSTEM RESTORE mysql FROM 'file:///data/nfs/backup/data,file:///data/nfs/backup/archive' WITH 'pool_list=restore_pool';
-
从数据备份路径
file:///data/nfs/backup/data
与日志归档路径file:///data/nfs/backup/archive
恢复租户mysql
到指定 scn1658285759724047000
, 指定资源池为restore_pool
obclient> ALTER SYSTEM RESTORE mysql FROM 'file:///data/nfs/backup/data,file:///data/nfs/backup/archive' until SCN='1658285759724047000' WITH 'pool_list=restore_pool';
-
从数据备份路径
file:///data/nfs/backup/data
与日志归档路径file:///data/nfs/backup/archive
恢复租户mysql
到指定时间戳2022-06-1 00:00:00
, 指定资源池为restore_pool
, 副本 Locality 为F@z1,F@z2,F@z3
。obclient> ALTER SYSTEM RESTORE mysql FROM 'file:///data/nfs/backup/data,file:///data/nfs/backup/archive' until TIME='2022-06-1 00:00:00' WITH 'pool_list=restore_pool&locality=F@z1,F@z2,F@z3';
-
从数据备份路径
file:///data/nfs/backup/data
与日志归档路径file:///data/nfs/backup/archive
恢复租户mysql
到指定时间戳2022-06-1 00:00:00
, 指定资源池为restore_pool
, 副本 Locality 为F@z1,F@z2,F@z3
, 并指定primary_zone
为z1
。obclient> ALTER SYSTEM RESTORE mysql FROM 'file:///data/nfs/backup/data,file:///data/nfs/backup/archive' until TIME='2022-06-1 00:00:00' WITH 'pool_list=restore_pool&locality=F@z1,F@z2,F@z3&primary_zone=z1';
-
-
OSS
除
url
参数有所变更外, 其余参数使用与NFS
一致。-
从 OSS 备份路径
oss://oceanbase-test-bucket/backup/data/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx
与 OSS 日志归档路径oss://oceanbase-test-bucket/backup/archive/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx
恢复租户mysql
到指定时间戳2022-06-1 00:00:00
, 指定资源池为restore_pool
。obclient> ALTER SYSTEM RESTORE mysql FROM 'oss://oceanbase-test-bucket/backup/data/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx,oss://oceanbase-test-bucket/backup/archive/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx' until TIME='2022-06-1 00:00:00' WITH 'pool_list=restore_pool';
-
发起恢复任务后,您可以通过视图查看恢复的进度和结果,具体操作请参见 查看恢复进度。