Oracle8i Distributed Database Systems Release 8.1.5 A67784-01 |
|
This chapter describes database administration tasks required to maintain a heterogeneous distributed environment. Topics include:
This section explains the generic steps to configure access to a non-Oracle system. Please see your Installation and User's Guide for your particular agent for more installation information. Configuring your particular agent might slightly differ from what is presented in this section.
The steps are:
To install the data dictionary tables and views for Heterogeneous Services, you must run a script that creates all the Heterogeneous Services data dictionary tables, views, and packages. On most systems the script is called CATHS.SQL, and resides in $ORACLE_HOME/rdbms/admin.
To initiate a connection to the non-Oracle system, the Oracle8i server starts an agent process through the Net8 listener. For the Oracle8i server to be able to connect to the agent, you must:
The following is a sample entry for the service name in the tnsnames.ora:
MegaBase6_sales= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp) (HOST=dlsun206) (PORT=1521)) (CONNECT_DATA = (SID=SalesDB)) (HS = OK))
The description of this service name is defined in tnsnames.ora, the Oracle Names server, or in third-party nameservers using the Oracle naming adapter. See the Installation and User's Guide for your agent for more information about how to define the Net8 service name.
The following is a sample entry for the listener in listener.ora:
LISTENER = (ADDRESS_LIST = (ADDRESS= (PROTOCOL=tcp) (HOST = dlsun206) (PORT = 1521) ) ) ... SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME=SalesDB) (ORACLE_HOME=/home/oracle/megabase/8.1.3) (PROGRAM=tg4mb80) ) )
The value associated with PROGRAM keyword defines the name of the agent executable. The agent executable must reside in the $ORACLE_HOME/bin directory. The SID_NAME is typically used to define the initialization parameter file for the agent.
To create a database link to the non-Oracle system, you just use the CREATE DATABASE LINK command to create private or public database links.
The service name that is used in the USING clause of the CREATE DATABASE LINK command is the Net8 service name.
For example, to create a database link to the Sales database on an MegaBase release 6 server, you could create database link as follows:
CREATE DATABASE LINK salesdb USING `MegaBase6_sales';
See Also: For more information on creating database links, see Chapter 2, "Distributed Database Administration".
To test the connection to the non-Oracle system, you can use the database link in a SQL or PL/SQL statement. If the non-Oracle system is a SQL-based database, you can execute a select from an existing table or view using the database link, for example::
SELECT * FROM product@salesdb WHERE product_name like '%pencil%';
When you try to access the non-Oracle system for the first time, the Heterogeneous Services agent will upload information into the Heterogeneous Services data dictionary. The uploaded information includes:
This step is only required for agents that support distributed external procedures. Distributed external procedures enable users to procedurally access a non-Oracle system. If the agent vendor created distributed external procedures, they will provide a script or installer to register those distributed external procedures in the Oracle8i server.
If you use distributed external procedures to access the non-Oracle system, use a PL/SQL remote procedure call to execute the remote procedure:
execute foo@non_oracle_system(1,2,3) procedure successfully completed.
Each non-Oracle system you access from an Oracle8i server is considered a non-Oracle system instance and class. You can access multiple non-Oracle systems from the same Oracle8i server. See Figure 6-1.
The Oracle8i server must know the non-Oracle system capabilities (SQL translations, data dictionary translations) for each non-Oracle system that it accesses. This information is stored in the Oracle8i data dictionary.
If this information were stored separately for each non-Oracle systems you access, the amount of stored data dictionary information could become large and sometimes redundant. For example, when you must access three non-Oracle system instances of the same type, the same capabilities, SQL translations and data dictionary translations are stored.
To avoid unnecessary redundancy, this information is organized by classes and instances in the data dictionary. A class defines a type of non-Oracle system, an instance defines specializations of a class for a specific non-Oracle system. Note that instance information takes precedence over class information and class information takes precedence over server supplied defaults.
If you access multiple non-Oracle systems of the same class (type), you may want to set certain information, like initialization parameters, at the instance level. Heterogeneous Services stores both class and instance information. Multiple instances can share the same class information, but each non-Oracle system instance will have its own instance information.
Consider an example where the Oracle8i server accesses three instances of type Megabase release 5, and two instances of Megabase release 6. Suppose Megabase release 5 and Megabase release 6 have different capabilities. The data dictionary will contain two class definitions, one for release 5 and one for release 6, and 5 instance definitions.
The Heterogeneous Services data dictionary views, contain information about:
The views can be divided into four groups:
Most of the data dictionary views are defined for both classes and instances. Consequently, for most types of information there is a "..._CLASS" and a "..._INST" view defined.
See Also: "Structure of the Heterogeneous Services Data Dictionary" for more information about classes and instances.
Like all Oracle data dictionary tables, these views are read only; do not use SQL to change the content of any of the underlying tables. To make changes to any of the underlying tables, you must use the procedures available in the package "DBMS_HS". See "The DBMS_HS Package" for more information.
See Also : The Oracle8i Reference for more detailed information about these views
The views that are common for all services are the views that contain:
For example, you can access both MegaBase release 5 and release 6 from an Oracle8i server. After accessing the agent(s) for the first time, uploaded information in the Oracle8i server could look like:
select * from hs_fds_class; FDS_CLASS_NAME FDS_CLASS_COMMENTS FDS_CLASS_ID --------------------- ------------------------------ ------------ MegaBase5 Uses ODBC HS driver, R1.0 1 MegaBase6 Uses ODBC HS driver, R1.0 21
Two classes are uploaded. One class to access MegaBase release 5 servers, and one class to access MegaBase release 6 servers. The data dictionary in the Oracle8i server now contains capability information, SQL translations and data dictionary translations for both MegaBase5 and MegaBase6.
In addition to this information, the Oracle8i server data dictionary also contains instance information in the HS_FDS_INST view for each non-Oracle system instance that is accessed.
When a non-Oracle system is involved in a distributed transaction, the transaction capabilities of the non-Oracle system (and agent) control whether it can participate in distributed transactions. Transaction capabilities are stored in the HS_CLASS_CAPS and HS_INST_CAPS capability tables.
The ability of the non-Oracle system (and agent) to support two-phase commit protocols is specified by the "2PC type" capability which can specify one of the following five types.
The transaction model supported by the driver and non-Oracle system can be queried from Heterogeneous Services' data dictionary views HS_CLASS_CAPS and HS_INST_CAPS.
One of the capabilities is "2PC type":
SELECT cap_description, translation FROM hs_class_caps WHERE cap_description LIKE '2PC%' AND fds_class_name=`MegaBase6'; CAP_DESCRIPTION TRANSLATION ---------------------------------------- ----------- 2PC type (RO-SS-CC-PREP/2P-2PCC) CC
When the non-Oracle system and agent supports distributed transactions, the non-Oracle system is treated like any other Oracle8i server. When a failure occurs during the two-phase commit protocol, the transaction will be recovered automatically. If the failure persists, the in-doubt transaction might need to be manually overridden by the database administrator. See Chapter 3, "Distributed Transactions" for more information about distributed transactions.
For distributed external procedures it is unknown whether it will make changes to data at the non-Oracle system. To ensure the consistency of the heterogeneous distributed database, Oracle will assume that the distributed external procedure updates the non-Oracle system.
Accordingly, the distributed external procedure will participate in the remote or distributed transaction, depending on whether it is the only node that was accessed or whether other nodes were accessed as well. Therefore, to use a distributed external procedure, the agent must at least support the "Single-Site" transaction model.
Data dictionary views that are specific for the SQL service, contain information about:
The HS_..._CAPS data dictionary tables contain information about the SQL capabilities of the non-Oracle data source and necessary SQL translations.
HS_..CAPS specifies whether the non-Oracle data store or the Oracle server implements certain SQL language features. If a capability is turned off, Oracle8i does not send any SQL statements to the non-Oracle data source that require that particular capability but it can still do post-processing.
In order to make the non-Oracle system appear as an Oracle8i server, the non-Oracle system data dictionary can be queried just as if it were an Oracle data dictionary. Data Dictionary translations that are defined make this possible. These translations are stored in the HS_..._DD views.
For example, the following SELECT statement will be transformed into a MegaBase query that retrieves information about EMP tables from the MegaBase data dictionary table:
SELECT * FROM USER_TABLES@salesdb WHERE UPPER(TABLE_NAME)='EMP';
Data dictionary tables can be "mimicked" instead of "translated". If a data dictionary translation is not possible, simply because the non-Oracle data source does not have the required information stored its data dictionary, Heterogeneous Services causes it to appear as if the data dictionary table is available, but the table contains no information.
To retrieve information for which Oracle8i data dictionary views and/or tables are translated or mimicked for the non-Oracle system, you issue the following query on the HS_CLASS_DD or HS_INST_DD views view:
SELECT DD_TABLE_NAME, TRANSLATION_TYPE FROM HS_CLASS_DD WHERE FDS_CLASS_NAME=`MegaBase6'; DD_TABLE_NAME T ----------------------------- - ALL_ARGUMENTS M ALL_CATALOG T ALL_CLUSTERS T ALL_CLUSTER_HASH_EXPRESSIONS M ALL_COLL_TYPES M ALL_COL_COMMENTS T ALL_COL_PRIVS M ALL_COL_PRIVS_MADE M ALL_COL_PRIVS_RECD M ...
The translation type `T' specifies that a translation exists. When the translation type is `M', the data dictionary table is mimicked.
Distributed external procedures and remote libraries are administered in the Oracle8i server. The agent vendor will provide scripts to register distributed external procedures and their libraries. Information about these registered procedures and libraries are stored in the HS_EXTERNAL_OBJECTS data dictionary view. The information includes:
The DBMS_HS package contains functions and procedures for application developers and database administrators to set and unset Heterogeneous Services initialization parameters, capabilities, instance names, class names, etc.
See Appendix B, "DBMS_HS Package Reference" for a reference listing off all DBMS_HS package interface information for administering Heterogeneous Services
Initialization parameters can be set either in the Oracle8i server or in the Heterogeneous Services agent. To set initialization parameters in the Oracle8i server, you must use the DBMS_HS package. Please see the installation and user's guide for your particular agent for more information. If the same initialization parameter is set both in the agent and the Oracle8i server, the value of initialization parameter in the Oracle8i server will take precedence.
There are two types of initialization parameters:
Generic initialization parameters are defined by Heterogeneous Services. See Appendix A, "Heterogeneous Services Initialization Parameters" for more information on generic initialization parameters.
Non-Oracle data store class-specific initialization parameters are defined by the agent vendor. Some non-Oracle data store class-specific initialization parameters may be mandatory. For example, an initialization parameter may include connection information required to connect to a non-Oracle system. Non-Oracle data store class-specific parameters are documented in the installation and user's guide for your agent.
Both generic and non-Oracle data store class-specific HS initialization parameters can be set in the Oracle server using the CREATE_INST_INIT procedure in the DBMS_HS package.
For example, you set the HS_DB_DOMAIN initialization parameter as follows
DBMS_HS.CREATE_INST_INIT (FDS_INST_NAME => `SalesDB', FDS_CLASS_NAME => `MegaBase6', INIT_VALUE_NAME => `HS_DB_DOMAIN', INIT_VALUE => `US.SALES.COM');
See Also: See Appendix A, "Heterogeneous Services Initialization Parameters" for more information on initialization parameters.
To unset a Heterogenous Services initialization parameter in the Oracle8i server, you must use the DROP_INST_INIT procedure. For example, to delete the HS_DB_DOMAIN entry:
DBMS_HS.DROP_INST_INIT (FDS_INST_NAME => `SalesDB', FDS_CLASS_NAME => `MegaBase6', INIT_VALUE_NAME => `HS_DB_DOMAIN');
Please see the agent-specific documentation on how to control execute privileges on distributed external procedures.
Agent self-registration automates the process of updating Hetergeneous Services configuration data describing agents on remote hosts, to ensure correct operation over heterogeneous database links. Note that agent self-registration is default behavior. If you do not want to use the agent self-registration feature, you must set the value of the Oracle initialization parameter HS_AUTOREGISTER to false. See "Oracle Server Initialization Parameter HS_AUTOREGISTER" for more information.
Both the server and the agent rely on three types of information to configure and control operation of the HS connection:
This document refers to these three sets of information collectively as HS configuration data.
HS configuration data (that you specify using the DBMS_HS_ADMIN package discussed in the previous section) is stored in the Oracle server's data dictionary. Because the agent may likely be remote, and may therefore be administered separately, several circumstances could lead to configuration mismatches between servers and agents:
Agent self-registration permits successful operation of Heterogeneous Services in all these scenarios.
Specifically, agent self-registration enhances interoperability between any Oracle server and any HS agent, provided that each is at least as recent as Version 8.0.3. The basic mechanism for this is ability to upload HS configuration data (HS Data Dictionary content) from agents to servers.
Self-registration provides automatic updating of HS configuration data residing in the Oracle server data dictionary (if enabled by the server initialization parameter HS_AUTOREGISTER (see below)). Such a data dictionary update assures that the agent self-registration uploads need to be done only once, on the initial use of a previously unregistered agent. Instance information is uploaded on each connection, not stored in the server data dictionary.
The HS agent self-registration feature can:
Note that, when both the server and the agent are release 8.1 or higher, the upload of class information occurs only when the class is undefined in the server data dictionary. Similarly, instance information is uploaded only if the instance is undefined in the server data dictionary.
The information required to accomplish the above is accessed in the server data dictionary by using these agent-supplied names:
FDS_CLASS and FDS_CLASS_VERSION are defined by Oracle or by third party vendors for each individual HS agent and version. Oracle Heterogeneous Services concatenates these names to form FDS_CLASS_NAME which is used as a primary key to access class information in the server data dictionary.
FDS_CLASS should specify the type of non-Oracle data store to be accessed and FDS_CLASS_VERSION should specify a version number for both the non-Oracle data store and the agent which connects to the it. Note that, when any component of an agent changes (agent executable or uploadable definitions) FDS_CLASS_VERSION must also change to uniquely identify the new release.
Instance-specific information can be stored in the server data dictionary. The instance name, FDS_INST_NAME, is configured by the DBA who administers the agent; how the DBA does this depends on the specific agent in use. The Oracle server then uses FDS_INST_NAME to look up instance-specific configuration information in its data dictionary, using it as a primary key for columns of the same name in the FDS_INST_INIT, FDS_INST_CAPS, and FDS_INST_DD views.
Server data dictionary accesses that use FDS_INST_NAME also use FDS_CLASS_NAME to uniquely identify configuration information rows. For example, if you are porting a database from class "MegaBase8.0.4" to class "MegaBase8.1.3", both databases can simultaneously operate with instance name "Scott" and can use separate sets of configuration information.
Unlike class information, instance information is not automatically self-registered in the server data dictionary.
The Oracle server initialization parameter HS_AUTOREGISTER enables or disables automatic self-registration of HS agents. When set to TRUE, information describing a previously unknown agent class or a new agent version is uploaded into the server's data dictionary.
See the Oracle8i Reference for a description and the syntax of this parameter.
It is recommended that you use the dfault value for this parameter (TRUE) which assures that the server's data dictionary content always correctly represents definitions of class capabilities and data dictionary translations as used in HS connections.