OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

Kubernetes operator for OceanBase

V2.3.1Community Edition

  • Overview
  • Quick start
  • Deploy
  • Upgrade
  • User guide
    • Cluster management
      • Manage clusters
      • Create a cluster
      • Zone management
        • Add zones to a cluster
        • Delete zones from a cluster
      • Server management
        • Add OBServer nodes to zones
        • Delete OBServer nodes from zones
      • Upgrade a cluster
      • Manage parameters
      • Update resources
      • Delete a cluster
    • Tenant management
      • Manage tenants
      • Create a tenant
      • Modify tenant
        • Manage resources
        • Manage replicas
        • Modify other parameters
      • Delete a tenant
      • Perform tenant O&M operations
    • High availability
      • High availability
      • Recover from node failure
      • Back up a tenant
      • Restore data from a backup
      • Physical standby tenant
      • Inter K8s cluster management
  • Configure
  • Appendix
    • Deploy OceanBase Database and web app in a Kubernetes cluster
    • FAQ
  • Changelog

Download PDF

Overview Quick start Deploy Upgrade Manage clusters Create a cluster Upgrade a cluster Manage parameters Update resources Delete a cluster Manage tenants Create a tenant Delete a tenant Perform tenant O&M operations High availability Recover from node failure Back up a tenant Restore data from a backup Physical standby tenant Inter K8s cluster management Configure Deploy OceanBase Database and web app in a Kubernetes cluster FAQ Changelog
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. Kubernetes operator for OceanBase
  3. V2.3.1
iconKubernetes operator for OceanBase
V 2.3.1Community Edition
Community Edition
  • V 2.3.1
  • V 2.3.0
  • V 2.2.0
  • V 2.1.2
  • V 2.1.1
  • V 2.1.0

Restore data from a backup

Last Updated:2025-11-28 06:07:04  Updated
share
What is on this page
Prerequisites
Configuration file for restoring data
Example
Initiate a data restore job
View the data restore status
Check whether the tenant is restored

folded

share

Explain

Data restoring is available in ob-operator 2.1.0 and later versions.

This topic describes how to restore data from a backup. OBTenant and OBTenantRestore resources are important to data restore from a backup. You must use parameters in the spec.source section in the configuration file of the OBTenant resource to specify the tenant restore source. When the specified parameters take effect, ob-operator creates the OBTenantRestore resources required to execute restore jobs.

Prerequisites

  • Data has been backed up and can be restored.

  • The cluster is running properly and the available resources are sufficient to create a recovery tenant.

  • If the restore source is a Network File System (NFS) volume, make sure that the volume mounted to the OceanBase cluster can be accessed.

Configuration file for restoring data

You can use the configuration file to define tenant resources required for restoring data:

apiVersion: oceanbase.oceanbase.com/v1alpha1  
kind: OBTenant  
metadata:  
  name: t1s
  # namespace: oceanbase
spec:
  obcluster: obcluster
  tenantName: t1s
  unitNum: 1
  tenantRole: STANDBY
  source:
    restore:
      bakDataSource:
        # type: "NFS"
        # path: "t1/dataBackup"
        type: "OSS"
        path: "oss://bucket/backup?host=oss-cn-hangzhou.aliyuncs.com"
        ossAccessSecret: "oss-access"
      archiveSource:
        # type: "NFS"
        # path: "t1/logArchive"
        type: "OSS"
        path: "oss://bucket/archive?host=oss-cn-hangzhou.aliyuncs.com"
        ossAccessSecret: "oss-access"
      until:
        unlimited: true
      replayLogUntil:
        unlimited: true
    tenant: t1
  fields: values

The parameters are described as follows:

  • tenantRole: the role of the tenant to be created. Valid values are PRIMARY and STANDBY, which represent the primary and standby tenants, respectively. The default value is PRIMARY. For more information about standby tenants and physical standby databases, see Physical standby database.
  • source: the source of tenant data.
    • restore: the source of the backup data for restore.
      • bakDataSource: the path to the source of the backup data for restore. The data restore source is the same as the data backup destination.
      • archiveSource: the path to the source of archived logs for restore. The log restore source is the same as the log archiving destination.
      • until: the checkpoint to which the data is to be restored.
        • unlimited: specifies whether to restore data to the latest checkpoint.
        • timestamp: the timestamp, in the YYYY-MM-DD HH:mm:ss format, to which you want to restore data. For example, 2023-11-10 09:00:00.
        • scn: the system change number (SCN) to which the data is restored.
      • replayLogUntil: the checkpoint to which the logs of the primary tenant are replayed after data restore. This parameter takes effect only if the standby tenant is restored and the unlimited parameter is not specified. You can specify this parameter as a supplement to the until parameter by using the same configuration method.
    • tenant: the name of the primary tenant. This parameter takes effect only if the standby tenant is restored.
  • The configuration of other parameters is the same as that of a normal tenant.

