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 (DBS) uses Database Gateway to restore databases that have been backed up at least once to on-premises databases or databases that are hosted 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 that are deployed on 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 DBS to restore an Oracle database, make sure that the version of Oracle on the destination server is 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. If the source database adopts one of the preceding versions and the destination server adopts the other, errors may occur 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 commands to query the Oracle version of the source database:
    su - oracle
    export ORACLE_SID=orcl;
    sqlplus / as sysdba
    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 commands to query the Oracle version:
    su - 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 commands to stop the destination database:
su - oracle
export ORACLE_SID=orcl;
sqlplus / as sysdba
shutdown abort;      /* You can also run the shutdown immediate; command.*/
exit;
You can run the following command to check whether the destination database is stopped:
ps -ef|grep pmon|grep orcl

If the output 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 source database or five to six times the size of the DBS full backup set for the database restoration directory. Data is compressed when DBS performs the backup operation.
  • You can run the following commands to query the size of the source database:
    su - oracle
    export ORACLE_SID=orcl;
    sqlplus / as sysdba
    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 the full backup set in the DBS console. Log on to the DBS console. In the left-side navigation pane, click Backup Schedules. On the Backup Schedules page, find the backup schedule of the source database and click backup schedule name. In the left-side navigation pane, choose Backup Tasks > Full Data. On the page that appears, you can view the size of the full backup set. For more information, see View backup plans.

  1. Create a directory.
    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 the directory is empty to avoid overwriting data in the directory when DBS 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:
      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:
      chown -R oracle:oinstall /oracle/data_bak

Obtain the database program directory

The database program directory is the path of ORACLE_HOME.
  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 path of ORACLE_HOME.
    The following output indicates that the path of ORACLE_HOME is /opt/oracle/product/19c/dbhome_1:
    ====================
    /opt/oracle/product/19c/dbhome_1
    ====================