Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Construction of Oracle 19c Data Guard physical Reserve Library

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Deployment goal

Set up

Deployment goal

Introduction to deployment environment

Operation steps

(1)。 Check the main library archive and additional log configuration. The following output shows that archive mode is enabled but additional logs are not enabled.

[oracle@sdedu ~] $sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0-Production on Thu Mar 7 20:04:29 2019

Version 19.2.0.0.0

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

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0-Production

Version 19.2.0.0.0

SQL > select log_mode,force_logging from v$database

LOG_MODE FORCE_LOGGING

ARCHIVELOG NO

(2)。 Looking at the main library archive destination, you can see from the following results that the archive destination uses a fast recovery area

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 1

Next log sequence to archive 3

Current log sequence 3

(3)。 Open the attached log of the main database, and verify the result of opening it.

SQL > alter database force logging

Database altered.

SQL > select log_mode,force_logging from v$database

LOG_MODE FORCE_LOGGING

-

ARCHIVELOG YES

Starting with Oracle Database 18c, the following two new nologging clauses are introduced, which can perform non-logging operations while making the Active Data Guard standby database receive all the data, thus preventing performance degradation caused by generating a large number of redo logs in FORCE mode.

The STANDBY NOLOGGING FOR DATA AVAILABILITY mode allows the bulk load operation to send loaded data to each standby database through its own connection to the standby database. The submission is delayed until all Active Data Guard standby databases apply the data through recover.

SQL > alter database set standby nologging for data availability

Database altered.

SQL > select log_mode,force_logging from v$database

LOG_MODE FORCE_LOGGING

NOARCHIVELOG STANDBY NOLOGGING FOR DATA AVAILABILITY

The STANDBY NOLOGGING FOR LOAD PERFORMANCE pattern is similar to the previous one, except that if the network cannot keep up with the speed at which the data is loaded into the primary database, the loading process can stop sending data to the standby database. In this mode, the standby database may lack data, but each Active Data Guard standby database automatically extracts data from the primary database during the recover process.

SQL > alter database set standby nologging for load performance

Database altered.

SQL > select log_mode,force_logging from v$database

LOG_MODE FORCE_LOGGING

NOARCHIVELOG STANDBY NOLOGGING FOR LOAD PERFORMANCE

(4)。 Add additional logs to the main library

SQL > alter database add standby logfile group 4 ('/ u01 size size 100m)

Database altered.

SQL > alter database add standby logfile group 5 ('/ u01ax size size 100m)

Database altered.

SQL > alter database add standby logfile group 6 ('/ u01 size size 100m)

Database altered.

SQL > alter database add standby logfile group 7 ('/ u01ax size size 100m

Database altered.

(5)。 Modify main library parameters

SQL > alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG= (SS19P,SS19S)'

System altered.

SQL > alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SS19P'

System altered.

SQL > alter system set LOG_ARCHIVE_DEST_2='SERVICE=SS19S ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SS19S'

System altered.

SQL > alter system set REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE' scope=spfile

System altered.

SQL > alter system set FAL_SERVER=SS19S

System altered.

SQL > alter system set DB_FILE_NAME_CONVERT='SS19S','SS19P' scope=spfile

System altered.

SQL > alter system set LOG_FILE_NAME_CONVERT='SS19S','SS19P' scope=spfile

System altered.

SQL > alter system set STANDBY_FILE_MANAGEMENT=AUTO

System altered.

SQL > quit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0-Production

Version 19.2.0.0.0

(6)。 Edit the main library listener.ora network configuration file and add the static registration of connecting main library points.

[oracle@sdedu ~] $cd / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/

[oracle@sdedu admin] $vi listener.ora

# listener.ora Network Configuration File: / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdedu.sandata.com.cn) (PORT = 1521))

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = SS19P.sandata.com.cn)

(SID_NAME = SS19P)

(ORACLE_HOME = / u01/app/oracle/product/19.2.0/dbhome_1)

)

)

(7)。 Edit the tnsnames.ora network configuration file of the main library and add the local service name that connects to the standby library.

[oracle@sdedu admin] $vi tnsnames.ora

# tnsnames.ora Network Configuration File: / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

LISTENER_SS19P =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdedu.sandata.com.cn) (PORT = 1521))

