Contents
List of Examples
List of Figures
List of Tables
Title and Copyright Information
Preface
Changes in This Release for Oracle Database Development Guide
- Changes in Oracle Database 12c Release 1 (12.1.0.2)
- Changes in Oracle Database 12c Release 1 (12.1.0.1)
Part I Database Development Fundamentals
1 Design Basics
- 1.1 Design for Performance
- 1.2 Design for Scalability
- 1.3 Design for Extensibility
- 1.4 Design for Security
- 1.5 Design for Availability
- 1.6 Design for Portability
- 1.7 Design for Diagnosability
- 1.8 Design for Special Environments
- 1.9 Features for Special Scenarios
2 Performance and Scalability
- 2.1 Performance Strategies
- 2.2 Tools for Performance
- 2.3 Monitoring Database Performance
- 2.4 Using Instrumentation
- 2.5 Testing for Performance
- 2.6 Using Bind Variables
- 2.7 Using Client Result Cache
- 2.7.1 About Client Result Cache
- 2.7.2 Benefits of Client Result Cache
- 2.7.3 Guidelines for Using Client Result Cache
- 2.7.4 Client Result Cache Consistency
- 2.7.5 Deployment-Time Settings for Client Result Cache
- 2.7.6 Client Result Cache Statistics
- 2.7.7 Validation of Client Result Cache
- 2.7.8 Client Result Cache and Server Result Cache
- 2.7.9 Client Result Cache Demo Files
- 2.7.10 Client Result Cache Compatibility with Previous Releases
- 2.7.11 Where to Find More Information About Client Result Cache
- 2.8 Statement Caching
- 2.9 OCI Client Statement Cache Auto-Tuning
- 2.10 Client-Side Deployment Parameters
- 2.11 Using Query Change Notification
- 2.12 Using Database Resident Connection Pool
- 2.12.1 About Database Resident Connection Pool
- 2.12.2 Configuring DRCP
- 2.12.3 Using JDBC with DRCP
- 2.12.4 Using OCI Session Pool APIs with DRCP
- 2.12.5 Session Purity and Connection Class
- 2.12.6 Starting Database Resident Connection Pool
- 2.12.7 Enabling DRCP
- 2.12.8 Benefiting from the Scalability of DRCP in an OCI Application
- 2.12.9 Benefiting from the Scalability of DRCP in a Java Application
- 2.12.10 Best Practices for Using DRCP
- 2.12.11 Compatibility and Migration
- 2.12.12 DRCP Restrictions
- 2.12.13 Using DRCP with Custom Pools
- 2.12.14 Explicitly Marking Sessions Stateful or Stateless
- 2.12.15 Using DRCP with Oracle Real Application Clusters
- 2.12.16 Using DRCP with Pluggable Databases
- 2.12.17 DRCP with Data Guard
- 2.13 Using Runtime Connection Load Balancing
3 Security
- 3.1 Enabling User Access with Grants, Roles, and Least Privilege
- 3.2 Automating Database Logins
- 3.3 Controlling User Access with Fine-Grained Access Control
- 3.4 Using Invoker's and Definer's Rights for Procedures and Functions
- 3.5 Managing External Procedures for Your Applications
- 3.6 Auditing User Activity
4 High Availability
- 4.1 Failover and Query Replay
- 4.2 Fast Application Notification (FAN) and Fast Connection Failover (FCF)
- 4.3 Application Continuity and Transaction Guard
- 4.4 Service and Load Management for Database Clouds
5 Advanced PL/SQL Features
- 5.1 PL/SQL Data Types
- 5.2 Dynamic SQL
- 5.3 PL/SQL Optimize Level
- 5.4 Compiling PL/SQL Units for Native Execution
- 5.5 Exception Handling
- 5.6 Conditional Compilation
- 5.7 Bulk Binding
Part II SQL for Application Developers
6 SQL Processing for Application Developers
- 6.1 Description of SQL Statement Processing
- 6.2 Grouping Operations into Transactions
- 6.3 Ensuring Repeatable Reads with Read-Only Transactions
- 6.4 Locking Tables Explicitly
- 6.5 Using Oracle Lock Management Services (User Locks)
- 6.6 Using Serializable Transactions for Concurrency Control
- 6.7 Nonblocking and Blocking DDL Statements
- 6.8 Autonomous Transactions
- 6.9 Resuming Execution After Storage Allocation Errors
7 Using SQL Data Types in Database Applications
- 7.1 Using the Correct and Most Specific Data Type
- 7.2 Representing Character Data
- 7.3 Representing Numeric Data
- 7.3.1 Floating-Point Number Components
- 7.3.2 Floating-Point Number Formats
- 7.3.3 Representing Special Values with Native Floating-Point Data Types
- 7.3.4 Comparing Native Floating-Point Values
- 7.3.5 Arithmetic Operations with Native Floating-Point Data Types
- 7.3.6 Conversion Functions for Native Floating-Point Data Types
- 7.3.7 Client Interfaces for Native Floating-Point Data Types
- 7.4 Representing Date and Time Data
- 7.5 Representing Specialized Data
- 7.6 Identifying Rows by Address
- 7.7 Displaying Metadata for SQL Operators and Functions
8 Using Regular Expressions in Database Applications
- 8.1 Overview of Regular Expressions
- 8.2 Oracle SQL Support for Regular Expressions
- 8.3 Oracle SQL and POSIX Regular Expression Standard
- 8.4 Operators in Oracle SQL Regular Expressions
- 8.5 Using Regular Expressions in SQL Statements: Scenarios
9 Using Indexes in Database Applications
- 9.1 Guidelines for Managing Indexes
- 9.2 Managing Indexes
- 9.3 When to Use Domain Indexes
- 9.4 When to Use Function-Based Indexes
10 Maintaining Data Integrity in Database Applications
- 10.1 Enforcing Business Rules with Constraints
- 10.2 Enforcing Business Rules with Both Constraints and Application Code
- 10.3 Creating Indexes for Use with Constraints
- 10.4 When to Use NOT NULL Constraints
- 10.5 When to Use Default Column Values
- 10.6 Choosing a Primary Key for a Table (PRIMARY KEY Constraint)
- 10.7 When to Use UNIQUE Constraints
- 10.8 Enforcing Referential Integrity with FOREIGN KEY Constraints
- 10.9 Minimizing Space and Time Overhead for Indexes Associated with Constraints
- 10.10 Guidelines for Indexing Foreign Keys
- 10.11 Referential Integrity in a Distributed Database
- 10.12 When to Use CHECK Constraints
- 10.13 Examples of Defining Constraints
- 10.14 Enabling and Disabling Constraints
- 10.15 Modifying Constraints
- 10.16 Renaming Constraints
- 10.17 Dropping Constraints
- 10.18 Managing FOREIGN KEY Constraints
- 10.19 Viewing Information About Constraints
Part III PL/SQL for Application Developers
11 Coding PL/SQL Subprograms and Packages
- 11.1 Overview of PL/SQL Subprograms
- 11.2 Overview of PL/SQL Packages
- 11.3 Overview of PL/SQL Units
- 11.4 Creating PL/SQL Subprograms and Packages
- 11.4.1 Privileges Needed to Create Subprograms and Packages
- 11.4.2 Creating Subprograms and Packages
- 11.4.3 PL/SQL Object Size Limits
- 11.4.4 PL/SQL Data Types
- 11.4.5 Returning Result Sets to Clients
- 11.4.6 Returning Large Amounts of Data from a Function
- 11.4.7 PL/SQL Function Result Cache
- 11.4.8 Overview of Bulk Binding
- 11.4.9 PL/SQL Dynamic SQL
- 11.5 Altering PL/SQL Subprograms and Packages
- 11.6 Dropping PL/SQL Subprograms and Packages
- 11.7 Compiling PL/SQL Units for Native Execution
- 11.8 Invoking Stored PL/SQL Subprograms
- 11.9 Invoking Stored PL/SQL Functions from SQL Statements
- 11.10 Debugging Stored Subprograms
- 11.11 Package Invalidations and Session State
12 Using PL/Scope
- 12.1 Specifying Identifier Collection
- 12.2 PL/Scope Identifier Data for STANDARD and DBMS_STANDARD
- 12.3 How Much Space is PL/Scope Data Using?
- 12.4 Viewing PL/Scope Data
- 12.5 Identifier Types that PL/Scope Collects
- 12.6 Usages that PL/Scope Reports
- 12.7 Sample PL/Scope Session
13 Using the PL/SQL Hierarchical Profiler
- 13.1 Overview of PL/SQL Hierarchical Profiler
- 13.2 Collecting Profile Data
- 13.3 Understanding Raw Profiler Output
- 13.4 Analyzing Profile Data
- 13.5 plshprof Utility
14 Developing PL/SQL Web Applications
- 14.1 Overview of PL/SQL Web Applications
- 14.2 Implementing PL/SQL Web Applications
- 14.3 Using mod_plsql Gateway to Map Client Requests to a PL/SQL Web Application
- 14.4 Using Embedded PL/SQL Gateway
- 14.4.1 How Embedded PL/SQL Gateway Processes Client Requests
- 14.4.2 Installing Embedded PL/SQL Gateway
- 14.4.3 Configuring Embedded PL/SQL Gateway
- 14.4.4 Invoking PL/SQL Stored Subprograms Through Embedded PL/SQL Gateway
- 14.4.5 Securing Application Access with Embedded PL/SQL Gateway
- 14.4.6 Restrictions in Embedded PL/SQL Gateway
- 14.4.7 Using Embedded PL/SQL Gateway: Scenario
- 14.5 Generating HTML Output with PL/SQL
- 14.6 Passing Parameters to PL/SQL Web Applications
- 14.6.1 Passing List and Dropdown-List Parameters from an HTML Form
- 14.6.2 Passing Option and Check Box Parameters from an HTML Form
- 14.6.3 Passing Entry-Field Parameters from an HTML Form
- 14.6.4 Passing Hidden Parameters from an HTML Form
- 14.6.5 Uploading a File from an HTML Form
- 14.6.6 Submitting a Completed HTML Form
- 14.6.7 Handling Missing Input from an HTML Form
- 14.6.8 Maintaining State Information Between Web Pages
- 14.7 Performing Network Operations in PL/SQL Subprograms
15 Using Continuous Query Notification (CQN)
- 15.1 About Object Change Notification (OCN)
- 15.2 About Query Result Change Notification (QRCN)
- 15.3 Events that Generate Notifications
- 15.4 Notification Contents
- 15.5 Good Candidates for CQN
- 15.6 Creating CQN Registrations
- 15.7 Using PL/SQL to Create CQN Registrations
- 15.7.1 PL/SQL CQN Registration Interface
- 15.7.2 CQN Registration Options
- 15.7.2.1 Notification Type Option
- 15.7.2.2 QRCN Mode (QRCN Notification Type Only)
- 15.7.2.3 ROWID Option
- 15.7.2.4 Operations Filter Option (OCN Notification Type Only)
- 15.7.2.5 Transaction Lag Option (OCN Notification Type Only)
- 15.7.2.6 Notification Grouping Options
- 15.7.2.7 Reliable Option
- 15.7.2.8 Purge-on-Notify and Timeout Options
- 15.7.3 Prerequisites for Creating CQN Registrations
- 15.7.4 Queries that Can Be Registered for Object Change Notification (OCN)
- 15.7.5 Queries that Can Be Registered for Query Result Change Notification (QRCN)
- 15.7.6 Using PL/SQL to Register Queries for CQN
- 15.7.7 Best Practices for CQN Registrations
- 15.7.8 Troubleshooting CQN Registrations
- 15.7.9 Deleting Registrations
- 15.7.10 Configuring CQN: Scenario
- 15.8 Using OCI to Create CQN Registrations
- 15.8.1 Using OCI for Query Result Set Notifications
- 15.8.2 Using OCI to Register a Continuous Query Notification
- 15.8.3 Using OCI Subscription Handle Attributes for Continuous Query Notification
- 15.8.4 Using OCI_ATTR_CQ_QUERYID Attribute
- 15.8.5 Using OCI Continuous Query Notification Descriptors
- 15.8.6 Demonstrating Continuous Query Notification in an OCI Sample Program
- 15.9 Querying CQN Registrations
- 15.10 Interpreting Notifications
Part IV Advanced Topics for Application Developers
16 Using Oracle Flashback Technology
- 16.1 Overview of Oracle Flashback Technology
- 16.2 Configuring Your Database for Oracle Flashback Technology
- 16.3 Using Oracle Flashback Query (SELECT AS OF)
- 16.4 Using Oracle Flashback Version Query
- 16.5 Using Oracle Flashback Transaction Query
- 16.6 Using Oracle Flashback Transaction Query with Oracle Flashback Version Query
- 16.7 Using DBMS_FLASHBACK Package
- 16.8 Using Flashback Transaction
- 16.9 Using Flashback Data Archive
- 16.9.1 Creating a Flashback Data Archive
- 16.9.2 Altering a Flashback Data Archive
- 16.9.3 Dropping a Flashback Data Archive
- 16.9.4 Specifying the Default Flashback Data Archive
- 16.9.5 Enabling and Disabling Flashback Data Archive
- 16.9.6 DDL Statements on Tables Enabled for Flashback Data Archive
- 16.9.7 Viewing Flashback Data Archive Data
- 16.9.8 Flashback Data Archive Scenarios
- 16.9.8.1 Scenario: Using Flashback Data Archive to Enforce Digital Shredding
- 16.9.8.2 Scenario: Using Flashback Data Archive to Access Historical Data
- 16.9.8.3 Scenario: Using Flashback Data Archive to Generate Reports
- 16.9.8.4 Scenario: Using Flashback Data Archive for Auditing
- 16.9.8.5 Scenario: Using Flashback Data Archive to Recover Data
- 16.10 General Guidelines for Oracle Flashback Technology
- 16.11 Performance Guidelines for Oracle Flashback Technology
- 16.12 Multitenant Container Database Restrictions for Oracle Flashback Technology
17 Choosing a Programming Environment
- 17.1 Overview of Application Architecture
- 17.2 Overview of the Program Interface
- 17.3 Overview of PL/SQL
- 17.4 Overview of Oracle Database Java Support
- 17.5 Choosing PL/SQL or Java
- 17.6 Overview of Precompilers
- 17.7 Overview of OCI and OCCI
- 17.8 Choosing a Precompiler or OCI
- 17.9 Overview of Oracle Data Provider for .NET (ODP.NET)
- 17.10 Overview of OraOLEDB
18 Developing Applications with Multiple Programming Languages
- 18.1 Overview of Multilanguage Programs
- 18.2 What Is an External Procedure?
- 18.3 Overview of Call Specification for External Procedures
- 18.4 Loading External Procedures
- 18.5 Publishing External Procedures
- 18.6 Publishing Java Class Methods
- 18.7 Publishing External C Procedures
- 18.8 Locations of Call Specifications
- 18.8.1 Example: Locating a Call Specification in a PL/SQL Package
- 18.8.2 Example: Locating a Call Specification in a PL/SQL Package Body
- 18.8.3 Example: Locating a Call Specification in an ADT Specification
- 18.8.4 Example: Locating a Call Specification in an ADT Body
- 18.8.5 Example: Java with AUTHID
- 18.8.6 Example: C with Optional AUTHID
- 18.8.7 Example: Mixing Call Specifications in a Package
- 18.9 Passing Parameters to External C Procedures with Call Specifications
- 18.10 Running External Procedures with CALL Statements
- 18.11 Handling Errors and Exceptions in Multilanguage Programs
- 18.12 Using Service Routines with External C Procedures
- 18.13 Doing Callbacks with External C Procedures
- 18.13.1 OCIExtProcGetEnv
- 18.13.2 Object Support for OCI Callbacks
- 18.13.3 Restrictions on Callbacks
- 18.13.4 Debugging External C Procedures
- 18.13.5 Example: Calling an External C Procedure
- 18.13.6 Global Variables in External C Procedures
- 18.13.7 Static Variables in External C Procedures
- 18.13.8 Restrictions on External C Procedures
19 Developing Applications with Oracle XA
- 19.1 X/Open Distributed Transaction Processing (DTP)
- 19.2 Oracle XA Library Subprograms
- 19.3 Developing and Installing XA Applications
- 19.3.1 DBA or System Administrator Responsibilities
- 19.3.2 Application Developer Responsibilities
- 19.3.3 Defining the xa_open String
- 19.3.4 Using Oracle XA with Precompilers
- 19.3.5 Using Oracle XA with OCI
- 19.3.6 Managing Transaction Control with Oracle XA
- 19.3.7 Examples of Precompiler Applications
- 19.3.8 Migrating Precompiler or OCI Applications to TPM Applications
- 19.3.9 Managing Oracle XA Library Thread Safety
- 19.3.10 Using the DBMS_XA Package
- 19.4 Troubleshooting XA Applications
- 19.5 Oracle XA Issues and Restrictions
20 Developing Applications with the Publish-Subscribe Model
- 20.1 Introduction to the Publish-Subscribe Model
- 20.2 Publish-Subscribe Architecture
- 20.3 Publish-Subscribe Concepts
- 20.4 Examples of a Publish-Subscribe Mechanism
21 Using the Oracle ODBC Driver
- 21.1 About Oracle ODBC Driver
- 21.2 For All Users
- 21.3 For Advanced Users
- 21.4 For Programmers
- 21.4.1 Format of the Connection String
- 21.4.2 SQLDriverConnect Implementation
- 21.4.3 Reducing Lock Timeout in a Program
- 21.4.4 Linking with odbc32.lib (Windows) or libodbc.so (UNIX)
- 21.4.5 Obtaining Information About rowids
- 21.4.6 Rowids in a WHERE Clause
- 21.4.7 Enabling Result Sets
- 21.4.8 Enabling EXEC Syntax
- 21.4.9 Enabling Event Notification for Connection Failures in an Oracle RAC Environment
- 21.4.10 Using Implicit Results Feature Through ODBC
- 21.4.11 Supported Functionality
- 21.4.12 Unicode Support
- 21.4.13 Performance and Tuning
22 Using the Identity Code Package
- 22.1 Identity Concepts
- 22.2 What is the Identity Code Package?
- 22.3 Using the Identity Code Package
- 22.4 Identity Code Package Types
- 22.5 DBMS_MGD_ID_UTL Package
- 22.6 Identity Code Metadata Tables and Views
- 22.7 Electronic Product Code (EPC) Concepts
- 22.7.1 RFID Technology and EPC v1.1 Coding Schemes
- 22.7.2 Product Code Concepts and Their Current Use
- 22.7.2.1 Electronic Product Code (EPC)
- 22.7.2.2 Global Trade Identification Number (GTIN) and Serializable Global Trade Identification Number (SGTIN)
- 22.7.2.3 Serial Shipping Container Code (SSCC)
- 22.7.2.4 Global Location Number (GLN) and Serializable Global Location Number (SGLN)
- 22.7.2.5 Global Returnable Asset Identifier (GRAI)
- 22.7.2.6 Global Individual Asset Identifier (GIAI)
- 22.7.2.7 RFID EPC Network
- 22.8 Oracle Database Tag Data Translation Schema
23 Understanding Schema Object Dependency
- 23.1 Overview of Schema Object Dependency
- 23.2 Querying Object Dependencies
- 23.3 Object Status
- 23.4 Invalidation of Dependent Objects
- 23.5 Guidelines for Reducing Invalidation
- 23.6 Object Revalidation
- 23.7 Name Resolution in Schema Scope
- 23.8 Local Dependency Management
- 23.9 Remote Dependency Management
- 23.10 Remote Procedure Call (RPC) Dependency Management
- 23.11 Shared SQL Dependency Management
24 Using Edition-Based Redefinition
- 24.1 Editions
- 24.1.1 Editioned and Noneditioned Objects
- 24.1.1.1 Name Resolution for Editioned and Noneditioned Objects
- 24.1.1.2 Noneditioned Objects That Can Depend on Editioned Objects
- 24.1.1.3 Editionable and Noneditionable Schema Object Types
- 24.1.1.4 Enabling Editions for a User
- 24.1.1.5 EDITIONABLE and NONEDITIONABLE Properties
- 24.1.1.6 Rules for Editioned Objects
- 24.1.2 Creating an Edition
- 24.1.3 Editioned Objects and Copy-on-Change
- 24.1.4 Making an Edition Available to Some Users
- 24.1.5 Making an Edition Available to All Users
- 24.1.6 Current Edition and Session Edition
- 24.1.7 Retiring an Edition
- 24.1.8 Dropping an Edition
- 24.1.1 Editioned and Noneditioned Objects
- 24.2 Editioning Views
- 24.2.1 Creating an Editioning View
- 24.2.2 Partition-Extended Editioning View Names
- 24.2.3 Changing the Writability of an Editioning View
- 24.2.4 Replacing an Editioning View
- 24.2.5 Dropping or Renaming the Base Table
- 24.2.6 Adding Indexes and Constraints to the Base Table
- 24.2.7 SQL Optimizer Index Hints
- 24.3 Crossedition Triggers
- 24.4 Displaying Information About EBR Features
- 24.5 Using EBR to Upgrade an Application
- 24.5.1 Preparing Your Application to Use Editioning Views
- 24.5.2 Procedure for EBR Using Only Editions
- 24.5.3 Procedure for EBR Using Editioning Views
- 24.5.4 Procedure for EBR Using Crossedition Triggers
- 24.5.5 Rolling Back the Application Upgrade
- 24.5.6 Reclaiming Space Occupied by Unused Table Columns
- 24.5.7 Example: Using EBR to Upgrade an Application
25 Using Transaction Guard
- 25.1 Problem that Transaction Guard Solves
- 25.2 Solution that Transaction Guard Provides
- 25.3 Transaction Guard Concepts and Scope
- 25.4 Database Configuration for Transaction Guard
- 25.5 Developing Applications that Use Transaction Guard
- 25.6 Transaction Guard and Its Relationship to Application Continuity
26 Ensuring Application Continuity
- 26.1 About Application Continuity
- 26.2 Application Continuity Operation and Usage
- 26.2.1 How Application Continuity Works for Database Sessions
- 26.2.2 Actions for Using Application Continuity for Java
- 26.2.2.1 When Is Application Continuity Transparent?
- 26.2.2.2 Configuring Oracle JDBC for Application Continuity for Java
- 26.2.2.3 Configuring Oracle Database for Application Continuity for Java
- 26.2.2.4 Registering a Connection Initialization Callback in Application Continuity for Java (optional)
- 26.2.2.5 Delaying the Reconnection in Application Continuity for Java
- 26.2.2.6 Using Application Continuity for Planned Outages
- 26.2.2.7 Running Without Application Continuity
- 26.2.2.8 Disabling Replay in Application Continuity for Java
- 26.2.2.9 Killing or Disconnecting a Session Without Replay
- 26.2.3 Mutable Objects and Application Continuity
- 26.2.4 Session State Consistency
- 26.3 Potential Side Effects of Application Continuity
- 26.4 Restrictions and Other Considerations for Application Continuity
