OceanBase logo

OceanBase

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

Product Overview
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

OceanBase

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

Product Overview
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

OceanBase Database

SQL - V4.1.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.1.0
    iconOceanBase Database
    SQL - V 4.1.0
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Create a standby tenant

    Last Updated:2023-08-01 06:02:28  Updated
    Share
    What is on this page
    Prerequisites
    Restore a standby tenant
    Change the recovery endpoint of the new standby tenant
    More information

    folded

    Share

    You can create a standby tenant only by using the physical restore feature. To create a standby tenant, perform the following two steps: restore the standby tenant by using data backups and archive logs, and then change the recovery endpoint of the standby tenant.

    Prerequisites

    A standby tenant can be restored only by using the data backups and archive logs of the primary tenant and another standby tenant. Therefore, you must make sure that the following requirements are met before you create a standby tenant:

    • To restore a standby tenant by using the data backups and archive logs of the primary tenant, make sure that:

      1. Archivelog is enabled for the primary tenant, and log archiving remains in the DOING state.

        For more information about how to enable archivelog, see Enable archivelog. For more information about how to view the log archiving status, see View the archiving progress.

        Notice

        To ensure that all logs during data backup are archived, you must enable archivelog for the primary tenant before you start data backup.

      2. The data backup feature is enabled for the primary tenant and a full backup operation has been completed for the primary tenant.

        For more information about how to initiate full backup of a tenant, see Initiate a data backup job.

    • To restore a standby tenant by using the data backups and archive logs of another standby tenant, make sure that:

      1. Archivelog is enabled for the source standby tenant, and log archiving remains in the DOING state.

        For more information about how to enable archivelog, see Enable archivelog. For more information about how to view the log archiving status, see View the archiving progress.

        Notice

        To ensure that all logs during data backup are archived, you must enable archivelog for the source standby tenant before you start data backup.

      2. The data backup feature is enabled for the source standby tenant and a full backup operation has been completed for the source standby tenant.

        For more information about how to initiate full backup of a tenant, see Initiate a data backup job.

    Restore a standby tenant

    1. Log on to the sys tenant of the cluster where you want to create a standby tenant.

    2. Execute the RESTORE statement to restore the standby tenant by using the data backups and archive logs of the sys tenant.

      Syntax:

      ALTER SYSTEM RESTORE standby_tenant_name FROM uri UNTIL TIME =timestamp WITH restore_option [DESCRIPTION description];
      

      The parameters are as follows:

      • standby_tenant_name: the name of the standby tenant to be restored.

      • uri: the path of data backups and the path of archive logs of the primary tenant or an existing standby tenant.

      • UNTIL TIME =timestamp: the recovery endpoint, which is the timestamp to which the standby tenant is restored. Join the parameter name and the value of timestamp with an equal sign ( =). The value of timestamp must be in the YYYY-MM-DD HH24:MI:SS.FF format, accurate to nanoseconds. For more information about to select timestamp, see Parameters related to physical restore.

      • In restore_option, you can specify pool_list, locality, primary_zone, and kms_encrypt. pool_list is required and the others are optional.

      Restore the restore_oracle_tenant tenant to the specified timestamp of 2022-11-11 15:04:23.825558 by using the logs archived in file:///data/1/nfs/backup//ob_backup_oracle_tenant/archive and the data backups stored in file:///data/1/nfs/backup//ob_backup_oracle_tenant/data. Set the resource pool to small_pool_2 and primary_zone to z1.

      Sample statement:

      ALTER SYSTEM RESTORE oracle_standby
        FROM 'file:///data/1/nfs/backup//ob_backup_oracle_tenant/archive,file:///data/1/nfs/backup//ob_backup_oracle_tenant/data' 
        UNTIL TIME='2022-11-11 15:04:23.825558' with 'pool_list=small_pool_2&primary_zone=z1';
      

      For more information about the RESTORE statement, see Parameters related to physical restore.

      You can query the oceanbase.CDB_OB_RESTORE_PROGRESS view for the restore progress. For more information, see Query the restore progress.

    Change the recovery endpoint of the new standby tenant

    The new standby tenant does not continuously synchronize the archive logs of the primary or source standby tenant. You must set the recovery endpoint of the new standby tenant by using the RECOVER statement.

    1. Log on to the database as the administrator of the new standby tenant or the sys tenant of the cluster where the new standby tenant resides.

    2. Execute the RECOVER statement to change the recovery endpoint of the standby tenant based on your actual business.

      • Restore to a specified timestamp

        ALTER SYSTEM RECOVER STANDBY [TENANT = tenant_name] UNTIL TIME='timestamp';
        

        You need to specify the name of the standby tenant by adding the TENANT = tenant_name parameter in the statement only if you execute the statement in the sys tenant. The timestamp parameter specifies the timestamp, in nanoseconds, to which the standby tenant is restored.

        After you execute this statement, the standby tenant is restored to the specified timestamp.

      • Restore to a specified SCN

        ALTER SYSTEM RECOVER STANDBY [TENANT = tenant_name] UNTIL SCN=scn;
        

        You need to specify the name of the standby tenant by adding the TENANT = tenant_name parameter in the statement only if you execute the statement in the sys tenant. The scn parameter specifies the system change number (SCN), which is a logical internal timestamp.

        After you execute this statement, the standby tenant is restored to the specified timestamp.

      • Restore to an infinite endpoint

        ALTER SYSTEM RECOVER STANDBY [TENANT = tenant_name] UNTIL UNLIMITED;
        

        You need to specify the name of the standby tenant by adding the TENANT = tenant_name parameter in the statement only if you execute the statement in the sys tenant. UNLIMITED indicates that the recovery endpoint is infinite.

        After you execute this statement, the standby tenant enters the continuous synchronization mode.

    More information

    Change the restore source of a standby tenant

    Previous topic

    Limitations
    Last

    Next topic

    Change the restore source of a standby tenant
    Next
    What is on this page
    Prerequisites
    Restore a standby tenant
    Change the recovery endpoint of the new standby tenant
    More information