SS19P =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdedu.sandata.com.cn) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = SS19P.sandata.com.cn)

)

)

SS19S =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdrep.sandata.com.cn) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = SS19S.sandata.com.cn)

)

)

(8)。 Transfer the network files and password files from the main library to the standby library

[oracle@sdedu admin] $scp listener.ora tnsnames.ora sdrep: `pwd`

Oracle@sdrep's password:

Listener.ora 100% 558 451.3KB/s 00:00

Tnsnames.ora 100% 652 580.3KB/s 00:00

[oracle@sdedu admin] $cd.. /.. / dbs

[oracle@sdedu dbs] $scp orapwSS19P sdrep: `pwd` / orapwSS19S

Oracle@sdrep's password:

OrapwSS19P

(9)。 Create the corresponding path in the slave library:

[oracle@sdrep ~] $cd / u01/app/oracle/

[oracle@sdrep oracle] $mkdir-p admin/SS19S/adump

[oracle@sdrep oracle] $mkdir-p oradata/SS19S

[oracle@sdrep oracle] $mkdir-p fast_recovery_area/SS19S

(10)。 Create a parameter file for the standby library:

[oracle@sdrep oracle] $cd / u01/app/oracle/product/19.2.0/dbhome_1/dbs/

[oracle@sdrep dbs] $vi initSS19S.ora

DB_NAME=SS19S

(11)。 Modify the listener.ora configuration file of the slave library:

[oracle@sdrep dbs] $vi.. / network/admin/listener.ora

# listener.ora Network Configuration File: / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = SS19S.example.com) (PORT = 1521))

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = SS19S.sandata.com.cn)

(ORACLE_HOME = / u01/app/oracle/product/12.1.0/dbhome_1)

(SID_NAME = SS19S)

)

)

(12)。 Modify the tnsnames.ora configuration file of the slave library:

[oracle@sdedu admin] $vi tnsnames.ora

# tnsnames.ora Network Configuration File: / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

LISTENER_SS19P =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdrep.sandata.com.cn) (PORT = 1521))

SS19P =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdedu.sandata.com.cn) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = SS19P.sandata.com.cn)

)

)

SS19S =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdrep.sandata.com.cn) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = SS19S.sandata.com.cn)

)

)

(13)。 Start a secondary instance

[oracle@sdrep dbs] $export ORACLE_SID=SS19S

[oracle@sdrep dbs] $sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0-Production on Thu Mar 7 16:41:03 2019

Version 19.2.0.0.0

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

Connected to an idle instance.

SQL > startup nomount

ORACLE instance started.

Total System Global Area 1543500824 bytes

Fixed Size 9135128 bytes

Variable Size 1006632960 bytes

Database Buffers 520093696 bytes

Redo Buffers 7639040 bytes

Database mounted.

SQL > quit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0-Production

Version 19.2.0.0.0

(14)。 Use replication database technology to build the preparation database. Since the file path of the preparation database contains SS19S, you need to specify the audit_file_dest,control_files parameters (single quotation marks are also available)

[oracle@sdrep dbs] $rman target sys/oracle@SS19P auxiliary sys/oracle@SS19S

Recovery Manager: Release 19.0.0.0.0-Production on Wed Mar 6 20:51:58 2019

Version 19.2.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to target database: SS19P (DBID=592912636)

Connected to auxiliary database: SS19P (not mounted)

RMAN > DUPLICATE TARGET DATABASE

2 > FOR STANDBY

3 > FROM ACTIVE DATABASE

4 > DORECOVER

5 > SPFILE

6 > SET DB_UNIQUE_NAME= "SS19S" COMMENT "Is a dbstyle duplicate"

7 > SET AUDIT_FILE_DEST= "/ u01/app/oracle/admin/SS19S/adump"

