Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » Oracle 12c+

一句话描述12.1新特性(三)

本篇内容主要体现在高可用性方面,比如java程序可以实现在恢复故障后继续之前剩下的步骤,事务卫士,Data Guard特性的增强,RMAN特性的增强等方面。

High Availability

Application Continuity
  Application Continuity for Java
  如果要屏蔽终端用户的中断,必须明确地要求开发人员处理软件、硬件和通信方面的故障。从10g开始,Fast Application Notification (FAN)能快速地把异常情况发送到应用程序。但是FAN或其他Oracle技术不能把最后事务的结果报告给应用程序或从应用方面不能恢复正在执行中的请求。这样的话,故障会导致客户的很多不便。比如用户可能无意中重复购买并对同一个发票多次付款。在有问题的情况下,管理员需要重启中间件来处理这种情况。应用程序的连续性是一个应用程序的独立功能,试图从应用程序的角度来恢复不完整的请求,并从最终用户屏蔽许多系统,通信,硬件故障,和存储中断。



  1. 1.The client application makes a request, which is passed to a middle tier (such as the JDBC Thin driver, Universal Connection Pool, or WebLogic Server or third party pool) or directly to the database using the JDBC replay driver.

  2. 2.The JDBC replay driver issues each call in the request.

  3. 3.A FAN unplanned or planned down interrupt or recoverable error occurs. FAN/FCF then aborts the dead physical session.

  4. 4.Application Continuity begins the replay and does the following:

    1. 1.Replaces the dead physical session with a new clean session and rewires FAN in case a later error occurs during or after replay.

    2. 2.Prepares for replay by using Transaction Guard to determine the outcome of the in-flight transaction if one was open.

    3. 3.Optionally, calls back using a labeling callback or reconnect callback for the initial state.

    4. 4.Rebuilds the database session, recovering the transactional and nontransactional states, and validating at each step that the data and messages seen by the client driver are the same as those that the client may have seen and used to make a decision.

    5. 5.Ends the replay and returns to runtime mode.

    6. 6.Submits the last queued call.

      This is the last call made when the outage was discovered. During replay, only this call can execute a COMMIT. A COMMIT midway through rebuilding the session aborts replay (excluding autonomous transactions).

  5. 5.The response is returned to the application.

    If replay succeeded, the application can continue with the problem masked. If not, the application must handle the original error.

The behavior of Application Continuity after a communication failure depends on the Oracle products and technologies involved. For example:

  • 1.If you use Oracle Real Application Clusters or an Active Data Guard farm, after the connection instance is reestablished on another running instance, Application Continuity attempts to rebuild the session and replay the last transaction if there is one in flight.

  • 2.If you use Oracle Data Guard and fail over to a standby site, Application Continuity connects to the failover instance and attempts to rebuild the session and replay the last transaction there if a transaction was in flight. (Application Continuity does not replay if the Data Guard switchover or failover has lost data, and if this is not Active Data Guard reader farm with approved lags.)

  • 3.If you are using Oracle RAC or Oracle RAC One and not using Data Guard, and if an outage causes a break in all public networks or causes the database or database session to shut down briefly, Application Continuity attempts to rebuild the session and replay the last transaction (if a transaction was in flight) against the database after connectivity is restored.

使用以下的Oracle technologies可以实现Application Continuity:
JDBC Thin Oracle replay driver
Universal Connection Pool
WebLogic Server(from 12.1.2,GridLink datasource)

Transaction Guard
事务防护提供了一个通用的工具,用于应用程序在最一次执行的情况下,计划和计划外的中断和重复提交。应用程序使用一个新的概念叫逻辑事务ID(ltxid)来确定一个数据库会话的最后交易的结果如果出现中断。如果不使用事务守护,可能会出现因为提交重复的事务而导致逻辑上的损坏。相关的表示LTXID_TRANS
使用事务卫士的前提条件
   Use Oracle Database Release 12.1 or later.
   Use an application service for all database work. Create the service using srvctl if using RAC or DBMS_SERVICE if not using RAC. You may also use gdsctl.
   Set the following properties on the service – COMMIT_OUTCOME = TRUE for Transaction Guard
   Grant execute permission on DBMS_APP_CONT package to the application user
   srvctl add service -d FIN -s GOLD -r serv1 -a serv2 -commit_outcome TRUE -retention 86400 
