Oracle 11gR2 Active DataGuard配置Step By Step
Oracle作为目前最流行的商业数据库,除了单独数据库DBMS之外,还针对实际运维系统需求,提供了一系列高可用HA解决方案。这其中,
Oracle作为目前最流行的商业数据库,除了单独数据库DBMS之外,还针对实际运维系统需求,提供了一系列高可用HA解决方案。这其中,RAC+Dataguard是我们最常见的HA策略方案,也是普遍认为成熟的策略。
Data Guard在11G中有了很大的发展,最典型的两个特性就是Active Data Guard和Advanced Compression引入。传统Data Guard的Physical Standby结点在进行Redo Apply过程中,是不能打开数据库读取数据的。如果需要进行读取,则必须先将其终止Apply过程,才能支持Redo Apply。Active Data Guard特性就是支持Standby结点在Apply的同时支持只读数据库。这也就是为什么11G之后,很多企业选择DG作为读写分离策略的技术手段。
Advanced Compression是一个综合技术,在Data Guard中也有AC的过程。远程灾备使用Data Guard的一种重要瓶颈就是传输带宽限制。所有的Redo Log数据都要通过Primary与Standby之间的连接进行传递,过量Redo Log会限制灾备数据同步程度。Advanced Compression可以将Redo Log进行一定程度压缩,提高同步率。
本篇主要介绍在11gR2版本中,使用RMAN的duplicate from active database的新方法进行搭建。注意:从10g开始,有其他手段搭建DG。
相关参考:
Oracle Data Guard 重要配置参数
基于同一主机配置 Oracle 11g Data Guard
探索Oracle之11g DataGuard
Oracle Data Guard (RAC+DG) 归档删除策略及脚本
Oracle Data Guard 的角色转换
Oracle Data Guard的日志FAL gap问题
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 处理方法
1、环境介绍
我们选择操作系统为Red Hat 6.5版本,磁盘空间充足。
[root@SimpleLinux ~]# cat /etc/RedHat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@SimpleLinux ~]# uname -r
2.6.32-431.el6.i686
[root@SimpleLinux ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 48G 13G 33G 28% /
tmpfs 947M 0 947M 0% /dev/shm
当前数据库名称ora11g,环境变量如下:
[oracle@SimpleLinux ~]$ env | grep ORA
ORACLE_SID=ora11g
ORACLE_BASE=/u01/app
ORACLE_HOME=/u01/app/oracle
由于是实验环境,笔者在同一台机器上搭建Data Guard。不同服务器上操作方法相同。数据库版本为最新的11.2.0.4。
SQL> select * from v$version;
BANNER
------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
数据库三大文件:控制文件、日志文件(Online)和数据文件遵守OMF(Oracle Managed File)策略。
SQL> select name from v$controlfile;
NAME
---------------------------------------------
/u01/app/oradata/ORA11G/controlfile/o1_mf_9mnjwpko_.ctl
/u01/app/fast_recovery_area/ORA11G/controlfile/o1_mf_9mnjwpw2_.ctl
SQL> select group#, member from v$logfile;
GROUP# MEMBER
---------- --------------------------------------------------------------------
3 /u01/app/oradata/ORA11G/onlinelog/o1_mf_3_9mnjx4n0_.log
3 /u01/app/fast_recovery_area/ORA11G/onlinelog/o1_mf_3_9mnjx54c_.log
2 /u01/app/oradata/ORA11G/onlinelog/o1_mf_2_9mnjwzpq_.log
2 /u01/app/fast_recovery_area/ORA11G/onlinelog/o1_mf_2_9mnjx15f_.log
1 /u01/app/oradata/ORA11G/onlinelog/o1_mf_1_9mnjwtj9_.log
1 /u01/app/fast_recovery_area/ORA11G/onlinelog/o1_mf_1_9mnjwvdm_.log
6 rows selected
SQL> select file_name from dba_data_files;
FILE_NAME
-----------------------------------
/u01/app/oradata/ORA11G/datafile/o1_mf_users_9mnjs074_.dbf
/u01/app/oradata/ORA11G/datafile/o1_mf_undotbs1_9mnjs068_.dbf
/u01/app/oradata/ORA11G/datafile/o1_mf_sysaux_9mnjs04h_.dbf
/u01/app/oradata/ORA11G/datafile/o1_mf_system_9mnjrzty_.dbf
当前数据库位于非归档模式。
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Current log sequence 6
注意:OMF是Oracle推荐的一种文件管理策略。传统的文件管理是管理员直接指定文件目录和名称,而OMF下是不需要指定文件的。而且,如果配置了Recovery Area目录,Oracle OMF会将两大镜像文件,online redo log和control file镜像存放在Recovery Area中。
当前配置了Recovery Area支持。
SQL> show parameter recover
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/fast_recovery_area
db_recovery_file_dest_size big integer 10000M
db_unrecoverable_scn_tracking boolean TRUE
recovery_parallelism integer 0
实验目标是建立ora11g的physical standby数据库,实例名称ora11gsy。
2、数据库Primary Database配置
Data Guard是要求在Primary Database端进行配置要求的。具体包括如下:
ü 归档模式切换。Data Guard运行的基础是Redo Log传输,Primary Database要求进行归档模式配置;
ü Force Logging配置,确保Redo Log生成完整性;
ü Standby Log创建;
ü 主库参数配置;
修改归档模式,切换到归档日志方式。默认情况下,如果开启recovery area,归档日志是会放在recovery area中的。
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values and pointers to data rows, and is suitable for non-primary key column queries.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

MySQL supports four index types: B-Tree, Hash, Full-text, and Spatial. 1.B-Tree index is suitable for equal value search, range query and sorting. 2. Hash index is suitable for equal value searches, but does not support range query and sorting. 3. Full-text index is used for full-text search and is suitable for processing large amounts of text data. 4. Spatial index is used for geospatial data query and is suitable for GIS applications.

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.