8 > SET CONTROL_FILES='/u01/app/oracle/oradata/SS19S/control01.ctl','/u01/app/oracle/fast_recovery_area/SS19S/control02.ctl'

9 > SET LOG_ARCHIVE_CONFIG= "DG_CONFIG= (SS19S,SS19P)"

10 > SET LOG_ARCHIVE_DEST_1= "LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SS19S"

11 > SET LOG_ARCHIVE_DEST_2= "SERVICE=SS19P ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SS19P"

12 > SET DB_FILE_NAME_CONVERT= "SS19P", "SS19S"

13 > SET LOG_FILE_NAME_CONVERT= "SS19P", "SS19S"

14 > SET FAL_SERVER= "SS19P" COMMENT "Is primary"

15 > SET STANDBY_FILE_MANAGEMENT= "AUTO"

16 > NOFILENAMECHECK

Starting Duplicate Db at 06-MAR-19

Using target database control file instead of recovery catalog

Allocated channel: ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: SID=21 device type=DISK

Current log archived

Omit the part.

Released channel: ORA_DISK_1

Released channel: ORA_AUX_DISK_1

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=53 device type=DISK

Deleted archived log

Archived log file name=/u01/app/oracle/fast_recovery_area/SS19S/archivelog/2019_03_06/o1_mf_1_10_g7zjp7gs_.arc RECID=1 STAMP=1002228807

Deleted archived log

Archived log file name=/u01/app/oracle/fast_recovery_area/SS19S/archivelog/2019_03_06/o1_mf_1_11_g7zjp8po_.arc RECID=2 STAMP=1002228808

Deleted 2 objects

Finished Duplicate Db at 06-MAR-19

RMAN > quit

Recovery Manager complete.

(15)。 Enter the standby database to verify the role information

[oracle@sdrep dbs] $sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0-Production on Wed Mar 6 20:54:39 2019

Version 19.2.0.0.0

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

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0-Production

Version 19.2.0.0.0

SQL > select database_role from v$database

DATABASE_ROLE

PHYSICAL STANDBY

SQL > select instance_name from v$instance

INSTANCE_NAME

SS19S

(16)。 Start the recover process in the slave database, and apply the log passed from the main database (default is already real-time apply mode, so using current logfile is omitted)

SQL > recover managed standby database disconnect from session

Media recovery complete.

(17)。 Query the v$dataguard_process view to verify the log process transferred from the main database and prepare the database application log (the v$dataguard_process view appeared in version 12.2, replacing v$managed_standby)

SQL > select role,thread#,sequence#,action from v$dataguard_process

ROLE THREAD# SEQUENCE# ACTION

-

Recovery apply slave 0 0 IDLE

Archive local 0 0 IDLE

Redo transport timer 0 0 IDLE

Gap manager 0 0 IDLE

Recovery logmerger 1 12 WAIT_FOR_LOG

Recovery apply slave 0 IDLE

Managed recovery 0 IDLE

Archive redo 0 0 IDLE

Archive redo 0 0 IDLE

Archive redo 0 0 IDLE

Redo transport monitor 0 0 IDLE

Log writer 0 0 IDLE

12 rows selected.

(18)。 Query the v$archived_log view to verify the changes of logs transferred from the main database. The following output shows that the logs transferred from the main database are increasing.

SQL > select sequence#,applied from v$archived_log

SEQUENCE# APPLIED

-

10 YES

11 YES

SQL > select sequence#,applied from v$archived_log

SEQUENCE# APPLIED

--

10 YES

11 YES

12 YES

SQL > select sequence#,applied from v$archived_log

SEQUENCE# APPLIED

--

10 YES

11 YES

12 YES

13 YES

Two-node Oracle 19c Dataguard environment

Build a two-node Oracle 19c Dataguard environment

The main library is not closed

Use the physical repository

Do not use Broker

Operating system version: OEL 7.6

Database version: Oracle Database 19c

