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

Setting up 11g Active Dataguard (ADG)

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Environment:

Lord:

IP: 172.18.130.55 DB:11.2.0.1 SID: wsqtest

ORACLE_BASE: / apps/oracle

ORACLE_HOME:/apps/oracle/product/11.2.0.1

Standby:

IP: 172.18.130.52 DB:11.2.0.1 SID:wsqteststd

ORACLE_BASE:/apps/oracle

ORACLE_HOME:/apps/oracle/product/11.2.0.1

Install oracle software and database on 55 and oracle software on 52 without library

1. On the main database 55, enable archiving and force logging

SQL > conn / as sysdba

Connected.

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 20

Next log sequence to archive 22

Current log sequence 22

SQL > alter database force logging

Database altered.

2. Configure monitoring:

Lord:

-- static registration

Listener.ora:

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = / apps/oracle/product/11.2.0.1)

(PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBNAME = wsqtest)

(ORACLE_HOME = / apps/oracle/product/11.2.0.1)

(SID_NAME = wsqtest)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

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

)

)

-- tnsnames.ora:

WSQTEST =

(DESCRIPTION =

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

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = wsqtest)

)

)

WSQTESTSTD =

(DESCRIPTION =

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

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = wsqteststd)

)

)

3. Configuration parameter file:

Add the following parameters to the main library:

* .log_archive_config='dg_config= (wsqtest,wsqteststd)'

* .log_archive_dest_1='location=/apps/oracle/flash_recovery_area/wsqtest/archivelogs valid_for= (all_logfiles,all_roles) db_unique_name=wsqtest'

* .log_archive_dest_2='service=wsqteststd reopen=120 lgwr async valid_for= (online_logfiles,primary_role) db_unique_name=wsqteststd'

* .log_archive_dest_state_1=enable

* .log_archive_dest_state_2=enable

* .standby_file_management='auto'

* .fal_server='wsqteststd'

* .fal_client='wsqtest'

* .db_unique_name='wsqtest'

4. Create a password file on the standby side

$cd $ORACLE_HOME/dbswho

$orapwd file=orapwwsqteststd password=oracle entries=5

5. Create the corresponding directory

Mkdir / apps/oracle/oradata/wsqteststd

Mkdir / apps/oracle/oradata/wsqteststd/onlinelogs / apps/oracle/oradata/wsqteststd/datafiles / apps/oracle/oradata/wsqteststd/controlfiles

Mkdir / apps/oracle/admin/wsqteststd

Mkdir / apps/oracle/admin/wsqteststd/adump / apps/oracle/admin/wsqteststd/bdump / apps/oracle/admin/wsqteststd/cdump / apps/oracle/admin/wsqteststd/udump

Mkdir / apps/oracle/flash_recovery_area/wsqteststd

6. Modify the parameter file of the standby library.

Copy from the main library parameter file, modify the response path, and add the response parameters:

* .log_archive_config='dg_config= (wsqteststd,wsqtest)'

* .log_archive_dest_1='location=/apps/oracle/flash_recovery_area/wsqteststd/archivelogs valid_for= (all_logfiles,all_roles) db_unique_name=wsqteststd'

* .log_archive_dest_2='service=wsqtest reopen=120 lgwr async valid_for= (online_logfiles,primary_role) db_unique_name=wsqtest'

* .log_archive_dest_state_1=enable

* .log_archive_dest_state_2=enable

* .standby_file_management='auto'

* .fal_server='wsqtest'

* .fal_client='wsqteststd'

* .log_file_name_convert='/apps/oracle/oradata/wsqtest/onlinelogs/','/apps/oracle/oradata/wsqteststd/onlinelogs/'

* .db_file_name_convert='/apps/oracle/oradata/wsqtest/datafiles/','/apps/oracle/oradata/wsqteststd/datafiles/'

7. Start the repository to nomount

[oracle@localhost dbs] $env | grep ORACLE_SID

ORACLE_SID=wsqteststd

[oracle@localhost dbs] $sqlplus / nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 4 14:43:21 2013

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

SQL > conn / as sysdba

