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

Oracle data guard 11.0.2.4

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

Share

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

Oracle DataGuard is the data synchronization function of Oracle. The basic principle is to transfer log files from the original database to the target database, and then apply these log files on the target database, so as to keep the target database synchronized with the source database. It is a database-level high availability scheme.

There are two ways to build oracle dg:

1.DB downtime, copy all files to DG library, affecting business

2.DB does not stop, and rman hot backup is copied to DG library, which does not affect the business.

There are three oracle dg modes:

1. Maximum protection

This mode is the default data protection mode, providing as many numbers as possible without affecting the performance of the source database.

According to the protection level. In this mode, once the log data is written to the online log file of the source database, the transaction can be committed without having to wait for the log to be written to the target database. If the network bandwidth is sufficient, this mode can provide a level of data protection similar to the maximum available mode.

two。 Maximum availability

This model is basically similar to "maximum protection". Normally, the primary and standby libraries are synchronized.

When there is a problem with the network or slave database, it will not affect the downtime of the master database. The master database will automatically convert the "maximum performance" mode of the database. When the standby database is available, the archive will be transferred to the standby database for recovery.

3. Maximum performance

This mode maximizes the performance of the main library, and the data is transferred asynchronously between the main library and the standby library. That is, the active and standby logs are archived to

After that, it will be transferred to the standby library, and the archive log files will be used for recovery on the standby database.

Build DG library with hot backup:

Master library configuration:

Startup mount

Open archiving:

Alter database archivelog

Enable forced archiving force logging (default 0 seconds):

Alter database force logging

Enable flashback (if archiving is enabled):

Set the size of the flash area: # alter system set db_recovery_file_dest_size='5G'

Set flashback area directory: # alter system set db_recovery_file_dest='/data/db_recovery_file_dest/'

Enable flashback: alter database flashback on

# set archive log. Default location USE_DB_RECOVERY_FILE_DEST, query location show parameter DB_RECOVERY_FILE_DEST:

# alter system set log_archive_dest_1='location=/data/JINGYU/archivelog'

# set the mandatory archiving time to 30 minutes:

# alter system set archive_lag_target=1800

Check to see if it is on:

Archive log list

Select FLASHBACK_ON from v$database

Select force_logging from v$database

Add a STANDBY log file:

Query the size and number of groups of online logs in the main database:

Select group#,bytes/1024/1024 from v$log

Query the size and number of groups of online logs in the repository:

Select group#,bytes/1024/1024 from v$standby_log

Create standby logfile (main library log+1)

Alter database add standby logfile group 4'/ data/zy/onlinelog/redo11_stb01.log' size 50m

Alter database add standby logfile group 5'/ data/zy/onlinelog/redo11_stb02.log' size 50m

Alter database add standby logfile group 6'/ data/zy/onlinelog/redo11_stb03.log' size 50m

Alter database add standby logfile group 7'/ data/zy/onlinelog/redo11_stb04.log' size 50m

Parameter file modification:

Cat > > alterspfile.sql

Note: the above query result of TO STANDBY or SESSIONS ACTIVE indicates that the switch can be made.

SQL > alter database commit to switchover to physical standby

Databasealtered.

SQL > startup mount

ORACLE instance started.

Total System Global Area 688959488 bytes

Fixed Size 2256432 bytes

Variable Size 566231504 bytes

Database Buffers 117440512 bytes

Redo Buffers 3031040 bytes

Database mounted.

SQL > select database_role from v$database

DATABASE_ROLE

-

PHYSICAL STANDBY

Operations on the standby database:

SQL > select switchover_status,database_role from v$database

SWITCHOVER_STATUS DATABASE_ROLE

-

TO PRIMARY PHYSICAL STANDBY

SQL >

Note: the above query result shows that TO PRIMARY or SESSIONS ACTIVE indicates that you can switch to the main library.

You can now switch the standby database to the main library:

SQL > alter database commit to switchover to primary with session shutdown

Database altered.

SQL > alter database open

Database altered.

SQL > select switchover_status,database_role,open_mode from v$database

SWITCHOVER_STATUS DATABASE_ROLE OPEN_MODE

SESSIONS ACTIVE PRIMARY READ WRITE

Remember: at this time, you need to enable real-time synchronization in the current standby database (the original primary database).

SQL > alter database open

Database altered.

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

Database altered.

At this point, the DG switover switch is complete, and the verification method is the same as above.

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