SQL> desc LTXID_TRANS
 Name	  Null?    Type
 ----------------------------------------- -------- ----------------------------
 MAJ_VERSION	  NOT NULL NUMBER
 MIN_VERSION	  NOT NULL NUMBER
 INST_ID	  NOT NULL NUMBER
 DB_ID	  NOT NULL NUMBER
 SESSION_GUID	  NOT NULL RAW(64)
 TXN_UID	  NOT NULL NUMBER
 COMMIT_NO	  NOT NULL NUMBER
 START_DATE	  NOT NULL TIMESTAMP(6) WITH TIME ZONE
 SERVICE_ID	  NOT NULL NUMBER
 STATE	  NOT NULL NUMBER
 FLAGS	  NOT NULL NUMBER
 REQ_FLAGS	  NOT NULL NUMBER
 ERROR_CODE	  NOT NULL NUMBER
SQL>
http://www.oracle.com/technetwork/database/database-cloud/private/transaction-guard-wp-12c-1966209.pdf 

Global Data Services
之前只适用于RAC。现在单节点的Active Data Guard或GoldenGate用户也可以使用这个特性。

Oracle ASM Disk Scrubbing
  这个新特性用来检查数据逻辑上的损坏并修复他们如果磁盘组的属性为High或Normal(主要是通过读取镜像磁盘的数据来恢复)。她不会对生产环境中的正常I/O有影响。用法示例:
   SQL> ALTER DISKGROUP data SCRUB POWER LOW;
   SQL> ALTER DISKGROUP data SCRUB FILE '+DATA/ORCL/DATAFILE/example.266.806582193' REPAIR POWER HIGH FORCE;
   SQL> ALTER DISKGROUP data SCRUB DISK DATA_0005 REPAIR POWER HIGH FORCE;

Online Operations
  Online DDL Capabilities
   在之前的版本中,以下操作需要DML-blocking锁。你可以在以下DDL操作中加上Online关键词,这样的话允许DML操作。
    DROP INDEX ONLINE
    DROP CONSTRAINT ONLINE
    SET UNUSED COLUMN ONLINE
    ALTER INDEX UNUSABLE ONLINE
    ALTER INDEX [VISIBLE | INVISIBLE]

Invisible Columns
  用户可以控制是否显示列。不可见列不会显示除非在select中明确指定。
  CREATE TABLE hr.emp (
            empno      NUMBER(5) PRIMARY KEY,
            ename      VARCHAR2(15) NOT NULL,
            sal        NUMBER(7,2) INVISIBLE);

Lock Timeout for FINISH_REDEF_TABLE
  现在,你可以指定FINISH_REDEF_TABLE试图交换源和临时表和获取排他锁的时间,如果操作超时,操作会退出。这样就增加了FINISH_REDEF_TABLE的灵活性,用户不需要无限期的等待或强制在线重定义的会话退出。

Move a Data File Online
  在线移动数据文件意味着许多的维护操作,如移动数据到另一个存储设备或移动数据库为Oracle自动存储管理(Oracle ASM)可以在用户正常访问系统下执行。这将确保服务的连续性和满足服务水平协议(SLA)的运行时间。

Multiple Indexes on Same Set of Columns
  可以在同一组列上创建多个索引,只要某个特征是不同的。符合这个特征的是
   B-tree versus bitmap
   Different partitioning strategies
   Unique versus non-unique



Single Command REDEF_TABLE to Redefine Table or Partition

  REDEF_TABLE是DBMS_REDEFINITION下的一个存储过程,她允许单步操作轻松定义表或分区在以下特定的条件:
   Tablespace changes for table or partition, index, and LOB columns.
   Compression type changes for table or partition, index key, and LOB columns.
   STORE AS SECUREFILE or BASICFILE for LOB columns.



Support Redefinition of Tables With VPD Policies

在线重定义可以重新定义那表上有Virtual Private Database (VPD)策略的表。这个特性使这些操作免去了宕机时间。