Connected to an idle instance.

SQL > startup nomount

ORA-32004: obsolete or deprecated parameter (s) specified for RDBMS instance

ORACLE instance started.

Total System Global Area 450953216 bytes

Fixed Size 2214256 bytes

Variable Size 142608016 bytes

Database Buffers 301989888 bytes

Redo Buffers 4141056 bytes

SQL >

8. Prepare the database and start to copy the database:

[oracle@localhost ~] $rman target sys/oracle@wsqtest auxiliary sys/oracle@wsqteststd

Recovery Manager: Release 11.2.0.1.0-Production on Wed Dec 4 14:54:06 2013

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

Connected to target database: WSQTEST (DBID=1260868535)

Connected to auxiliary database: WSQTEST (not mounted)

RMAN > duplicate target database for standby from active database

Starting Duplicate Db at 2013-12-04 14:55:18

Using target database control file instead of recovery catalog

Allocated channel: ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: SID=20 device type=DISK

Contents of Memory Script:

{

Backup as copy reuse

Targetfile'/ apps/oracle/product/11.2.0.1/dbs/orapwwsqtest' auxiliary format

'/ apps/oracle/product/11.2.0.1/dbs/orapwwsqteststd'

}

Executing Memory Script

Starting backup at 2013-12-04 14:55:20

Allocated channel: ORA_DISK_1

Channel ORA_DISK_1: SID=15 device type=DISK

Finished backup at 2013-12-04 14:55:21

Contents of Memory Script:

{

Backup as copy current controlfile for standby auxiliary format'/ apps/oracle/oradata/wsqteststd/controlfiles/control01.ctl'

Restore clone controlfile to'/ apps/oracle/flash_recovery_area/wsqteststd/controlfiles/control02.ctl' from

'/ apps/oracle/oradata/wsqteststd/controlfiles/control01.ctl'

}

Executing Memory Script

Starting backup at 2013-12-04 14:55:21

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile copy

Copying standby control file

Output file name=/apps/oracle/product/11.2.0.1/dbs/snapcf_wsqtest.f tag=TAG20131204T145308 RECID=1 STAMP=833295189

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 2013-12-04 14:55:22

Starting restore at 2013-12-04 14:55:22

Using channel ORA_AUX_DISK_1

Channel ORA_AUX_DISK_1: copied control file copy

Finished restore at 2013-12-04 14:55:23

Contents of Memory Script:

{

Sql clone 'alter database mount standby database'

}

Executing Memory Script

Sql statement: alter database mount standby database

Contents of Memory Script:

{

Set newname for tempfile 1 to

"/ apps/oracle/oradata/wsqteststd/datafiles/temp01.dbf"

Switch clone tempfile all

Set newname for datafile 1 to

"/ apps/oracle/oradata/wsqteststd/datafiles/system01.dbf"

Set newname for datafile 2 to

"/ apps/oracle/oradata/wsqteststd/datafiles/sysaux01.dbf"

Set newname for datafile 3 to

"/ apps/oracle/oradata/wsqteststd/datafiles/undotbs01.dbf"

Set newname for datafile 4 to

"/ apps/oracle/oradata/wsqteststd/datafiles/data01.dbf"

Backup as copy reuse

Datafile 1 auxiliary format

"/ apps/oracle/oradata/wsqteststd/datafiles/system01.dbf" datafile

2 auxiliary format

"/ apps/oracle/oradata/wsqteststd/datafiles/sysaux01.dbf" datafile

3 auxiliary format

"/ apps/oracle/oradata/wsqteststd/datafiles/undotbs01.dbf" datafile

4 auxiliary format

"/ apps/oracle/oradata/wsqteststd/datafiles/data01.dbf"

Sql 'alter system archive log current'

}

Executing Memory Script

Executing command: SET NEWNAME

Renamed tempfile 1 to / apps/oracle/oradata/wsqteststd/datafiles/temp01.dbf in control file

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Executing command: SET NEWNAME

Starting backup at 2013-12-04 14:55:29

Using channel ORA_DISK_1

