Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Distributed databases are systems that act as single database but are located in
different locations. These locations can be anywhere, from in the next office to the other
side of the world. In a networked environment with various nodes connected together,
distributed databases act as a single system. In order to fully understand how a distributed
system works, the DBA must have a knowledge and understanding of multiple hardware
systems, networking, client/server technology, and database management.
Replicated databases are most easily classified by the method used to pass
information between them. The following are the two primary methods for this copy
process (most commonly referred to as propagation) :
• Distributed transactions
• Snapshot refreshes
The distributed transaction is the process wherein a user’s updates to one site and
changes are sent to another site by means of triggers and procedures. Snapshots are
copies of a table ( or subset) that are propagated to each of the remote sites from a master
site.
In order to determine the best access technique for an optimum execution plan,
the optimizer must first be capable of determining a sufficient number of alternative
paths. The remote join enhancements in Oracle8i present more options, allowing for
better execution plans to be generated with a corresponding performance increase.
DATABASE NAMING CONVENTIONS
The name of the database is read from right to left. This naming convention can
have several parts, with the first (rightmost) being the base or root part domain. By
default, the domain is world. This is not required in Net8 but for consistency, it might be
best to include it in order to support the older versions of SQL*Net.
The domain name can be based on the structure of the company or locations. For
example, the naming convention for the database in Germany can be done in a few ways.
In the simples form, the name can be GERMANY.WORLD. If the database name is
based on location, the name would be GERMANY.BWC with BWC being the domain.
One other way would be to expand the location to continents, and then the name would
be GERMANY.EUROPE.BWC. Whatever the naming convention, it must be easily
understood for future maintainability yet remain transparent to programmers and users.
There are some limitations when naming a domain and database. In addition to
normal Oracle naming conventions, (no space, no special characters, and so on), the size
of the name may be limited by the operating system or network.
ACHIEVING TRANSPARENCY
It is important that when providing names to the tables and objects on remote
systems, the naming convention allows the programmer and user of the system to access
the table as they would if it were local. Transparency is the concept that all objects are
accessible and look the same for the DBA and user alike. Oracle, through the use of
SQL*Net and transparent gateways, enables the development of a system that looks the
same regardless of database vendor, type, and location.
New in Oracle8i is an agent-specific, shared library for HS object file, other than
drivers, that is substituted when linking agent executables. While the benefits from this
change are platform-specific, they can improve scalability by using a single agent library
for all types of agents (extproc, hsalloci, hssqlpss, hsdepxa and hsots). Also memory
requirements might be reduced because agent executables become quite small.
USING A DISTRIBUTED DATABASE
There are several reasons to utilize a distributed database system. The following
are some of them :
Database links comprise the method used by the Oracle access a remote database
object. There are three types of databases links :
The syntax for creating a public or private database link is essentially the same :
CREATE
[SHARED]
[PUBLIC]
DATABASE LINK dblink
[authenticated clause]|[CONNECT TO [ CURRENT_USER|user
IDENTIFIED BY password] [authenticated clause] USING ‘{connect string}’;
There are several differences between Oracle8 and Oracle7 for this syntax.
SHARED is an entirely new process. In order to use this process, the database
must be using a multithreaded server. This enables the creation of database link that can
use existing connections, if available.
The authenticated clause is associated with the SHARED portion of the database
link. This must be used when using SHARED.
CURRENT_USER uses the new Oracle8 global user type. This powerful new
feature enables creation of an user that can access any database on a node (server) with
the use of a single login.
Using the BWC example, the following code would be create a simple public link
in the Germany database from Detroit :
If not defined by Oracle Names, the name GERMANY must appear, either as an
alias or as the actual name in TNSNAMES.ORA. The TNSNAMES.ORA must be on the
client and server. With this syntax, the user must have a current login on both Germany’s
and Detroit’s database.
Parameter Description
COMMIT_POINT_STRENGTH This parameter is used to set the commit
(0-255) point site in the two-phased commit. The
site with the highest commit point strength
will be the commit point site. Each of the
sites using this as the commit point site
must be on the same node. The factors
determining which database should be the
commit point site should be ownership
(driver) of data, criticality of the data, and
availability of the system.
DISTRIBUTED_TRANSACTIONS Limits the number of concurrent distributed
(0-TRANSACTIONS) transactions. If set to 0, the process RECO
(Oracle’s recovery process) is not activated,
and distributed capabilities of the database
are disabled.
GLOBAL_NAMES If set to TRUE, the name referenced in the
link must match the name of the database
and not the alias. This must be used in order
to utilize advanced replication features of
Oracle8.
DML_LOCKS (20-unlimited) Limits the number of DML locks in a single
transaction.
ENQUEUE RESOURCES (10-65535) Allows several concurrent process to share
resources. To determine whether this value
is set appropriately, enqueue_waits in the
v$systat table. If this is a non-zero value,
increase the enqueue resoures.
MAX_TRANSACTION BRANCHES The maximum value for this parameter has
(1-32) been increased from 8 to 32. Branches are
the numbers of different servers (or server
groups) that can be accessed in a single
distributed transaction. Reducing this
number might decrease the amount of
shared pool use.
OPEN_LINKS (0-255) The number of concurrent open
connections to other databases by one
session. In a distributed environment, care
must be taken to ensure that this value is
not less than the number of remote tables
that can be referenced in a single SQL
statement. If the value is set to 0, there can
be no distributed transactions.
System changes are the biggest problem in managing a simple distributed system.
It similar to managing a single, autonomous database, but the difference is that each
database can see objects in other databases. Following are the changes within a system
that must be coordinated within a distributed system.
A two-phased commit occurs with all data manipulation language (DML), and as
the name implies, it is made up of two distinct phases.
The first phase of a two-phased commit is called the prepare phase. The initiating
database is known as the global coordinator; it sends a message to all other databases
informing them that an update is about to occur. The receiving database will respond to
the global coordinator if the update can occur. The receiving database can respond in
three ways :
The receiving databases must also perform some system checks, including
sending a prepare statement to any of its own coordinating databases. This includes
placing locks (if not read-only) on the row to be updated. After all the receiving databases
have responded, the global coordinator places the transaction in-doubt. If all the children
respond with prepared or read-only, the global coordinator determines the commit point
site. The commit point site is the first database to be committed. Then it keeps up with
the status of the transaction until all transactions have been completed.
The second phase, or the commit phase, is the process of committing the data.
After all the receiving databases have successfully committed and communicated their
success to the global coordinator, the global coordinator sends a message to the commit
point site. The commit point site removes the status as in-double. Each of the children
will commit and release the row-level lock on the record.
There might also be information in the ADVICE column. This indicates to the
DBA where the transaction was. For example
DATABASE – If the transaction is IN, this is the name of the database sending the
transaction. If the transaction is OUT, this is the name of the database link to the database
to which the transaction is being sent.
DBUSER_OWNER – If the transaction is IN, this is the name of the local user. If the
transaction is OUT, this is the owner of the database link.
Using the information in this table (the database and LOCAL_TRAN_ID), follow
this thread to the next database.
If in doubt, always roll the transaction back. Then communicate this rollback to
the user community. As an added precaution, check the status of the tables affected to
ensure data consistency.