Client Connectivity for Oracle Rdb

Colleen Mitchneck Linda Kipnes Bryan Alvey

©2004-2005, Client Connectivity

• When we talk Client Connectivity to Rdb, we are talking about…

…Oracle SQL/Services for Rdb

2 History of SQL/Services

• 1992: Initial Release – Implemented a SQL/Services client API – Implemented an ODBC for Oracle Rdb driver allowing any industry standard ODBC application to use Rdb in the backend • 1994: SQL/Services acquired by Oracle • 1995: Added RMU client/server capabilities

3 History of SQL/Services

• 1996: Implemented Oracle Call Interface (OCI) support – OCI applications could now run almost transparently against an Rdb database – As new industry standards emerge, Oracle implements compliant OCI drivers (JDBC, .NET, etc.), which function with Oracle and Rdb databases in the backend • 2003: Added Oracle Rdb JDBC server management

4 SQL/Services Architecture

Client Server

Configuration File Monitor Desktop systems Dispatcher

SQLSRV Service Client applications RMU Service OCI Service

SQLSRV_MANAGE Executors

SQL/Services Manager GUI

Rdb databases

5 SQL/Services Protocols

• SQLSRV – used by applications based on ODBC or on the SQL/Services client API • OCI – used by Oracle applications that communicate via the Oracle Call Interface (OCI) protocol • RMU – used by the Oracle Rdb RMU utility for parallel backup and remote command execution • JDBC – used to start and stop JDBC for Oracle Rdb thin servers

6 SQLSRV Client Architecture

Client using SQL/Services client API directly

Client SQL/Services Application Client API

Client using ODBC for Oracle Rdb

Client ODBC for SQL/Services server Application Oracle Rdb Client API

7 SQLSRV Client

• SQL/Services client API – Available on Windows, Tru64 UNIX, OpenVMS, Red Hat Linux Red Hat Linux (V2.1 or later) is a new platform for Oracle SQL/Services release 7.1.6 – Includes a library of routines that client applications can call to access SQL/Services functions – Enables client applications to execute Oracle Rdb dynamic SQL statements against an Rdb database

8 SQLSRV Client

• ODBC for Oracle Rdb – Layered on the client API to provide industry standard ODBC access to Rdb – Current version 3.1.0.2 – Much improved over earlier versions Better performance Improved conformance with ODBC specification New API calls and prefetch functionality

9 SQLSRV Client

• ODBC for Oracle Rdb (con’t) – Works with any ODBC compliant application ADO, .NET via bridge many different vendors have released ODBC-compliant applications in the software development, office productivity, and data analysis space – Portable across databases

10 SQLSRV Server Architecture

SQLSRV_MON SQLSRV_DISP monitor dispatcher

Client SQLSRV_EXEC executor

Rdb databases

11 SQLSRV Server

• Monitor (SQLSRV_MON) – provides overall management and control for the server • Dispatcher (SQLSRV_DISP) – responsible for handling network communications for the clients and for the routing and scheduling of client requests to executors of a service – a single dispatcher typically supports more than one network protocol, but can support a single protocol • Executor (SQLSRV_EXEC) – accepts client requests from dispatchers, processes them, and returns the results – there is a pool of executor processes for each service

12 OCI Client Architecture

Client OCI Client Application Oracle Net

Server

13 OCI Server Architecture

OCI_DISP SQLSRV_MON dispatcher

SQLSRV_NATCONN Client SQLSRV_SQLNETSHR (Oracle RDBMS libraries) RDB$NATCONN (OCI Services)

Rdb databases

14 OCI Protocol

• Presents an Oracle RDBMS view of an Rdb database by emulating Oracle Data Dictionary • Manages Oracle cursors • Manages Oracle to Rdb data type conversions • Provides functions to emulate Oracle RDBMS built-in functions (to_date, etc.)

15 OCI Protocol

• Some of the products using OCI… – Oracle JDBC – Oracle ODBC – links – Oracle Data Provider for .NET – Oracle Reports

16 OCI Protocol

• And more products using OCI… – Oracle JDeveloper – – Oracle Designer – Oracle Developer – Oracle SQLPLUS utility – And many, many others…

17 OCI Protocol Connecting from Java

18 RMU Protocol Architecture

client server RMU_DISP SQLSRV_MON dispatcher

RMU RMUEXEC Client Command Line Utility RMUSHR

Rdb databases

19 RMU Protocol

• RMU/BACKUP/PARALLEL – BACKUP command is sent from RMU client through SQL/Services to the server node, where the backup is done by RMU executors – Each RMU executor process can run multiple backup threads. • Remote RMU Command Execution – Executes RMU commands remotely based on user specified logical definitions

20 SQL/Services Management SQLSRV Command Line

21 SQL/Services Management GUI–based Manager

22 SQL/Services Management Enterprise Manager 9i

23 SQL/Services 7.1.6

• Currently in beta test • Production release planned for Q1 2005 • Major Features – Upgraded to use the Oracle 9.2.0.4 libraries – 2pc Support – New and updated utilities – Performance enhancements

24 SQL/Services 7.1.6 Upgrade to Oracle 9.2.0.4

• Upgraded OCI Services • Added support for new Oracle 9i data types – Time, Year-to-month interval, Day-to-second interval, etc. • Removed several restrictions when connecting from Oracle 9i

25 SQL/Services 7.1.6 2pc Support

• Oracle Rdb databases can now fully participate in Oracle RDBMS managed distributed transactions • Allows multiple Oracle server DBLINKs to Rdb databases to participate in a transaction • Exploits DECdtm XA Gateway to provide interface between Oracle distributed transaction protocol and DECdtm distributed transaction protocol