Example

Initiate a data restore job

Run the following command to restore data to a tenant.

kubectl apply -f tenant_restore.yaml

View the data restore status

  • Run the following command to view the status of the tenant to be restored.
kubectl get obtenants.oceanbase.oceanbase.com -n oceanbase

The command output is as follows:

NAME   STATUS      TENANTNAME   TENANTROLE   CLUSTERNAME   AGE
t1s    restoring   t1s          STANDBY      obcluster     27s
  • Run the following command to view the created tenant restore job.
kubectl get obtenantrestores.oceanbase.oceanbase.com -n oceanbase

The command output is as follows:

NAME          STATUS    AGE    TARGETTENANT   TARGETCLUSTER   RESTOREROLE   STATUSINDB
t1s-restore   RUNNING   113s   t1s            obcluster       STANDBY       WAIT_TENANT_RESTORE_FINISH
  • Run the following command to view details of the tenant restore job:
kubectl describe obtenantrestores.oceanbase.oceanbase.com -n oceanbase

The command output is as follows:

Name:         t1s-restore
Namespace:    oceanbase
Labels:       oceanbase.oceanbase.com/tenant-name=t1s
            ref-obcluster=obcluster
            ref-uid=b9317541-6566-4ac0-84fb-9a4c6fca03ba
Annotations:  <none>
API Version:  oceanbase.oceanbase.com/v1alpha1
Kind:         OBTenantRestore
Metadata:
Creation Timestamp:  2023-11-13T03:13:26Z
Generation:          1
Owner References:
  API Version:           oceanbase.oceanbase.com/v1alpha1
  Block Owner Deletion:  true
  Kind:                  OBTenant
  Name:                  t1s
  UID:                   b9317541-6566-4ac0-84fb-9a4c6fca03ba
Resource Version:        927784
UID:                     e439a060-9758-4074-a170-661d3e23a836
Spec:
Primary Tenant:  t1
Restore Option:  pool_list=pool_t1s_zone1&primary_zone=zone1;&locality=FULL{1}@zone1
Restore Role:    STANDBY
Source:
  Archive Source:
    Oss Access Secret:  oss-access
    Path:               oss://bucket/archive?host=oss-cn-hangzhou.aliyuncs.com
    Type:               OSS
  Bak Data Source:
    Oss Access Secret:  oss-access
    Path:               oss://bucket/backup?host=oss-cn-hangzhou.aliyuncs.com
    Type:               OSS
  Replay Log Until:
    Unlimited:  true
  Until:
    Unlimited:   true
Target Cluster:  obcluster
Target Tenant:   t1s
Status:
Restore Progress:
  backup_cluster_name:     obcluster
  backup_cluster_version:  
  backup_dest:             oss://bucket/backup?host=oss-cn-hangzhou.aliyuncs.com&access_id=xxx&access_key=yyy,oss://bucket/archive?host=oss-cn-hangzhou.aliyuncs.com&access_id=xxx&access_key=yyy
  backup_piece_list:       oss://bucket/archive/piece_d1005r10p10?host=oss-cn-hangzhou.aliyuncs.com&access_id=xxx&access_key=yyy
  backup_set_list:         oss://bucket/backup/backup_set_25_full?host=oss-cn-hangzhou.aliyuncs.com&access_id=xxx&access_key=yyy,oss://bucket/backup/backup_set_26_inc?host=oss-cn-hangzhou.aliyuncs.com&access_id=xxx&access_key=yyy
  backup_tenant_id:        1016
  backup_tenant_name:      t1
  Description:             
  finish_ls_count:         0
  finish_tablet_count:     0
  finish_timestamp:        
  job_id:                  5
  ls_count:                0
  restore_option:          pool_list=pool_t1s_zone1&primary_zone=zone1;&locality=FULL{1}@zone1
  restore_scn:             1697098764718466986
  restore_scn_display:     2023-10-12 16:19:24.718466
  restore_tenant_id:       1004
  restore_tenant_name:     t1s
  start_timestamp:         2023-11-13 11:13:46.220513
  Status:                  WAIT_TENANT_RESTORE_FINISH
  tablet_count:            0
  tenant_id:               1
Status:                    RUNNING
Events:                      <none>

Check whether the tenant is restored

  • Connect to the sys tenant.
mysql -h$(kubectl get pods -l ref-obcluster=test -o jsonpath='{.items[0].status.podIP}') -P2881 -uroot oceanbase -A -c
  • Check whether the target tenant is restored.
select * from DBA_OB_TENANTS;

Previous topic

Back up a tenant
Last

Next topic

Physical standby tenant
Next
What is on this page
Prerequisites
Configuration file for restoring data
Example
Initiate a data restore job
View the data restore status
Check whether the tenant is restored