Two hostnames: sdedu, sdrep

Main library name: SS19P

Slave name: SS19S

The main library is not closed

Use the physical repository

Do not use Broker

Introduction to deployment environment

Operating system version: OEL 7.6

Database version: Oracle Database 19c

Two hostnames: sdedu, sdrep

Main library name: SS19P

Slave name: SS19S

Operation steps

(1)。 Check the main library archive and additional log configuration. The following output shows that archive mode is enabled but additional logs are not enabled.

[oracle@sdedu ~] $sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0-Production on Thu Mar 7 20:04:29 2019

Version 19.2.0.0.0

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

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0-Production

Version 19.2.0.0.0

SQL > select log_mode,force_logging from v$database

LOG_MODE FORCE_LOGGING

ARCHIVELOG NO

(2)。 Looking at the main library archive destination, you can see from the following results that the archive destination uses a fast recovery area

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 1

Next log sequence to archive 3

Current log sequence 3

(3)。 Open the attached log of the main database, and verify the result of opening it.

SQL > alter database force logging

Database altered.

SQL > select log_mode,force_logging from v$database

LOG_MODE FORCE_LOGGING

-

ARCHIVELOG YES

Starting with Oracle Database 18c, the following two new nologging clauses are introduced, which can perform non-logging operations while making the Active Data Guard standby database receive all the data, thus preventing performance degradation caused by generating a large number of redo logs in FORCE mode.

The STANDBY NOLOGGING FOR DATA AVAILABILITY mode allows the bulk load operation to send loaded data to each standby database through its own connection to the standby database. The submission is delayed until all Active Data Guard standby databases apply the data through recover.

SQL > alter database set standby nologging for data availability

Database altered.

SQL > select log_mode,force_logging from v$database

LOG_MODE FORCE_LOGGING

NOARCHIVELOG STANDBY NOLOGGING FOR DATA AVAILABILITY

The STANDBY NOLOGGING FOR LOAD PERFORMANCE pattern is similar to the previous one, except that if the network cannot keep up with the speed at which the data is loaded into the primary database, the loading process can stop sending data to the standby database. In this mode, the standby database may lack data, but each Active Data Guard standby database automatically extracts data from the primary database during the recover process.

SQL > alter database set standby nologging for load performance

Database altered.

SQL > select log_mode,force_logging from v$database

LOG_MODE FORCE_LOGGING

NOARCHIVELOG STANDBY NOLOGGING FOR LOAD PERFORMANCE

(4)。 Add additional logs to the main library

SQL > alter database add standby logfile group 4 ('/ u01 size size 100m)

Database altered.

SQL > alter database add standby logfile group 5 ('/ u01ax size size 100m)

Database altered.

SQL > alter database add standby logfile group 6 ('/ u01 size size 100m)

Database altered.

SQL > alter database add standby logfile group 7 ('/ u01ax size size 100m

Database altered.

(5)。 Modify main library parameters

SQL > alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG= (SS19P,SS19S)'

System altered.

SQL > alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SS19P'

System altered.

SQL > alter system set LOG_ARCHIVE_DEST_2='SERVICE=SS19S ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SS19S'

System altered.

SQL > alter system set REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE' scope=spfile

System altered.

SQL > alter system set FAL_SERVER=SS19S

System altered.

SQL > alter system set DB_FILE_NAME_CONVERT='SS19S','SS19P' scope=spfile

System altered.

SQL > alter system set LOG_FILE_NAME_CONVERT='SS19S','SS19P' scope=spfile

System altered.

SQL > alter system set STANDBY_FILE_MANAGEMENT=AUTO

System altered.

SQL > quit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0-Production

Version 19.2.0.0.0

(6)。 Edit the main library listener.ora network configuration file and add the static registration of connecting main library points.

[oracle@sdedu ~] $cd / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/

[oracle@sdedu admin] $vi listener.ora

# listener.ora Network Configuration File: / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdedu.sandata.com.cn) (PORT = 1521))

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = SS19P.sandata.com.cn)

(SID_NAME = SS19P)

(ORACLE_HOME = / u01/app/oracle/product/19.2.0/dbhome_1)

)

)

(7)。 Edit the tnsnames.ora network configuration file of the main library and add the local service name that connects to the standby library.

[oracle@sdedu admin] $vi tnsnames.ora

# tnsnames.ora Network Configuration File: / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

LISTENER_SS19P =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdedu.sandata.com.cn) (PORT = 1521))

