Oracle

Before configuring disaster recovery (DR) services, check the database environments of the production end and the DR end where Oracle databases reside, and the storage end environment. If the database environments do not meet requirements, modify database configurations.

Production End and DR End

The following configuration items must be checked and configured on databases at both the production and DR ends.

  1. If the host where the Oracle database resides runs Linux, check the disk mapping mode using udev.

    When udev is used to map disks, the restrictions on disk mapping modes are as follows:

    • Disks can only be mapped through disk partitioning.
    • When udev is used to map DATA and REDO disks, use udev disks to serve as the member disks of the DATA and REDO disk group.
    • The udev configuration rules at the production and DR ends must be in the 99-oracle-asmdevices.rules rule file (save path: /etc/udev/rules.d).

      Two mapping modes are available. The following uses SUSE 12SP5 (disks DATA and REDO involved) as an example to describe how to configure both mapping modes:

      • Naming disks
        KERNEL=="sd*",ENV{ID_SERIAL}=="3622334410055667711fc7ffd00000113",SYMLINK+="oracle/redo_102",OWNER="grid",GROUP="asmadmin",MODE="0660"
        KERNEL=="sd*",ENV{ID_SERIAL}=="3622334410055667711fc417d0000010f",SYMLINK+="oracle/data_101",OWNER="grid",GROUP="asmadmin",MODE="0660"

        The KERNEL parameter must be specified using wildcards (for example, KERNEL=="sd*1") and cannot be a fixed device partition name (for example: KERNEL="sda"). Otherwise, udev configuration rules cannot take effect.

  2. Check the authentication mode of the database.

    During the creation of the Oracle protected group, you can specify different authentication modes for different protected objects and RAC hosts. Currently, database authentication and operating system authentication are supported. Table 1 describes the configuration details.

    Table 1 Configuration requirements for authentication modes

    Authentication Mode

    Requirements

    Database authentication

    Authentication modes at the production and DR ends must be the same.

    In a cluster, authentication modes of all hosts must be the same.

    During protected group creation, authentication mode specified on the eReplication must be the same as that used by the database.

    Operating system authentication

    In an Oracle RAC cluster deployed on ASM, the operating system authentication must be enabled so that the cluster at the DR end can be started normally upon DR.

    For Oracle single-instance databases deployed on ASM, the following requirements must be met:

    • For Unix-like operating systems, operating system authentication must be enabled if the password files of Oracle databases are configured to save in the ASM disk group, operating system authentication must be enabled. Alternatively, you can save the password files on the local file system. if neither method is adopted, the recovery plan corresponding to the Oracle protected group cannot be executed for testing, planning migration, and fault recovery.

Production End

  1. Check the running mode of databases at the production end.

    The eReplication Agentless can ensure consistency between Oracle databases only when the databases are running in archive mode.

    • To configure the running mode of an Oracle database running a Linux operating system, perform the following steps:
      1. Run the sqlplus command to log in to the Oracle database. In the example provided here, the user name is sys, the password is oracle, and the instance name is verify.

        The following shows the command format and output:

        [oracle@rhcs218 ~]$ sqlplus /nolog 
         
        SQL*Plus: Release 11.2.0.3.0 - Production on Fri Jun 26 10:30:34 2020 
         
        Copyright (c) 1982, 2002, Oracle.  All rights reserved. 
         
        SQL> conn sys/oracle@verify as sysdba 
        Connected.
      2. Run the archive log list command to check whether the database is in archive mode.

        The following shows the command format and output:

        SQL> archive log list; 
        Database log mode             No Archive Mode 
        Automatic archival            Enabled 
        Archive destination           +REDO 
        Oldest online log sequence    75 
        Next log sequence to archive  76   
        Current log sequence          76     
        • If Database log mode is Archive Mode, the database is in archive mode.
        • If Database log mode is No Archive Mode, follow instructions in related Oracle database documents to change the operation mode to archive.
        • Archive destination must be in the disk group planned for the log synchronous replication DR solution.

  2. Check the database files at the production end.

    Check that the data files, log files, and control files of a database are stored on LUNs. If those files are not stored on LUNs, DR cannot be performed for the database. You are advised to store temporary tablespaces on the same LUN where data files, log files, or control files resides or store temporary tablespaces a LUN different from the LUNs where other database files are stored.

