- 浏览: 1019856 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (529)
- 服务器 (8)
- jsp (1)
- java (6)
- AIX (1)
- solaris (3)
- linux学习 (53)
- javaScript (2)
- hibernate (1)
- 数据库 (74)
- sql语句 (8)
- oracle 学习 (75)
- oracle 案例 (42)
- oracle 管理 (42)
- Oracle RAC (27)
- oracle data guard (12)
- oracle 参数讲解 (14)
- Oracle 字符集 (8)
- oracle性能调优 (24)
- oracle备份与恢复 (12)
- oracle Tablespace (9)
- oracle性能诊断艺术 (1)
- oracle 11g学习 (5)
- oracle streams (1)
- oracle upgrade and downgrade (4)
- db2学习 (13)
- db2命令学习 (2)
- mysql (28)
- sql server (30)
- sql server 2008 (0)
- 工具 (10)
- 操作系统 (3)
- c++ (1)
- stock (1)
- 生活 (5)
- HADOOP (2)
最新评论
-
massjcy:
...
如何将ubuntu文件夹中文名改为英文 -
skypiea:
谢谢。。。
终于解决了。。。
Oracle 10.2.0.4(5)EM不能启动的解决方案(Patch 8350262) -
qwe_rt:
引用vi /etc/sysconfig/network 请问 ...
Linux操作系统下配置静态IP上网 -
liuqiang:
sudo killall -9 apache2
ps 和 kill 命令详解 -
dazuiba:
引用*绝杀 kill -9 PID 当使用此命令时,一定要通过 ...
ps 和 kill 命令详解
Make Recovery Logical
By Darl Kuhn
Use Data Guard's logical standby database for recovery and 24/7 availability.
Many enterprises have conflicting requirements for transaction processing and business reporting. For example, decision reporting cannot be allowed to degrade the performance of online transaction processing. Additionally, mission-critical systems are required to be highly available, with minimal downtime and no data loss. Logical standby databases resolve these disparate requirements by providing fault-tolerant disaster recovery protection while also making available a 24/7 reporting replica of real-time production data.
Data Guard is Oracle's integrated disaster recovery solution. Data Guard ships with two types of disaster recovery standby databases: physical and logical. Physical standby technology has been available since Oracle7 Release 7.3. Data Guard keeps the physical standby database in sync with production data by automatically copying and applying primary redo data to the standby database. This results in a standby database that is an exact block-for-block copy of your primary production database.
Logical standby differs from physical standby in two significant ways: the manner in which redo is applied and uptime availability for reporting. The logical standby database uses LogMiner and SQL Apply technology to transform the primary database redo data into SQL that is then applied to the logical standby database. This allows your logical standby database to be available 24/7 for querying, while simultaneously applying data manipulation language (DML) and data definition language (DDL) statements from the primary database.
This article describes key improvements to the logical standby database feature in Oracle Database 10g and how to implement a logical standby database.
Logical Standby in Oracle 10g
The logical standby feature was first released in Oracle9i Release 2 and was greatly enhanced in Oracle Database 10g. In addition to a greater ease of implementation, the following are significant improvements to Data Guard's logical standby feature in Oracle Database 10g:
No downtime required to implement logical standby feature
Real-time application of DML/DDL (SQL Apply) to logical standby database
New support for more datatypes
These enhancements reduce the cost of implementation and improve functionality while still providing you an integrated no-data-loss disaster recovery solution.
Implementing Oracle Database 10g Logical Standby
If you struggled with implementing logical standby in Oracle9i, you'll be pleased with the streamlined Oracle 10g install. Documented next are the steps for setting up a logical standby in the default maximum performance mode in a UNIX environment. This example assumes that you have identical mount points and directory structures on your primary and standby servers.
Step 1. Enable logging. On your primary database, instruct Oracle Database to force all logging of changes to the redo, even if nologging or unrecoverable data loads are performed:
SQL> alter database force logging;
Verify that forced logging has been enabled on your primary database, by issuing the following:
SQL> select force_logging
from v$database;
Step 2. Create a password file for the primary database. Every database in a Data Guard environment must use a password file. Additionally, the password used by SYS must be the same for all primary and standby databases. On your primary database server, navigate to ORACLE_HOME/dbs and issue the following command:
$ orapwd file=orapw<sid_name>
password=top_secret
Also, instruct Oracle Database to use the newly created password file, by setting the init.ora/spfile remote_login_ passwordfile parameter to either EXCLUSIVE or SHARED.
Step 3. Configure the primary database init.ora/spfile. If you are using an spfile, you may find it easier to switch to using an init.ora file while implementing your logical standby. After implementation, you can easily switch back to using an spfile. The examples in this article use an init.ora file.
In this example, BRDSTN is the database name of both the primary and the standby. Primarydb is the Oracle Net service name of the primary database, and standbydb is the Oracle Net service name of the standby database. Include the contents of Listing 1 in the init.ora file on your primary database.
Step 4. Enable archiving. Ensure that your primary database is in archive log mode:
SQL> archive log list;
If archiving hasn't been enabled on your primary database, run the following:
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;
Note that the LOG_ARCHIVE_START initialization parameter is obsolete in Oracle Database 10g. Archiving is automatically enabled when you put your database into archive log mode.
Step 5. Put a primary key on every replicated table. The SQL Apply process must be able to match rows changing in the primary database to the corresponding rows changing in the standby database. SQL Apply can't use a rowid, because it can be different between the two databases. Therefore, each table being replicated to a logical standby database must have a primary or unique key defined.
To identify tables that have rows that cannot be uniquely identified, query the DBA_LOGSTDBY_NOT_UNIQUE view.
Step 6. Enable supplemental logging. Enabling supplemental logging will direct Oracle Database to add a small amount of extra information to the redo stream. The SQL Apply process uses this additional information to maintain tables being replicated. On your primary database, enable supplemental logging as follows:
SQL> alter database add supplemental log data (primary key, unique index) columns;
SQL> alter system archive log current;
You can verify that supplemental logging has been enabled, by issuing the following on your primary database:
SQL> select supplemental_log_data_pk, supplemental_log_data_ui
from v$database;
Step 7. Take a backup of your primary database, and move it to the standby machine. Take an offline or online backup of your primary database and copy it to your standby server. You need to back up and copy only data files, not online redo files or controlfiles.
Step 8. Create a logical standby controlfile. You must create a special logical standby database controlfile and then copy it to your standby machine. On your primary database, issue the following SQL:
SQL> alter database create logical standby controlfile
as '/ora01/oradata/BRDSTN/sb.ctl';
Note the use of the keyword logical; it's critical to use the correct syntax.
After creating the logical standby controlfile, copy it to your standby machine. In this example, the standby controlfile must be placed in the /ora01/ oradata/BRDSTN directory on the standby machine.
Step 9. Create init.ora for logical standby. Copy the primary init.ora file to the standby machine, and then make the necessary modifications for your logical standby database, as shown in Listing 2.
Step 10. Create a password file for the logical standby database. As noted in Step 2, every Oracle Data Guard-enabled database needs a password file using the same password. On your standby machine, go to ORACLE_HOME/dbs and issue the following command:
$ orapwd file=orapw<sid_name>
password=top_secret
Step 11. Configure Oracle Net for primary and standby databases. The primary and logical standby databases need to communicate with each other via Oracle Net. Ensure that both the primary and the logical standby databases have listeners and that the appropriate Oracle Net service information is in place. Here are examples of the entries in the tnsnames.ora file on both the primary and the standby servers:
primarydb =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp) (PORT=1521) (HOST=primary_host))
(CONNECT_DATA=(SERVICE_NAME=BRDSTN)))
standbydb=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp) (PORT=1521) (HOST=standby_host))
(CONNECT_DATA=(SERVICE_NAME=BRDSTN)))
Also, Oracle recommends enabling dead connection detection by the setting of sqlnet.expire_time to one minute in your sqlnet.ora file, as shown:
sqlnet.expire_time=1
Step 12. Start up and activate the logical standby database. On your logical standby server, start up and activate your logical standby database, as follows:
SQL> startup mount;
SQL> alter database
recover managed standby database;
You may need to give the above ALTER command a few minutes to complete. When it is finished, you can activate your standby database as follows:
SQL> alter database activate standby database;
Step 13. Rename your logical standby database. Renaming your logical standby database is not a required step. However, Oracle recommends renaming your logical standby database to ensure that the logical standby is never confused with the primary database.
Use the nid utility to reset the name of your logical standby database. Before running nid, shut down and start up your database in mount mode.
SQL> shutdown immediate;
SQL> startup mount;
$ nid target=sys/top_secret dbname=BRDLS
In this example, BRDLS is the new name of your logical standby database. You should now see the following line prompting you:
Change database ID and database name BRDSTN to BRDLS? (Y/[N]) =>
Enter Y and a return. At this point, you should see at the bottom of the message text:
DBNEWID - Completed successfully.
Step 14. Change the logical standby db_name in the init.ora file. Now you need to change the db_name initialization parameter. For example, in your logical standby database init.ora file, make this change:
db_name=BRDLS
Step 15. Re-create the password file for the logical standby database. After running the nid utility, you need to re-create your logical standby password file. To do this, navigate to ORACLE_HOME/dbs, remove the old password file, and issue the following OS command:
$ orapwd file=orapw<sid_name>
password=top_secret
Step 16. Open the logical standby database with resetlogs. You can now make your logical standby database accessible. Start up your database, and open it with the RESETLOGS command, as follows:
SQL> startup mount;
SQL> alter database open resetlogs;
Step 17. Add temp files to the logical standby database. You'll need a temp tablespace in your logical database if you plan to do any reporting or if you ever transition the logical standby database to a primary database role. Add the temp file(s) to the logical standby as they existed on the primary database:
SQL> alter session disable guard;
SQL> alter tablespace temp add tempfile '/ora01/oradata/BRDSTN/temp01.dbf'
size 500M reuse;
SQL> alter session enable guard;
Step 18. Restart the logical standby database SQL Apply process. All you need to do now is restart the SQL Apply process on your logical standby database:
SQL> alter database start logical standby apply;
You now have a fully functioning logical standby database.
Postimplementation Checks
I recommend continuously viewing, during the previous setup process and postimplementation, what's being written to the alert.log file for both the primary and the logical databases. The information that Data Guard writes to the alert.log file is fairly informative and will help you quickly isolate and resolve problems. To monitor the installation progress in a UNIX environment, navigate to your background dump directory destination and issue this command:
$ tail -f alert_<sid>.log
There are also many Data Guard views that you can use to monitor the status. On the logical standby database, issue this query to view which archive redo logs have arrived and whether they've been applied or not:
SQL> select sequence#, applied
from dba_logstdby_log order by 1;
To monitor the status of the SQL Apply process, run this statement:
SQL> select name, value
from v$logstdby_stats
where name = 'coordinator state';
NAME VALUE
------------------ ------------
coordinator state INITIALIZING
When you first set up a logical standby database, the coordinator state will have the value of INITIALIZING. Depending on the number of objects replicated, it may be in this mode for several hours. This initialization delay occurs only when you first set up your logical standby.
After initialization, the coordinator state value will change to APPLYING. When this occurs, redo is now being mined on the primary database and the resulting SQL statements are being applied to the logical standby database.
Tuning Your Logical Standby
This section discusses the following methods to enhance performance in your logical standby database:
Adding indexes/materialized views
Analyzing objects
Tuning the shared pool
Setting PARALLEL_MAX_SERVERS
If you need to add indexes or materialized views to your logical standby database to improve performance, you can do so independent of your primary database objects. When you make changes, however, you must first disable the guard mechanism that prevents changes to objects maintained by the SQL Apply process. For example, if you want to add an index to the CUSTOMER_NAME column of your CUSTOMERS table, issue the following:
SQL> alter session disable guard;
SQL> create index customer_i1
on customer(customer_name);
SQL> alter session enable guard;
If you analyze your primary database objects, the statistics generated are not propagated to your logical standby database. Therefore, it's critical that you analyze your logical standby objects as required. For example, after a large percentage of the data has changed in your APPS schema, issue the following command on your logical standby database:
SQL> exec -
dbms_stats.gather_schema_stats(
ownname=>'APPS',-
estimate_percent=>
dbms_stats.auto_sample_size,-
cascade=>true);
The SQL Apply process makes heavy use of the shared pool, so as a general guideline, allocating more memory to the shared pool should improve the SQL Apply performance. By default, the SQL Apply process will use as much as 30MB of the memory in the shared pool. You can limit the amount of shared pool resources that the SQL Apply process uses by running the DBMS_LOGSTDBY.APPLY_SET procedure. For example, to limit the amount used in the shared pool to 20MB, issue the following SQL:
SQL> exec dbms_logstdby.apply_set('MAX_SGA',20);
Next Steps
READ more about Data Guard
Oracle Data Guard Concepts and Administration
"Oracle9i Data Guard: SQL Apply Best Practices"
Oracle Data Guard Overview
"Data Guard SQL Apply: Back to the Future"
The SQL Apply mechanism was engineered to use parallel processes to transform and apply SQL. It will use the PARALLEL_MAX_SERVERS initialization parameter to determine the maximum number of parallel processes to spawn. Oracle recommends that you set this value to at least 5 on a logical standby database, and for best results set it to 9. You can limit the number of processes used, by calling the DBMS_LOGSTDBY.APPLY_SET procedure. The following example shows how to limit the number of processes to 8:
SQL> exec dbms_logstdby.apply_set('MAX_SERVERS',
8);
Skipping Application of SQL
It's fairly easy to configure your logical standby database not to apply unwanted SQL statements. You must first disable the logical standby apply process, specify changes, and then reenable the apply process. This example shows how to stop DML and DDL for the APPS schema's INVOICES table:
SQL> alter database stop logical standby apply;
SQL> execute dbms_logstdby.skip('SCHEMA_DDL', 'APPS', 'INVOICES');
SQL> execute dbms_logstdby.skip('DML', 'APPS', 'INVOICES');
SQL> alter database start logical standby apply;
To revert back to applying SQL on objects, use the dbms_logstbdy.unskip procedure. This example demonstrates how to resume application of SQL to the INVOICES table:
SQL> alter database stop logical standby apply;
SQL> execute dbms_logstdby.unskip('SCHEMA_DDL', 'APPS', 'INVOICES');
SQL> execute dbms_logstdby.unskip('DML', 'APPS', 'INVOICES');
SQL> alter database start logical standby apply;
The Logical Conclusion
Oracle Data Guard logical standby databases are configurable for guaranteed no-data-loss protection, with the benefit of being continuously available for reporting on a real-time copy of production data. This allows you to use one disaster recovery tool as a solution for many different business requirements. The Oracle Database 10g edition of the logical standby database is fairly easy to implement, with minimal impact on the primary production database.
发表评论
-
利用物理standby 进行数据库迁移总结
2012-06-19 20:35 1469物理standby进行迁移,该方法适用于在相同操作系统平台,相 ... -
oracle 快照数据库和物理备库的转换
2012-06-19 13:32 1771SQL> select * from v$version ... -
oracle 11g 利用duplicate from active database 创建data guard
2012-06-07 01:53 1156操作系统版本:oracle@admtps-Sun-Fire-X ... -
Oracle10g配置Dataguard的相关参数解释
2011-06-02 01:56 1039文档里总结的很全, 不过有几个错误的(如fal_server和 ... -
Oracle10gR2 主备自动切换之客户端Failover配置
2011-06-02 01:43 11361. 主库检查和设置假设新增的服务名为ORCL_TAF.LK. ... -
standby 管理和维护
2011-01-20 10:18 1231查询库状态:SQL> select name,SWITC ... -
Oracle Standby 安装步骤
2011-01-20 10:11 1323建立数据库:环境要求OS 版本一样;Oracle 版本必须一样 ... -
一步一步学Data Guard之基础篇
2011-01-20 10:07 1332它有无数个名字,有人 ... -
Oracle Dataguard三种保护模式特点总结
2010-10-19 16:30 1452Oracle Dataguard提供了三种数据保护模式,在此分 ... -
与 redo log 有关的参数学习
2010-03-25 00:16 10301. MAXLOGFILES The MAXLOGFILES ... -
在 RHEL5 上配置 Oracle 10g Data Guard
2009-11-11 09:52 18390、规划 Host IP DB_NAM ...
相关推荐
在 MySQL 中,这通常通过简单的配置实现,但在 Oracle 中,由于其复杂性,实现读写分离可以采用多种方式,如 RAC、Streams、Golden Gate 或 Logical Standby。 Logical Standby 是 Oracle Data Guard 功能的一部分...
Oracle10g的复制技术允许数据在不同数据库之间同步,包括Snapshot复制、Logical Standby和GoldenGate。Merge功能则用于合并多个数据源,实现数据集成。 9. Grid Computing架构: Oracle10g引入了Grid ...
### Oracle Dataguard 逻辑 Standby 建立详解 #### 一、Oracle Dataguard 概述 Oracle Dataguard 是 Oracle 数据库提供的一种高可用性和灾难恢复解决方案,通过在主数据库(Primary Database)与备数据库(Standby...
Oracle10g DataGuard远程容灾技术是Oracle数据库系统中的一种高级高可用性和灾难恢复解决方案。DataGuard的主要目标是提供数据保护,确保在面临硬件故障、软件错误或自然灾害等不可预知事件时,能够快速恢复业务操作...
### AIX平台上Oracle 10g RAC 架构选型的最佳实践 #### 概述 在AIX平台上部署Oracle 10g RAC(Real Application Clusters)系统时,合理的架构选型对于确保系统的高可用性、性能及可管理性至关重要。本文将基于给定...
ERWin是一款功能强大的数据建模工具,可以连接多种类型的数据库,包括SQL Server 2000和Oracle 10g。然而,在连接数据库时,用户可能会遇到各种错误,例如数据库不存在、表不存在等错误。下面我们将详细介绍ERWin...
Oracle 10g RAC (Real Application Clusters) 和 Data Guard 是两个重要的 Oracle 数据库管理技术,用于构建高可用性和灾难恢复解决方案。本篇将详细阐述这两种技术的配置过程及工作原理。 首先,Oracle RAC 是一个...
3. **高可用性**:Oracle 11g增强了高可用性特性,如数据守护(Data Guard)和逻辑复制(Logical Standby),它们可以在主数据库出现故障时提供无缝切换。另外,RAC(Real Application Clusters)允许多个实例共享...
本学习笔记涵盖了Oracle 10g Data Guard的基础知识,包括其核心组件、配置过程、保护模式,以及如何管理和操作Standby数据库。 1.3. DataGuard配置 配置Data Guard涉及以下几个主要步骤: 1. 创建和配置主数据库。...
9. **数据库复制**:了解Oracle的复制技术,如逻辑日志复制(Logical Standby)和实时应用集群(Real Application Clusters,RAC),以及它们在高可用性和灾难恢复中的应用。 10. **数据仓库**:Oracle10g在数据...
Oracle 10G Data Guard是Oracle数据库系统中用于高可用性和灾难恢复的一项重要技术。它通过创建和维护一个或多个备用数据库,确保在主数据库出现故障时,业务能够迅速切换到备用数据库,从而保证数据的安全性和服务...
Oracle 11g DataGuard是Oracle数据库系统中的一个强大特性,用于实现高可用性和灾难恢复。...在实际操作中,建议参考《Oracle11G DataGuard相同SID物理Standby搭建手册》中的详细指南,以确保成功实施。
### PowerHA 6.1 对操作系统以及Oracle 10g/11g的支持 #### 一、概述 IBM PowerHA 6.1 是一款高级的高可用性和灾难恢复解决方案,旨在为关键业务应用提供连续性支持。随着企业对数据安全与业务连续性的需求日益...
Oracle 11g Active Data Guard 是Oracle数据库系统中一种高级的数据保护和灾难恢复技术,它在主数据库运行的同时,创建并维护一个或多个只读的物理 standby 数据库。Active Data Guard 提供了实时的数据保护,使得在...
2. **设置Oracle数据库**:在Oracle 11G中启用CDC,需要创建逻辑复制表(Logical replication tables)并启动相关的数据库监听服务。这通常涉及到创建变更表空间、开启数据库归档日志模式、创建和配置捕获进程以及...
在本篇《AIX5L+ORACLE10G安装手册》中,主要涉及的是IBM AIX操作系统与Oracle 10G数据库的安装与配置。首先,我们将关注AIX系统的安装,然后是文件系统的调整,最后是Oracle 10G数据库的安装准备工作。 **AIX系统...
Oracle 10G Data Guard 是一个强大的高可用性和灾难恢复解决方案,它为Oracle数据库提供了额外的安全层,确保在出现故障时能快速恢复服务并保护数据。在这个资料包中,我们很可能会找到关于如何配置、管理和优化Data...
Oracle 10g RAC (Real Application Clusters) 和 Data Guard 是两个强大的数据库技术,用于构建高可用性和灾难恢复解决方案。在Oracle数据库系统中,RAC允许多台服务器共享同一个数据库,提供并行处理和故障切换能力...
本篇将详细阐述在Oracle 10g中如何设置Data Guard的备用数据库,以确保业务连续性和数据安全性。 首先,理解Data Guard的基础概念至关重要。Data Guard通过Redo Apply或Flashback Redo Apply技术,将生产数据库的...
Oracle DataGuard 提供了一套全面的高可用性方案,包括物理备用数据库(Physical Standby)和逻辑备用数据库(Logical Standby)。物理备用数据库是主数据库的一个实时副本,通过redo应用保持与主数据库的一致性。...