Oracle Data Guard Enhancements
  Advanced Data Guard Broker Manageability
   通过Broker配置、管理DG的功能加强了,包括额外的健康检查,监控,错误报告,问题诊断和解决方案等
   VALIDATE DATABASE VERBOSE 'South_Sales';
   VALIDATE FAR_SYNC;

  Oracle Data Guard Broker Support for Cascaded Standby Databases
   通过DG Broker可以管理配置级联的standby database。

  Fast Sync
   DG最大可用性支持使用noaffirm日志传输属性。当备库在内存中接收到来自主库数据时,备库返回确认信息给主库,而不等待RFS(Remote File Server)写入到备库的重做日志文件。在使用最大可用性和同步传输重做日志的情况下,此功能增加了主库的性能。Fast Sync分离了由于备库缓慢的I/O造成主库的性能问题。
   Far Sync Instance是一个轻量级的Oracle实例,类似一个简单的的Cascading Standby Database,只有相应的参数文件、控制文件、SRLs(standby redo logs)和归档日志,没有数据文件,只能启动到mount状态。可以把它理解为一个Redo中转站,它可以以同步(SYNC)或异步(ASYNC)方式接收主库传过来的Redo, 然后写入SRL(Standby Redo Logs)并归档到本地,同时以异步方式(async)实时(Real-Time)分发给Data Guard环境中远程的各个Standby(Cascaded Standby of the Primary Database),最多支持29个远端站点。

  Real-Time Apply is Default Setting for Data Guard
   在之前的版本中,当用SQL命令行创建DG配置时,默认的配置是在备库上应用归档日志。从12.1开始,默认的配置采用real-time应用模式直接从SRL读取。

  Resumable Switchover Operations
   在之前的DG Broker版本中,如果switchover遇到问题,没有办法去解决这些问题并且继续做完swithover剩下的步骤。在12.1的版本中有改善,解决问题后,可以继续做剩下的步骤。

  Active Data Guard Enhanced Security
   一个新的视图RO_USER_ACCOUNT用来跟踪动态用户登录失败的信息,这些信息用来锁定访问用户,允许DBA在备库上重启这些账户如果需要。

  Active Data Guard Support for DML on Global Temporary Tables,sequence
   这些特性扩展了把只读应用从生产环境移到Active Data Guard standby database的数量。即使备库在只读模式下,报表应用程序可以写入全局临时表而不需要做任何修改。在备库上也支持序列,更完美的支持在备库上构建报表系统

  Active Data Guard Real-Time Cascade
   一个备库级联redo到其他备库,可以直接传输redo到其他备份当他接收到来自主库的日志。级联备库实时接收重做日志。他们不需要再等到SRL归档完之后才传输重做日志。

Data Guard Rolling Upgrade Enhancements
  Data Guard Rolling Upgrade Support for Advanced Data Types
   支持更多的数据类型,Data types include XMLType stored as binary XML, XMLType stored in object-relational format, objects and collections, Database File System (DBFS), XDB, Oracle Spatial and Graph, Oracle Text, Oracle Multimedia, Label Security, and Oracle SecureFiles (deduplication and fragment operations).
   
  Data Guard Rolling Upgrade Support for XDB Repository
   XML DB Repository支持DG滚动升级
 
  Disaster Protection During Database Rolling Upgrade
   备库在升级过程中仍然能够接收来自主库的redo当备份处于upgrade mode
 
  Oracle Data Guard Broker Support for Database Rolling Upgrades
   DG broker支持滚动升级,有了这个特性,DG broker的配置可以保留,升级后无需重建。
  
  Rolling Upgrade Using Active Data Guard
   Active DG提供了几个新的PL/SQL包和DDL命令来自动完成之前手工步骤进行的滚动升级到新的补丁集,新的版本,或其他一些计划的维护等。自动化包括处理switchover到新版本的生产库。还会在每一步做深入的校验。如果在升级过程中遇到问题,用户可以选择纠正错误继续升级或回退到之前的配置。包名称是DBMS_ROLLING
   INIT_PLAN Procedure
   Initializes a rolling operation plan with system-generated default values.
   
   DESTROY_PLAN Procedure
   Destroys any existing rolling operation plan, its parameters, and all resources associated with the rolling operation.
   
   BUILD_PLAN Procedure
   Validates plan parameters and creates or modifies a rolling operation plan.
   
   SET_PARAMETER Procedure
   Modifies a rolling operation parameter.
   
   START_PLAN Procedure
   Starts the rolling operation.
   
   SWITCHOVER Procedure
   Performs a switchover between the current primary database and the transient logical standby database.
   
   FINISH_PLAN Procedure
   Finalizes the rolling operation.
   
   ROLLBACK_PLAN Procedure
   Completely rolls back the rolling operation.

  SQL Apply支持Extended Data Type Support (EDS),支持Objects, Collections, and XMLType,SecureFiles LOBs
   EDS supports SDO_GEOMETRY, XMLType stored in object-relational format, XMLType stored as binary XML, objects, and objects with varray columns.