DR End

  1. Check the database environment on the DR end.

    If the database environments at the DR and production ends are different, modify the database environment at the DR end to be the same as that at the production end.

    Table 2 lists the environmental requirements of databases at the DR end.

    Table 2 Environmental requirements of databases at the DR end

    Check Item

    Requirements

    Oracle installation

    Oracle databases on the DR and production ends must run the same operating system and of the same version.

    Versions of Oracle databases on the DR and production ends must be the same.

    The installation location of Oracle databases on the DR end must be consistent with that on the production end.

    Database

    The database authentication modes on the DR and production ends must be the same.

    Names, user names, and passwords of Oracle databases on the DR and production ends must be the same.

    non-Windows operating system (file system)

    IDs and residing group IDs of Oracle users on the DR and production end must be the same.

    Oracle RAC

    scan name of SCAN-IP on the production end must be consistent with that on the production end.

  2. Set up database DR environment at the DR end.

    The following shows two methods to set up database DR environment after Oracle database software has been installed on DR hosts.

    Table 3 shows database directories in UNIX-like operating systems.

    Table 3 Oracle database directories in UNIX-like operating systems of hosts

    Operating System of the Host

    Root Directory of the Database

    Installation Directory of the Database

    Query Method

    UNIX-like operating system

    $ORACLE_BASE

    $ORACLE_HOME

    • Run the echo $ORACLE_BASE command to query the root directory of the Oracle database.
    • Run the echo $ORACLE_HOME command to query the installation directory of the Oracle database.
    • Method 1: Manually replicate necessary files from the production end to the DR end (suppose the database instance name is db001).

      To ensure the file permissions on the production and DR ends are the same, replicate necessary files from the Oracle user's directory on the production center to that at the DR end.

      1. Replicate db001-related files under the Oracle user-specified directory on the production center to the corresponding directory on the DR center.
        • In Windows, the specific directory is %ORACLE_HOME%\database.
        • In a Unix-like operating system, the specific directory is $ORACLE_HOME/dbs.
      2. Under the specific directory at the DR end, create folder db001. Under the created folder, create the directory structure according to that on the production end.
        • In Windows, the specific directory is %ORACLE_BASE%\ADMIN.
        • For Oracle 10g, create the alert_%SIDNAME%.ora file under the %ORACLE_BASE%\ADMIN\%DBName%\bdump directory.
        • For Oracle 11g or 12c, create level-2 directories under the %ORACLE_BASE%\diag\rdbms according to the directory structure on the production end, for example, %ORACLE_BASE%\diag\rdbms\level-1 directory\level-2 directory.
        • In a Unix-like operating system, the specific directory is $ORACLE_BASE/admin.
        • For Oracle 10g, create the alert_%SIDNAME%.ora file under the $ORACLE_BASE/admin/$dbName/bdump directory.
        • For Oracle 11g or 12c, create level-2 directories under the $ORACLE_BASE/admin/diag/rdbms according to the directory structure on the production end, for example, $ORACLE_BASE/diag/rdbms/level-1 directory/level-2 directory.
      3. If databases at the DR end are clustered, you need to run the following two commands to register the databases and instances.
        • srvctl add database -d {DATABASENAME} -o {ORACLE_HOME}
        • srvctl add instance -d {DATABASENAME} -i {INSTANCENAME} -n {HOSTNAME}

          DATABASENAME is the database name, ORACLE_HOME is the installation directory of the database, INSTANCENAME is the database instance name, and HOSTNAME is the name of the host where the database resides.

        • For versions earlier than 12C, if the DR end is in the RAC environment, run a command to shut down the cluster, including database instances and ASM instances. Then check whether database instances on each node in the cluster have been shut down and whether ASM instances have been shut down. The bonding of raw devices must be canceled.
        • For 12C and later versions, ensure that the Oracle cluster at the DR site is running properly. To periodically refresh host resources, run the srvctl command to query Oracle application information.
      4. You need to configure the pfile file in the following scenarios. For details about how to configure the file, see Oracle Configuration (Configuring the pfile file).
        • If there is an Oracle RAC at the production end but only a standalone Oracle database at the DR end, copy the pfile file of the Oracle database at the production end, after you have created databases at the DR end. And replace the cluster configuration information in the file with the information about the deployment mode of the standalone Oracle database at the DR end. Then use the copy of pfile to generate a spfile file and put the file on the local disk at the DR end.
        • If the save paths of the spfile files of both the production end and DR end are the same and the storage devices used by both spfile files are under DR protection (for example, the save paths of the spfile files of the production and DR ends are the same, and the spfile file and data files of the database are saved in the same ASM disk group), synchronizing data will cause the spfile file of the DR end to be overwritten by the spfile file of the production end. As a result, partial data of the DR end will be lost. In this manner, you are advised to save the spfile file of the DR end to the file system running on the DR host.
          • In Windows, the spfile file is under the %ORACLE_HOME%\database directory.
          • In a Unix-like operating system, the spfile file is under the $ORACLE_HOME/dbs directory.
    • Method 2: Create databases to generate files necessary for DR at the DR end, by performing the following steps at the DR end:
      1. Map empty LUNs to DR hosts and scan for mapped LUNs on DR hosts.
      2. If databases are installed on the file system at the production end, create a file system the same as the one at the production end, and mount the file system. If the production databases use ASM, create a ASM disk group the same as that at the production end.
      3. Create Oracle databases the same as those at the DR end.
      4. After databases are created, shut down them, and remove mapping relationships of file systems or ASM.
        • If databases use ASM, shut down ASM instances after you shut down the databases.
        • For versions earlier than 12C, if the DR end is in the RAC environment, run a command to shut down the cluster, including database instances and ASM instances. Then check whether database instances on each node in the cluster have been shut down and whether ASM instances have been shut down. The bonding of raw devices must be canceled.
        • For 12C and later versions, ensure that the Oracle cluster at the DR site is running properly. To periodically refresh host resources, run the srvctl command to query Oracle application information.
      5. Remove LUN mappings related to the database at the DR site.
      6. You need to configure the pfile file in the following scenarios. For details about how to configure the file, see Oracle Configuration (Configuring the pfile file).
        • If there is an Oracle RAC at the production end but only a standalone Oracle database at the DR end, copy the pfile file of the Oracle database at the production end, after you have created databases at the DR end. And replace the cluster configuration information in the file with the information about the deployment mode of the standalone Oracle database at the DR end. Then use the copy of pfile to generate a spfile file and put the file on the local disk at the DR end.
        • If the save paths of the spfile files of both the production end and DR end are the same and the storage devices used by both spfile files are under DR protection (for example, the save paths of the spfile files of the production and DR ends are the same, and the spfile file and data files of the database are saved in the same ASM disk group), synchronizing data will cause the spfile file of the DR end to be overwritten by the spfile file of the production end. As a result, partial data of the DR end will be lost. In this manner, you are advised to save the spfile file of the DR end to the file system running on the DR host.
          • In Windows, the spfile file is under the %ORACLE_HOME%\database directory.
          • In a Unix-like operating system, the spfile file is under the $ORACLE_HOME/dbs directory.
      7. After creating a database at the DR end, check the names of the spfile files at both the production and DR ends.

        If the names are not the same, change the name of the spfile file at the DR end to that at the production end or save the spfile file at the DR end to a local disk, in order to prevent the database at the DR end from being overwritten after DR. For details, see Configuring Oracle 12.2 (Configuring the spfile File).