26 What is a DBLINK? • A DBLINK is a Oracle RDBMS database server- to-server connection – Set up in the Oracle RDBMS database with SQLPLUS: SQL> CREATE DATABASE LINK dblink_name 2 CONNECT TO "username" IDENTIFIED BY 3 "password" USING "service_name"; – Uses a server-to-server subset of the OCI protocol OCI Native Connection (NATCON) NATCON is a remote call interface • Implementation in Rdb uses SQL Services – SQL Services Dispatcher resolves connection – SQL Services Executor implements OCI Interface – SQS Executor translates Oracle SQL into Rdb SQL

27 Transactions on a DBLINK • OCI NATCON Transaction interface – Not SQL sentences like SET TRANSACTION – RCI calls to transaction functions in OCI Services I/F: gtabegn(), gtaprtn(), gtacomm(), gtaroll(), gtafrgt(), gtareco() – Implemented inside the SQL Executor • Uses Oracle RDBMS internal transaction protocol – Distributed transaction capable 2 Phase Commit (i.e. prepare and commit/rollback) Allows partner to decline 2PC – “XA-like” protocol … but not XA

28 What’s the Problem with DBLINK 2PC and Rdb? • Rdb supports distributed transactions but … – It uses DECdtm as the transaction manager – It requires DECdtm AST calls to manage transaction SQS Executor would need a DECdtm TID Would pass TID to Dispatch layer in context structure Dispatch layer would join the DECdtm transaction – Rdb recovery asks DECdtm for transaction status • Oracle RDBMS Server doesn’t do DECdtm – SQS Executor has to decline 2PC – Oracle RDBMS server copes by calling DBLINK to commit after other participants successfully prepare – Limits transaction to one Rdb DBLINK participant

29 HP to the Rescue • DECdtm XA Gateway provided by HP – Interfaces an XA Transaction Manager (TM) to DECdtm – Allows DECdtm Resource Manager (RM) – like Rdb – to participate in an XA transaction – Released as part of OpenVMS 7.3-1 • Can be exploited for DBLINK 2PC – Oracle RDBMS protocol is similar and compatible – Interface written for OCI to XA Gateway SQS Executor translates between protocols Can now participate in distributed transactions – One DBLINK limit removed

30 Gory Details of Implementation

• SQS Executor is a SQL$PRE/CC application – Now compiled specifying implicit 2PC – Executor’s Rdb Dispatch layer joins the default DECdtm transaction • SQS Executor now sends OCI transaction calls to XA Gateway – OCI transaction ID is used as an XA transaction ID – XA Gateway calls DECdtm Sets SQS Executor process default transaction Passes transaction calls for that transaction – DECdtm calls Dispatch layer of SQS Executor via ASTs • SQL statements submitted dynamically as before

31 Gory Details Illustrated

Oracle SQS/OCI XA Gateway RDBMS Executor Server Server OCI XA NATCON Calls Dynamic DECdtm SQL Calls

Rdb DECdtm Dispatch DECdtm Services Calls SQS Executor Process

32 How Do I Use It? • Set up the DECdtm XA Gateway – Make sure Gateway server is installed: DDTM$XG_SS.EXE – Use Gateway Control Program (XGCP.EXE) to: Create a log for your XA domain Start up the Gateway server • Define Rdb logical for XA Gateway domain – Logical name: RDB$DDTM_XG_INFO – For example: $DEFINE/SYSTEM RDB$DDTM_XG_INFO SYSTEM$node_name where node_name is the OpenVMS node name – Now SQL Services will automatically do 2PC

33 SQL/Services 7.1.6 Utilities

• RDB$NATCONN_DIC Utility – New utility for 7.1.6 Replaces the use of .SQL scripts required by prior versions – Performs database prepare, upgrade and drop of Oracle data dictionary definitions in Rdb database to enable OCI access – Can upgrade from any prior version of OCI Services (no interim upgrades required) – Invoked via SYS$LIBRARY:RDB_NATCONN.COM

34 SQL/Services 7.1.6 Utilities

• RDB$NATCONN_CUPP Utility – Updated utility for 7.1.6 Replaces RDB_NATCONN procedure to add users – Used to add, modify, remove, and show users enabled for OCI access Most OCI applications now require users to be defined in the database in order to execute the application – Invoked via SYS$LIBRARY:RDB_NATCONN.COM

35 SQL/Services 7.1.6 Performance Enhancements

• SQLSRV_SQLNETSHR71.EXE – Expanded to include both Oracle SQLNET and OCI libraries – Installed shareable to decrease memory usage and increase performance – Oracle OCI libraries no longer built into OCI Services images; each image ~9,000 blocks smaller than release 7.1.5.9.1 – Results in a smaller footprint for each running OCI executor process

36 SQL/Services 7.1.6 Performance Enhancements

• More efficient metadata queries in OCI Services – Queries are now prepared once on first use and executed numerous times, rather than being prepared each time query is executed • More efficient use of shared memory in SQL/Services to eliminate memory leaks

37 SQL/Services 7.1.6 Other New Features • Automatic creation of LISTENER.ORA file during installation, if it doesn’t already exist • Validate program feature to restrict users to access via user specified programs • JDBC dispatcher; used to start and stop JDBC for Oracle Rdb thin servers • OCI Services bugcheck dump capability • Documentation update & reorganization – Installation guide – Configuration guide – Release notes

38 SQL/Services Futures?

• Production Release 7.1.6 – Q1 2005 • Upgrade to Oracle 10G • OCI transaction reuseable services • ODBC on Linux ? • Enhanced BLOB support • VMS external authorization support • Support for new Oracle packages • User defined packages

39 SQL/Services Future - EM10g Grid Control

40 Questions?

[email protected]

41