Channel ORA_DISK_1: starting datafile copy

Input datafile file number=00003 name=/apps/oracle/oradata/wsqtest/datafiles/undotbs01.dbf

Output file name=/apps/oracle/oradata/wsqteststd/datafiles/undotbs01.dbf tag=TAG20131204T145316

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

Channel ORA_DISK_1: starting datafile copy

Input datafile file number=00001 name=/apps/oracle/oradata/wsqtest/datafiles/system01.dbf

Output file name=/apps/oracle/oradata/wsqteststd/datafiles/system01.dbf tag=TAG20131204T145316

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

Channel ORA_DISK_1: starting datafile copy

Input datafile file number=00002 name=/apps/oracle/oradata/wsqtest/datafiles/sysaux01.dbf

Output file name=/apps/oracle/oradata/wsqteststd/datafiles/sysaux01.dbf tag=TAG20131204T145316

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

Channel ORA_DISK_1: starting datafile copy

Input datafile file number=00004 name=/apps/oracle/oradata/wsqtest/datafiles/data01.dbf

Output file name=/apps/oracle/oradata/wsqteststd/datafiles/data01.dbf tag=TAG20131204T145316

Channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

Finished backup at 2013-12-04 14:55:57

Sql statement: alter system archive log current

Contents of Memory Script:

{

Switch clone datafile all

}

Executing Memory Script

Datafile 1 switched to datafile copy

Input datafile copy RECID=1 STAMP=833295358 file name=/apps/oracle/oradata/wsqteststd/datafiles/system01.dbf

Datafile 2 switched to datafile copy

Input datafile copy RECID=2 STAMP=833295358 file name=/apps/oracle/oradata/wsqteststd/datafiles/sysaux01.dbf

Datafile 3 switched to datafile copy

Input datafile copy RECID=3 STAMP=833295358 file name=/apps/oracle/oradata/wsqteststd/datafiles/undotbs01.dbf

Datafile 4 switched to datafile copy

Input datafile copy RECID=4 STAMP=833295358 file name=/apps/oracle/oradata/wsqteststd/datafiles/data01.dbf

Finished Duplicate Db at 2013-12-04 14:55:59

RMAN >

9. Add standbylog to the slave database: one more group than the redolog group of the main database

SQL > alter database add standby logfile ('/ apps/oracle/oradata/wsqteststd/onlinelogs/stdbyredo01.log') size 50m

Database altered.

SQL > alter database add standby logfile ('/ apps/oracle/oradata/wsqteststd/onlinelogs/stdbyredo02.log') size 50m

Database altered.

SQL > alter database add standby logfile ('/ apps/oracle/oradata/wsqteststd/onlinelogs/stdbyredo03.log') size 50m

Database altered.

SQL > alter database add standby logfile ('/ apps/oracle/oradata/wsqteststd/onlinelogs/stdbyredo04.log') size 50m

Database altered.

10. Add standbylog to the main library:

SQL > alter database add standby logfile ('/ apps/oracle/oradata/wsqtest/onlinelogs/stdbyredo01.log') size 50m

Database altered.

SQL > alter database add standby logfile ('/ apps/oracle/oradata/wsqtest/onlinelogs/stdbyredo02.log') size 50m

Database altered.

SQL > alter database add standby logfile ('/ apps/oracle/oradata/wsqtest/onlinelogs/stdbyredo03.log') size 50m

Database altered.

SQL > alter database add standby logfile ('/ apps/oracle/oradata/wsqtest/onlinelogs/stdbyredo04.log') size 50m

Database altered.

11. Enable redo real-time apply

SQL > alter database recover managed standby database disconnect from session

Database altered.

SQL > alter database recover managed standby database cancel

Database altered.

SQL > alter database open

Alter database open

*

ERROR at line 1:

ORA-01531: a database already open by the instance

SQL > select open_mode from v$database

OPEN_MODE

-

READ ONLY

SQL > alter database recover managed standby database using current logfile disconnect

Database altered.

SQL > select open_mode from v$database

OPEN_MODE

-

READ ONLY WITH APPLY

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