SS19P =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdedu.sandata.com.cn) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = SS19P.sandata.com.cn)

)

)

SS19S =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdrep.sandata.com.cn) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = SS19S.sandata.com.cn)

)

)

(8)。 Transfer the network files and password files from the main library to the standby library

[oracle@sdedu admin] $scp listener.ora tnsnames.ora sdrep: `pwd`

Oracle@sdrep's password:

Listener.ora 100% 558 451.3KB/s 00:00

Tnsnames.ora 100% 652 580.3KB/s 00:00

[oracle@sdedu admin] $cd.. /.. / dbs

[oracle@sdedu dbs] $scp orapwSS19P sdrep: `pwd` / orapwSS19S

Oracle@sdrep's password:

OrapwSS19P

(9)。 Create the corresponding path in the slave library:

[oracle@sdrep ~] $cd / u01/app/oracle/

[oracle@sdrep oracle] $mkdir-p admin/SS19S/adump

[oracle@sdrep oracle] $mkdir-p oradata/SS19S

[oracle@sdrep oracle] $mkdir-p fast_recovery_area/SS19S

(10)。 Create a parameter file for the standby library:

[oracle@sdrep oracle] $cd / u01/app/oracle/product/19.2.0/dbhome_1/dbs/

[oracle@sdrep dbs] $vi initSS19S.ora

DB_NAME=SS19S

(11)。 Modify the listener.ora configuration file of the slave library:

[oracle@sdrep dbs] $vi.. / network/admin/listener.ora

# listener.ora Network Configuration File: / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = SS19S.example.com) (PORT = 1521))

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = SS19S.sandata.com.cn)

(ORACLE_HOME = / u01/app/oracle/product/12.1.0/dbhome_1)

(SID_NAME = SS19S)

)

)

(12)。 Modify the tnsnames.ora configuration file of the slave library:

[oracle@sdedu admin] $vi tnsnames.ora

# tnsnames.ora Network Configuration File: / u01/app/oracle/product/19.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

LISTENER_SS19P =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdrep.sandata.com.cn) (PORT = 1521))

SS19P =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdedu.sandata.com.cn) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = SS19P.sandata.com.cn)

)

)

SS19S =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = sdrep.sandata.com.cn) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = SS19S.sandata.com.cn)

)

)

(13)。 Start a secondary instance

[oracle@sdrep dbs] $export ORACLE_SID=SS19S

[oracle@sdrep dbs] $sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0-Production on Thu Mar 7 16:41:03 2019

Version 19.2.0.0.0

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

Connected to an idle instance.

SQL > startup nomount

ORACLE instance started.

Total System Global Area 1543500824 bytes

Fixed Size 9135128 bytes

Variable Size 1006632960 bytes

Database Buffers 520093696 bytes

Redo Buffers 7639040 bytes

Database mounted.

SQL > quit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0-Production

Version 19.2.0.0.0

(14)。 Use replication database technology to build the preparation database. Since the file path of the preparation database contains SS19S, you need to specify the audit_file_dest,control_files parameters (single quotation marks are also available)

[oracle@sdrep dbs] $rman target sys/oracle@SS19P auxiliary sys/oracle@SS19S

Recovery Manager: Release 19.0.0.0.0-Production on Wed Mar 6 20:51:58 2019

Version 19.2.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.

Connected to target database: SS19P (DBID=592912636)

Connected to auxiliary database: SS19P (not mounted)

RMAN > DUPLICATE TARGET DATABASE

2 > FOR STANDBY

