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

11G adds Physical standby and switches between master and slave through DGBroker.

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1.PRIMARY

Add the configuration information of the new backup library to the original main library.

SQL > alter system set log_archive_dest_state_3=defer

SQL > alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG= (ORA11G_PRIM,ORA11G_STBY,ORA11G_STBY2)'

SQL > alter system set LOG_ARCHIVE_DEST_3='SERVICE=ORA11G_STBY2 ASYNC DELAY=60 VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORA11G_STBY2'

2.FIRST STANDBY

The first set of standby library adjustment configuration information.

SQL > alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG= (ORA11G_PRIM,ORA11G_STBY,ORA11G_STBY2)'

3.SECOND STANDBY

Configure the second set of standby libraries. Since the first set of standby library and the second set of standby library are on the same physical machine, it is necessary to pay attention to directory isolation to prevent the new library from destroying the files of the prepared library.

3.1 Parameter file

[oracle@oradb2 ~] $export ORACLE_SID=ora11g

SQL > create pfile='/home/oracle/11g2.pfile' from spfile

[oracle@oradb2 ~] $vi 11g2.pfile

* .audit_file_dest='/oracle/app/oracle/admin/ora11g2/adump'

* .control_files='/oradata/database/11g/ora11g2/control01.ctl','/oradata/database/11g/ora11g2/control02.ctl'

* .DB_UNIQUE_NAME='ORA11G_STBY2'

* .fal_server='ORA11G_PRIM'

* .LOG_ARCHIVE_CONFIG='DG_CONFIG= (ORA11G_PRIM,ORA11G_STBY,ORA11G_STBY2)'

* .LOG_ARCHIVE_DEST_1='LOCATION=/oradata/archive/11g2 VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ORA11G_STBY2'

* .LOG_ARCHIVE_DEST_2='SERVICE=ORA11G_PRIM ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORA11G_PRIM'

* .dg_broker_start=false

* .db_file_name_convert='/oradata/database/11g/ora11g/','/oradata/database/11g/ora11g2/'

* .log_file_name_convert='/oradata/database/11g/ora11g/','/oradata/database/11g/ora11g2/'

Start the new backup library to the nomount status through the parameter file

[oracle@oradb2 ~] $export ORACLE_SID=ora11g2

SQL > startup nomount pfile='/home/oracle/11g2.pfile'

SQL > create spfile from pfile='/home/oracle/11g2.pfile'

SQL > startup force nomount

3.2 password file

[oracle@oradb2 ~] $cd $ORACLE_HOME/dbs

[oracle@oradb2 dbs] $cp orapwora11g orapwora11g2

3.3 Network configuration

[oracle@oradb2 dbs] $cd $ORACLE_HOME/network/admin

[oracle@oradb2 admin] $vi listener.ora

Add the configuration information of the new slave library and register it in static monitoring.

(SID_DESC =

(GLOBAL_DBNAME = ORA11G_STBY2)

(ORACLE_HOME = / oracle/app/oracle/product/database/11g)

(SID_NAME = ora11g2)

)

(SID_DESC =

(GLOBAL_DBNAME = ORA11G_STBY2_DGMGRL)

(ORACLE_HOME = / oracle/app/oracle/product/database/11g)

(SID_NAME = ora11g2)

)

Restart monitoring to make the configuration effective, and check that all configured static monitoring takes effect.

[oracle@oradb2 ~] $lsnrctl stop

[oracle@oradb2 ~] $lsnrctl start

[oracle@oradb2 ~] $lsnrctl status

Services Summary...

Service "ORA11G_STBY" has 2 instance (s).

Instance "ora11g", status UNKNOWN, has 1 handler (s) for this service...

Service "ORA11G_STBY2" has 2 instance (s).

Instance "ora11g2", status UNKNOWN, has 1 handler (s) for this service...

Service "ORA11G_STBY2_DGMGRL" has 1 instance (s).

Instance "ora11g2", status UNKNOWN, has 1 handler (s) for this service...

Service "ORA11G_STBY_DGMGRL" has 1 instance (s).

Instance "ora11g", status UNKNOWN, has 1 handler (s) for this service...

Added tns configuration information for the new slave library.

[oracle@oradb2 admin] $vi tnsnames.ora [this configuration also needs to be added to the main library]

ORA11G_STBY2 =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ORA11G_STBY2)

)

)

3.4 Test database connection [both the main library and the new database need to be tested]

[oracle@oradb2 ~] $sqlplus sys/oracle@ORA11G_STBY2 as sysdba

[oracle@oradb2 ~] $sqlplus sys/oracle@ORA11G_PRIM as sysdba

3.5 copy the master library from the new library

Notice that you are connected to the new standby library here.

[oracle@oradb2 ~] $export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'

[oracle@oradb2 ~] $rman target sys/oracle@ORA11G_PRIM auxiliary sys/oracle@ORA11G_STBY2

RMAN > CONFIGURE DEVICE TYPE DISK PARALLELISM 4

RMAN > DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE DORECOVER NOFILENAMECHECK

3.6 start the new database and start the real-time recovery

[oracle@oradb2 ~] $export ORACLE_SID=ora11g2

SQL > alter database open

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

4. Add a new standby library to dg broker

[oracle@oradb2 ~] $export ORACLE_SID=ora11g2

SQL > alter system set dg_broker_start=true

[oracle@oradb2 ~] $dgmgrl /

DGMGRL > show configuration

DGMGRL > ADD DATABASE 'ORA11G_STBY2' AS CONNECT IDENTIFIER IS' ORA11G_STBY2' MAINTAINED AS PHYSICAL

DGMGRL > ENABLE DATABASE 'ORA11G_STBY2'

5. Carry out the active / standby switching operation

In the DG environment managed by DG Broker, the parameters are automatically maintained during the master / slave switching process, such as fal_server,log_archive_dest_2,log_archive_dest_3, etc.

DGMGRL > show configuration

Configuration-ora11g_dg

Protection Mode: MaxPerformance

Databases:

ORA11G_PRIM-Primary database

ORA11G_STBY-Physical standby database

ORA11G_STBY2-Physical standby database

DGMGRL > connect sys/oracle@ORA11G_STBY

DGMGRL > SWITCHOVER TO 'ORA11G_STBY'

Remember to connect to the dgmgrl with a username and password when you are in switchover, otherwise it will cause the remote database to fail to start after the switch, causing the switch to fail.

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