This topic describes the preparations that you must make on the destination server before you restore a standalone Oracle database.

Overview

Add a backup gateway

Database Backup uses Database Gateway to restore backup databases to on-premises databases or databases in internal networks on third-party clouds. You must install a backup gateway on the destination server. For more information, see Add a backup gateway.
Note Database Gateway allows you to connect an on-premises database to a cloud service without the need to enable a local public port. Database Gateway is a database connection service for remote access to databases in internal networks. For more information, see What is Database Gateway?. If you want to restore a database to the original server that hosts the database, you can select the backup gateway that is used when the database is backed up.

Check the Oracle version of the source database

When you use Database Backup to restore an Oracle database, the version of Oracle on the destination server must be the same as the minor version of the source database.
Note For example, Oracle 11.2.0.4 is incompatible with Oracle 11.2.0.1, which can lead to errors when you restore data. We recommend that you deploy the same version of Oracle on both the source database and the destination server.
  • You can run the following command to query the Oracle version of the source database:
    root > su - oracle
    oracle> export ORACLE_SID=orcl;
    oracle>sqlplus / as sysdba
    sqlplus> select version from v$instance;
    The following output indicates that the Oracle version is 19.0.0.0.0:
    ====================
    VERSION
    -----------------
    19.0.0.0.0
    ====================
  • If the source database cannot reach the mount state, you can run the following command to query the Oracle version:
    root > su - oracle
    oracle> $ORACLE_HOME/OPatch/opatch lsinv -oh $ORACLE_HOME |grep ^"Oracle Database"

Create an Oracle SID

An Oracle system identifier (SID) must be unique on a server. You must create an Oracle SID.

In Oracle, databases that have the same name cannot run on the same server at the same time. You can run the following command to stop the destination database:
root> su - oracle
oracle> export ORACLE_SID=orcl;
oracle>sqlplus / as sysdba
sqlplus> shutdown abort;      /* Or run the shutdown immediate; command. */
sqlplus> exit;
You can run the following command to check whether the destination database is stopped:
root> ps -ef|grep pmon|grep orcl

If a response corresponding to the preceding command is returned, you can run the kill -9 command to stop the database.

Create a database restoration directory

Before you create a database restoration directory, you must obtain the size of the storage space that the source database occupies. To ensure that you have enough space for restoration, we recommend that you reserve at least 1.3 times the size of the original database or five to six times the size of the Database Backup full backup set for the database restoration directory. Data is compressed when it is being backed up by using Database Backup.
  • You can run the following command to query the size of the source database:
    root > su - oracle
    oracle> export ORACLE_SID=orcl;
    oracle>sqlplus / as sysdba
    sqlplus> select sum(bytes) from ( select bytes from v$datafile union all select bytes from v$tempfile union all select bytes*members bytes from v$log);
    The following output indicates that the size of the database is 4,904,189,952 bytes.
    =======================
    SUM(BYTES)
    ----------
    4904189952
    =======================
  • You can view the size of a full backup set in the Database Backup console. Specifically, you can click a backup schedule on the Backup Schedules page. In the left-side navigation pane of the Configure Task page, click Full Data. On the page that appears, view the size of the backup set. For more information, see Back up an Oracle database.
  1. Create a directory.
    root> mkdir -p /Oracle/data_bak
    For example, you can run the preceding command to create a directory named data_bak in the Oracle folder.
    Note If this directory already exists, make sure that it is empty to avoid overwriting data in the directory when Database Backup restores data.
  2. Grant permissions.
    1. You can run the following command to query the user group to which the $ORACLE_HOME/bin/Oracle file belongs:
      root> ls -alh $ORACLE_HOME/bin/oracle

      The following output indicates that the $ORACLE_HOME/bin/Oracle file belongs to the oracle:oinstall user group:

      ====================
      -rwsr-s--x 1 oracle oinstall 421M Mar 15 03:04 /opt/oracle/product/19c/dbhome_1/bin/oracle
      ====================
    2. You can run the following command to change the user group of the created directory:
      root> chown -R oracle:oinstall /oracle/data_bak

Obtain the database program directory

The database program directory is ORACLE_HOME path.
  1. Run the su - oracle command in cmd to log on to the Oracle database.
  2. Execute the echo ORACLE_HOME statement on the Oracle database to view the ORACLE_HOME path.
    The following output indicates that the ORACLE_HOME path is /opt/oracle/product/19c/dbhome_1:
    ====================
    /opt/oracle/product/19c/dbhome_1
    ====================