RMAN Enhancements
  Active Database Duplication Enhancements
   和之前的相比(之前是image-copy方式),多了SECTION SIZE选项,支持大文件分割处理,采取并行,加快处理速度,还支持压缩。
   DUPLICATE TARGET DATABASE TO dup_db
     FROM ACTIVE DATABASE
     PASSWORD FILE
     USING COMPRESSED BACKUPSET;

  Cross-Platform Backup and Restore
    RMAN命令支持创建跨平台的备份、还原,不过是有前提的,source和target的endian必须一样。
     RESTORE
     FROM PLATFORM 'Solaris Operating System (x86-64)'
     FOREIGN DATABASE TO NEW
     FROM BACKUPSET '/tmp/xplat_restores/db_trans.bck';

  DUPLICATE Enhancements

   这个特性提供了更多的灵活性。比如NOOPEN选项,作为升级过程的一部分,这个选项允许复制一个新的数据库并保持这个数据库在一个准备升级的模式,然后再执行升级脚本等工作。


  Multisection Image Copies
   数据文件的镜像复制可以使用SECTION SIZE,这样一个比较大的文件,可以通过并行的方式来备份。
   BACKUP AS COPY SECTION SIZE 150M DATAFILE '/oradata/dbs/users_df.dbf';

  Multisection Incremental Backups
   增量备份支持分片操作,提升性能
    BACKUP
    FORMAT '/tmp/datafiles/db_incr_ms_%U'
    INCREMENTAL FROM SCN 8564
    SECTION SIZE 400M
    DATABASE;

  Network-Enabled RESTORE
   通过网络服务可以恢复数据文件。比如在主库上,通过网络还原命令恢复丢失的数据文件,控制文件,或表空间等。
    RESTORE DATAFILE '/oradata/datafiles/sales.dbf' FROM SERVICE standby_tns SECTION SIZE 120M;

  RMAN Command-Line Interface Enhancements
   RMAN命令行的增强,主要在以下几点:
    运行SQL时,不需要在加上sql命令
    支持select操作

    支持DESCRIBE表和视图


  Storage Snapshot Optimization
   第三方存储快照满足以下条件,数据库在非backup mode下可以备份
   Database is crash-consistent at the point of the snapshot.
   Write ordering is preserved for each file within a snapshot.
   Snapshot stores the time at which a snapshot is completed.
   RECOVER DATABASE UNTIL TIME '10/15/2012 15:00:00' SNAPSHOT TIME '10/15/2012 14:00:00';

  Table-Level Recovery From Backups
   支持表级别的恢复,这个很管用,好东西。会生成dmp文件,默认会导入数据库,可以使用NOTABLEIMPORT只生成dmp文件。
    RECOVER TABLE SCOTT.EMP, SCOTT.DEPT
    UNTIL TIME 'SYSDATE-1'
    AUXILIARY DESTINATION '/tmp/oracle/recover'
    DATAPUMP DESTINATION '/tmp/recover/dumpfiles'
    DUMP FILE 'emp_dept_exp_dump.dat'
    NOTABLEIMPORT;


Reference

http://docs.oracle.com/database/121/NEWFT/chapter12101.htm#NEWFT002

http://www.oracle.com/technetwork/database/database-cloud/private/transaction-guard-wp-12c-1966209



关键词:cloud oracle 

相关文章

oracle cloud native solutions
Oracle Kubernetes Engine
关于Java的那些事
Terraform,docker,wercker,k8s
Vagrant with oracle
Install Oracle Database 19c on X86
Install oracle products on docker
一图了解Oracle GoldenGate实现Oracle到Oracle复制的前世今生
Exadata最权威最完整的学习资料
Oracle数据库C函数解析
MySQL Cookbook for Oracle DBA
Full Transportable Export/Import(fxtts)
Top