3 > FROM ACTIVE DATABASE

4 > DORECOVER

5 > SPFILE

6 > SET DB_UNIQUE_NAME= "SS19S" COMMENT "Is a dbstyle duplicate"

7 > SET AUDIT_FILE_DEST= "/ u01/app/oracle/admin/SS19S/adump"

8 > SET CONTROL_FILES='/u01/app/oracle/oradata/SS19S/control01.ctl','/u01/app/oracle/fast_recovery_area/SS19S/control02.ctl'

9 > SET LOG_ARCHIVE_CONFIG= "DG_CONFIG= (SS19S,SS19P)"

10 > SET LOG_ARCHIVE_DEST_1= "LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SS19S"

11 > SET LOG_ARCHIVE_DEST_2= "SERVICE=SS19P ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SS19P"

12 > SET DB_FILE_NAME_CONVERT= "SS19P", "SS19S"

13 > SET LOG_FILE_NAME_CONVERT= "SS19P", "SS19S"

14 > SET FAL_SERVER= "SS19P" COMMENT "Is primary"

15 > SET STANDBY_FILE_MANAGEMENT= "AUTO"

16 > NOFILENAMECHECK

Starting Duplicate Db at 06-MAR-19

Using target database control file instead of recovery catalog

Allocated channel: ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: SID=21 device type=DISK

Current log archived

Omit the part.

Released channel: ORA_DISK_1

Released channel: ORA_AUX_DISK_1

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=53 device type=DISK

Deleted archived log

Archived log file name=/u01/app/oracle/fast_recovery_area/SS19S/archivelog/2019_03_06/o1_mf_1_10_g7zjp7gs_.arc RECID=1 STAMP=1002228807

Deleted archived log

Archived log file name=/u01/app/oracle/fast_recovery_area/SS19S/archivelog/2019_03_06/o1_mf_1_11_g7zjp8po_.arc RECID=2 STAMP=1002228808

Deleted 2 objects

Finished Duplicate Db at 06-MAR-19

RMAN > quit

Recovery Manager complete.

(15)。 Enter the standby database to verify the role information

[oracle@sdrep dbs] $sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0-Production on Wed Mar 6 20:54:39 2019

Version 19.2.0.0.0

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

Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0-Production

Version 19.2.0.0.0

SQL > select database_role from v$database

DATABASE_ROLE

PHYSICAL STANDBY

SQL > select instance_name from v$instance

INSTANCE_NAME

SS19S

(16)。 Start the recover process in the slave database, and apply the log passed from the main database (default is already real-time apply mode, so using current logfile is omitted)

SQL > recover managed standby database disconnect from session

Media recovery complete.

(17)。 Query the v$dataguard_process view to verify the log process transferred from the main database and prepare the database application log (the v$dataguard_process view appeared in version 12.2, replacing v$managed_standby)

SQL > select role,thread#,sequence#,action from v$dataguard_process

ROLE THREAD# SEQUENCE# ACTION

-

Recovery apply slave 0 0 IDLE

Archive local 0 0 IDLE

Redo transport timer 0 0 IDLE

Gap manager 0 0 IDLE

Recovery logmerger 1 12 WAIT_FOR_LOG

Recovery apply slave 0 IDLE

Managed recovery 0 IDLE

Archive redo 0 0 IDLE

Archive redo 0 0 IDLE

Archive redo 0 0 IDLE

Redo transport monitor 0 0 IDLE

Log writer 0 0 IDLE

12 rows selected.

(18)。 Query the v$archived_log view to verify the changes of logs transferred from the main database. The following output shows that the logs transferred from the main database are increasing.

SQL > select sequence#,applied from v$archived_log

SEQUENCE# APPLIED

-

10 YES

11 YES

SQL > select sequence#,applied from v$archived_log

SEQUENCE# APPLIED

--

10 YES

11 YES

12 YES

SQL > select sequence#,applied from v$archived_log

SEQUENCE# APPLIED

--

10 YES

11 YES

12 YES

13 YES

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report