Oracle Data Guard

一. What is Oracle Data Guard

Oracle Data Guard ensures high availability, data protection, and disaster recovery for enterprise data.

It contains one primary database and one or up to nine standby databases.

If primary database becomes unavailable for mistakes, Data Guard can switch any standby database to primary role, make sure the minimizing downtime and data losing.

1. Primary Database

Normally, means our production database, it can be a single-instance database or a RAC database which has low tolerance for downtime and data losing.

2. Standby Database

A standby Database is a consistently copy of the primary database, so it can used as primary role if the primary database corrupt. It setup with the backup copy of the primary database, andsynchronize automatically by transmitting and applying redo log from the primary.

  • Physical Standby

             The standby database has the same physical disk structure as primary database. A physical standby database is kept synchronized with the primary database, thoughRedo Apply, which recovers the redo data received from the primary database and applies the redo to the physical standby database.

  • Logical Standby

             Contains the same logical structure of the primary database, but the physical disk structure can be different. The logical standby database is kept synchronized with the primary database thoughSQL Apply, which transforms the data in the redo received from the primary database into SQL statements and then executing the SQL statements on the standby database.

3. Data Guard Protection Modes
  • Maximum protection

             This protection mode ensures that no data loss will occur if the primary database fails. To provide this level of protection, the redo data needed to recover each transaction must be written to both the local online redo log and to the standby redo log on at least one standby database before the transaction commits. To ensure data loss cannot occur, the primary database shuts down if a fault prevents it from writing its redo stream to the standby redo log of at least one transactionally consistent standby database.

  • Maximum performance

              This protection mode (the default) provides the highest level of data protection that is possible without affecting the performance of the primary database. This is accomplished by allowing a transaction to commit as soon as the redo data needed to recover that transaction is written to the local online redo log. The primary database's redo data stream is also written to at least one standby database, but that redo stream is written asynchronously with respect to the transactions that create the redo data.

  • Maximum availability

             This protection mode provides the highest level of data protection that is possible without compromising the availability of the primary database. Like maximum protection mode, a transaction will not commit until the redo needed to recover that transaction is written to the local online redo log and to the standby redo log of at least one transactionally consistent standby database. Unlike maximum protection mode, the primary database does not shut down if a fault prevents it from writing its redo stream to a remote standby redo log. Instead, the primary database operates in maximum performance mode until the fault is corrected, and all gaps in redo log files are resolved. When all gaps are resolved, the primary database automatically resumes operating in maximum availability mode.

4. Role Transitions
  • Switchover

             During a switchover, the primary database transitions to a standby role, and the standby database transitions to the primary role.

  • Failover

二.  How to setup Data Guard

  • Set primary to force logging [primary]

              SQL> alter database force logging;

              SQL> select force_logging from v$database;

              FORCE LOGGING can be used on tablespace or database level to force logging of changes to the redo.

  • Enable archivelog on primary database [primary]

             SQL> STARTUP MOUNT;

             SQL> ALTER DATABASE ARCHIVELOG;

             SQL> ALTER DATABASE OPEN;

             SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

  • Create password file [primary]

             $ORACLE_HOME/bin/orapwd file=${ORACLE_HOME}/dbs/orapw password=change_on_install

             Copy password file from primary database to standby database ( under $ORACLE_HOME/dbs/) named as orapw$ORACLE_SID

  • Create listener and tns [primary,standby]

             Make sure primary and standby can be connected via tns.

  • Create standby control file [primary]

             Alter database create standby controlfile as '$path/**.ctl';

             Copy **.ctl to standby database, suitable location which show in pfile.

  • Create standby redo log files

             Alter database add standby logfile group * ($path/**.log) size **;

  • Configure initial parameters
  • Duplicate database

             Duplicate target database for standby from active database nofilenamecheck ;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值