Storage End

In the asynchronous replication (SAN) DR scenario, if multiple archive logs are configured for a database, at least one archive log must use storage resources that are configured with remote replication or consistency group. In addition, the consistency group must be a different one from that of data files, control files, and online log files.

Table 4 describes the storage requirements of disaster recovery solutions.

Table 4 Requirements of disaster recovery solutions on storage

Technology

Restriction and Requirement

Synchronous replication or asynchronous replication (SAN)

  • When DR is implemented based on storage array remote replication, consistency replication relationships must be set up between storage arrays used by applications.
    • If storage arrays are used for protection, remote replication relationships must be set up for LUNs used by applications and the status of remote replication must be normal.
    • If multiple LUNs are used, related remote replications must be added to one consistency group. If the database uses only one LUN, the LUN does not need to be added to a consistency group.
    • If the storage is T series V200R002 or later, or 18000 series, automatic host adding and storage mapping are provided. Ensure that the storage is connected to hosts' initiators normally. In this manner, the system can automatically create hosts, host groups, LUN groups, and mapping views on the storage.
    • If the DR storage is the S5000 series, T series V1, map the initiator of the physical DR host to the logical host of the DR storage. In a cluster, add the logical host to the host group.
    • If the DR storage is T series V2 or later or 18000 series, the DR host can belong to only one host group that belongs to only one mapping view. Moreover, the storage LUN used by protected applications and its corresponding remote replication secondary LUN must belong to one LUN group, and the LUN group must reside in the same mapping view as the host group.
    • If the storage is T series V200R001C00, deselect Enable Inband Command to change the mapping view attribute after the mapping view is created.
  • After the application environment is set up at the DR site, you need to unmap the test host at the DR site from the storage LUNs or volumes where the application data files, control files, and log files are located. The ADG DR host cannot be unmapd.
  • Check whether all file systems used by the Oracle database to be recovered are unmounted from the DR host.
  • On DeviceManager, check that secondary LUNs corresponding to remote replication used by production databases are not mapped to any host, host group, or mapping view.

Copyright © Huawei Technologies Co., Ltd.