19c dataguard 快速配置

1,数据库版本

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.11.0.0.0

2,主机信息

192.168.3.230 db01 #主

192.168.3.233 db02 #备

3,主 -开启归档模式

ALTER DATABASE FORCE LOGGING;

SHUTDOWN IMMEDIATE;

STARTUP MOUNT;

ALTER DATABASE ARCHIVELOG;

ALTER DATABASE OPEN;

4,tnsnames.ora 主,备都需要配置

cdb01 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.230)(PORT = 1521))

(CONNECT_DATA =

  (SERVER = DEDICATED)

  (SERVICE_NAME = cdb01)

)

)

sbcdb01 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.233)(PORT = 1521))

(CONNECT_DATA =

  (SERVER = DEDICATED)

  (SERVICE_NAME = sbcdb01)

)

)

5,DBCA to Create a Data Guard Standby

备数据库只需要安装软件既可以,监听不需要配置,dbca自动配置。

在备执行:

dbca -silent

-createDuplicateDB

-gdbName cdb01 #DB_NAME

-sid sbcdb01 #Standby SID

-sysPassword oracle

-primaryDBConnectionString 192.168.3.230:1521/cdb01

-createAsStandby -dbUniqueName sbcdb01 #db_unique_name

日志信息:

[oracle@db02 admin]$ dbca -silent -createDuplicateDB -gdbName cdb01 -sid sbcdb01 -sysPassword oracle -primaryDBConnectionString 192.168.3.230:1521/cdb01 -createAsStandby -dbUniqueName sbcdb01

Prepare for db operation

22% complete

Listener config step

44% complete

Auxiliary instance creation

67% complete

RMAN duplicate

89% complete

Post duplicate database operations

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/sbcdb01/sbcdb011.log" for further details.

6,开启同步

主:

alter system set LOG_ARCHIVE_DEST_2='service=sbcdb01 VALID_FOR=(online_logfiles,primary_role) DB_UNIQUE_NAME=sbcdb01';

alter system set log_archive_config='dg_config=(cdb01,sbcdb01)';

alter system set standby_file_management=auto;

备:

alter system set log_archive_config='dg_config=(cdb01,sbcdb01)';

alter system set standby_file_management=auto;

alter system set fal_server='cdb01';

alter database recover managed standby database using current logfile disconnect;

7,验证同步状态

主:创建pdb01.

SQL> create pluggable database pdb01

admin user admin identified by admin

file_name_convert = ('/pdbseed', '/pdb01');

Pluggable database created.

SQL> SQL> show pdbs;

CON_ID CON_NAME                       OPEN MODE  RESTRICTED

     2 PDB$SEED                       READ ONLY  NO

     3 PDB                            MOUNTED

     4 PDB01                          MOUNTED


备:pdb01已经同步完成。

[oracle@db02 admin]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu May 20 23:28:19 2021

Version 19.11.0.0.0

Copyright (c) 1982, 2020, Oracle. All rights reserved.

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.11.0.0.0

SQL> show pdbs;

CON_ID CON_NAME                       OPEN MODE  RESTRICTED

     2 PDB$SEED                       READ ONLY  NO

     3 PDB                            READ ONLY  NO

SQL> show pdbs;

CON_ID CON_NAME                       OPEN MODE  RESTRICTED

     2 PDB$SEED                       READ ONLY  NO

     3 PDB                            READ ONLY  NO

     4 PDB01                          MOUNTED




2021-05-20T23:28:46.531506+08:00

PR00 (PID:16461): Media Recovery Log /u01/app/19.3/dbs/arch1_53_1073060659.dbf

Recovery created pluggable database PDB01

Recovery copied files for tablespace SYSTEM

Recovery successfully copied file /data2/CDB01/pdb01/system01.dbf from /data2/CDB01/pdbseed/system01.dbf

PDB01(4):WARNING: File being created with same name as in

PDB01(4):primary. Existing file may be overwritten

PDB01(4):Recovery created file /data2/CDB01/pdb01/system01.dbf

PDB01(4):Successfully added datafile 35 to media recovery

PDB01(4):Datafile #35: '/data2/CDB01/pdb01/system01.dbf'

2021-05-20T23:28:48.972799+08:00

Recovery copied files for tablespace SYSAUX

Recovery successfully copied file /data2/CDB01/pdb01/sysaux01.dbf from /data2/CDB01/pdbseed/sysaux01.dbf

PDB01(4):WARNING: File being created with same name as in

PDB01(4):primary. Existing file may be overwritten

PDB01(4):Recovery created file /data2/CDB01/pdb01/sysaux01.dbf

PDB01(4):Successfully added datafile 36 to media recovery

PDB01(4):Datafile #36: '/data2/CDB01/pdb01/sysaux01.dbf'

Recovery copied files for tablespace UNDOTBS1

Recovery successfully copied file /data2/CDB01/pdb01/undotbs01.dbf from /data2/CDB01/pdbseed/undotbs01.dbf

PDB01(4):WARNING: File being created with same name as in

PDB01(4):primary. Existing file may be overwritten

PDB01(4):Recovery created file /data2/CDB01/pdb01/undotbs01.dbf

PDB01(4):Successfully added datafile 37 to media recovery

PDB01(4):Datafile #37: '/data2/CDB01/pdb01/undotbs01.dbf'

PR00 (PID:16461): Media Recovery Waiting for T-1.S-54 (in transit)

标签: none

评论已关闭