dbca 创建ADG RAC 环境不适用

2024-01-01 07:30:20

APPLIES TO:

Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database - Enterprise Edition - Version 12.2.0.1 to 12.2.0.1 [Release 12.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.

GOAL

NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner

.


For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

Primary Database:
DB_NAME: Chicago
Primary host name :- exa503

Standby Database:
DB_UNIQUE_NAME: boston
standby hostname : exa504

Diskgroups used for both :- +DATAC1 and +RECOC1

Maximum Availability Architecture

The Maximum Availability Architecture (MAA) defines Oracle’s most comprehensive architecture for reducing downtime for scheduled outages as well as preventing, detecting and recovering from unscheduled outages. Real Application Clusters (RAC) and Oracle Data Guard are integral components of the Database MAA reference architectures and solutions.

More detailed information, such as a discussion of the purpose of MAA and the benefits it provides, can be found on the Oracle Technology Network (OTN) at?Maximum Availability Architecture (MAA) | Oracle

Purpose of this Document

The purpose of this document is to provide a step-by-step guide for creating a standby database using DBCA in an Oracle Database 12.2 environment integrating the MAA Oracle Data Guard configuration best practices. This paper assumes that the following conditions exist:

  1. A Primary?single instance?database utilizing ASM for data file storage
  2. The Primary database is in archive log mode
  3. Password and Spfile are stored in ASM.
  4. The target Standby host has all the required Oracle software installed and configured.
  5. The Standby target database storage will utilize ASM.
  6. The standby target resides in a separate system.
  7. If role separation is used in your environment set the environment based on the roles with oracle or grid. In our example The oracle user owns both grid and oracle software installations.

NOTE: The DBCA duplicate command in this release can only create a single instance standby database from single instance primary database. It does not support RAC or multitenant configurations.


Supported Versions

  • This document applies to Oracle Database Server versions 12.2.0.x or higher.?

Multiple Channels Consideration:

Performing a DBCA duplicate and using multiple channels on the primary node can significantly improve performance. If the Primary database is a RAC use multiple RMAN channels spread across the primary nodes. This utilizes more network interfaces for the data transfer.

Parallelize backups across all primary database nodes leveraging disk and network bandwidth as available. MAA best practice recommend using 8 channels minimum or 2 channels per node.

Use automatic load balancing to distribute RMAN channels among the allocated nodes. Analyze the impact on existing production databases and reduce the RMAN parallelism if necessary.

Make the following RMAN configuration changes at the primary database. Our example uses 4 preconfigured channels for RMAN to use during the standby creation step. These 4 channels will suffice for single node but can be increased if the server has additional capacity.

[oracle@exa503]$ rman target /
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4;

All of the examples illustrated in this document use the following naming:

Databases and Hosts Used in this example

Primary

Standby

Hosts

exa503

exa504

Database Unique Name

chicago

boston

Instance names

chicago

boston

SOLUTION

Steps to Duplicate the Primary Database

PRIMARY DATABASE

  1. Force Logging

    Database force logging is recommended as an MAA Data Guard best practice. To enable force logging, use the following command on the primary.
    ?

    [oracle@exa503]$ sqlplus / as sysdba

    SQL> alter database force logging;

  2. Create Standby Redo logs

    Create standby redo logs on the primary database that are the same size of the online redo logs. This will ensure that standby redo log files are automatically created at the standby during the DBCA duplication process and that standby redo log files are available on the current Primary after a role transition occurs in the future and the Primary becomes a standby.

    Oracle recommends having the same number of standby redo log files as there are online redo log files plus 1 extra for each thread. Our primary database has 3 online redo log files for single thread. We therefore need 4 Standby Redo Log per thread for total of 4 standby Redo logs files. As per MAA Best Practice we recommend to create only one member for standby redo log. For example:
    ?

    • Check existing redo log members and their sizes.

      ?

    [oracle@exa503]$ sqlplus / as sysdba
    ?


    SQL> select thread#,group#,bytes/1024/1024/1024 SIZE_IN_GB, status from v$log;

    THREAD# ????? GROUP# SIZE_IN_GB ?? STATUS

    ---------- ---------- -------------- ----------------

    ?1 ?????????? 1 ??????????? 4???????????? CURRENT

    ?1 ?????????? 2 ??????????? 4???????????? UNUSED

    ?1 ?????????? 3 ??????????? 4???????????? UNUSED

    ?
    • Create the Standby redo logs:
      ?

    [oracle@exa503]$ sqlplus / as sysdba

    SQL> alter database add standby logfile thread 1
    group 4 (‘+DATAC1’) ?size 4G,
    group 5 (‘+DATAC1’) ?size 4G,
    group 6 (‘+DATAC1’) ?size 4G;
    group 7 (‘+DATAC1’)? size 4G;

  3. Ensure archiving is set to Fast Recovery Area on the primary.

    [oracle@exa503]$ sqlplus / as sysdba

    SQL> alter system set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=chicago'

  4. Create net alias for primary and standby database.

    In tnsnames.ora file on the primary node

    In tnsnames.ora file on the standby node

    chicago =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS=(PROTOCOL= TCP)(HOST=exa503)(PORT=1521)))

    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = chicago)
    )
    )

    boston =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS=(PROTOCOL = TCP)(HOST=exa504) (PORT=1521)))

    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = boston)
    )
    )

    chicago_local_listener =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS=(PROTOCOL = TCP)(HOST=exa503)(PORT=1521))))

    chicago =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS=(PROTOCOL= TCP)(HOST=exa503)(PORT=1521)))

    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = chicago)
    )
    )

    boston =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS=(PROTOCOL = TCP)(HOST=exa504) (PORT=1521)))

    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = boston)
    )
    )

    boston_local_listener =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS=(PROTOCOL = TCP)(HOST=exa504)(PORT=1521))))




    STANDBY DATABASE
  5. On Standby site execute the DBCA duplicate command

    [oracle@exa504 ~]$ dbca -silent -createDuplicateDB -gdbName chicago -sid boston -sysPassword welcome1 -primaryDBConnectionString exa503:1521/chicago -createAsStandby -dbUniqueName boston –initParams db_create_file_dest=+DATAC1,db_recovery_file_dest=+RECOC1,local_listener=”boston_local_listener”

  6. Set the parameters and create the Broker configuration

    Modify the script below to your environment and save as PostCR.sql
    ?

    NOTE:?Flashback database is required to reinstate a failed primary after a failover role transition. Optionally enable flashback on both the primary and standby. The standby database can begin using flashback on execution of the PostCR script.

    ?

    [oracle@exa504 ~]$ cat PostCR.sql

    connect sys/welcome1 as sysdba

    alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=boston' scope=spfile;

    alter system set db_file_name_convert='+DATAC1/chicago','+DATAC1/boston' scope=spfile;

    alter system set log_file_name_convert='+RECOC1/chicago','+RECOC1/boston' scope=spfile;

    alter system set standby_file_management=auto scope=spfile;

    alter system set dg_broker_config_file1='+DATAC1/boston/dr1.dat' scope=spfile;

    alter system set dg_broker_config_file2='+RECOC1/boston/dr2.dat' scope=spfile;

    alter system set db_flashback_retention_target=120 scope=spfile;

    alter database flashback on;

    alter system set dg_broker_start=true scope=spfile;

    alter system set remote_listener='prmy-scan:1521' scope=spfile;

    shutdown immediate

    startup

    alter system register;

    connect sys/welcome1@chicago as sysdba

    alter system set standby_file_management=auto scope=both;

    alter system set dg_broker_config_file1='+DATAC1/chicago/dr1.dat' scope=both;=

    alter system set dg_broker_config_file2='+RECOC1/chicago/dr2.dat' scope=both;

    alter system set dg_broker_start=TRUE;

    host sleep 30

    host dgmgrl sys/welcome1@chicago "CREATE CONFIGURATION dgconfig AS PRIMARY DATABASE IS CHICAGO CONNECT IDENTIFIER IS CHICAGO";

    host sleep 30

    host dgmgrl sys/welcome1@chicago "ADD DATABASE BOSTON AS CONNECT IDENTIFIER IS BOSTON" ;

    host dgmgrl sys/welcome1@chicago "ENABLE CONFIGURATION"

    exit

  7. Execute the script PosrtCR.sql on the standby database. Set your oracle database environment on standby host.

    [oracle@exa504 ~]$ export ORACLE_HOME=/u01/app/12.2.0.1/dbhome_1
    [oracle@exa504 ~]$ export ORACLE_SID=boston
    [oracle@exa504 ~]$ export PATH=$ORACLE_HOME/bin:$PATH

    [oracle@exa504]$ sqlplus / as sysdba

    SQL> @PostCR.sql

  8. Validate the Broker configuration

    [oracle@exa504 ~]$dgmgrl sys/<password>

    DGMGRL> show configuration

    Configuration - dgconfig

    Protection Mode: MaxPerformance
    Members:
    chicago - Primary database
    boston - Physical standby database

    Fast-Start Failover: DISABLED

    Configuration Status:
    SUCCESS (status updated 58 seconds ago)

  9. Create the password file and spfile in ASM.

    [oracle@exa504 ~]$ export ORACLE_SID=+ASM1
    [oracle@exa504]$ export ORACLE_HOME=/u01/app/12.2.0.1/grid
    [oracle@exa504 ~]$ export PATH=$ORACLE_HOME/bin:$PATH

    [oracle@exa503]$asmcmd –p

    ASMCMD [+] > mkdir DATAC1/BOSTON/PASSWORD

    ASMCMD [+] > pwcopy /u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/orapwboston +DATAC1/BOSTON/PASSWORD/pwboston

    [oracle@exa504]$ rm /u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/orapwboston

    [oracle@exa504 ~]$ export ORACLE_HOME=/u01/app/12.2.0.1/dbhome_1
    [oracle@exa504 ~]$ export ORACLE_SID=boston
    [oracle@exa504 ~]$ export PATH=$ORACLE_HOME/bin:$PATH

    oracle@exa504]$ sqlplus / as sysdba

    SQL> create pfile='/tmp/b.ora' from spfile;

    SQL> create spfile='+DATAC1/BOSTON/spfileboston.ora' from pfile='/tmp/b.ora';

    [oracle@exa504]$ rm /u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/spfileboston.ora

  10. Create initboston.ora and shutdown database

    [oracle@exa504]$ echo “spfile='+DATAC1/BOSTON/spfileboston.ora'” > /u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/initboston.ora--- 这个指向文件有时候需要

    SQL> shutdown immediate
    SQL>exit

  11. Add the Physical standby database to the Oracle Restart configuration and start the database

    [oracle@exa504]$ srvctl add database -db boston -oraclehome /u01/app/oracle/product/12.2.0.1/dbhome_1 -dbtype Single -instance boston -node exa504-dbname chicago -diskgroup RECOC1,DATAC1 -role physical_standby -spfile '+DATAC1/BOSTON/spfileboston.ora' -pwfile '+DATAC1/BOSTON/PASSWORD/pwboston'

    [oracle@exa504]$ srvctl start database -db boston


This concludes building a single instance standby database from single instance primary database using DBCA.

文章来源:https://blog.csdn.net/jnrjian/article/details/135321634
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。