Distributed Database
Distributed Database
1. Definition:
For a client application, the location and platform of the databases are transparent.
You can also create synonyms for remote objects in the distributed system so that users
can access them with the same syntax as local objects. For example, if you are connected
to database mfg but want to access data on database hq, creating a synonym on mfg for
the remote dept table enables you to issue this query:
The Oracle Database server accesses the non-Oracle Database system using
Oracle Heterogeneous Services in conjunction with an agent. If you access the non-
Oracle Database data store using an Oracle Transparent Gateway, then the agent is a
system-specific application. For example, if you include a Sybase database in an Oracle
Database distributed system, then you need to obtain a Sybase-specific transparent
gateway so that the Oracle Database in the system can communicate with it.
In Figure, the host for the hq database is acting as a database server when a
statement is issued against its local data (for example, the second statement in each
transaction issues a statement against the local dept table), but is acting as a client when
it issues a statement against remote data (for example, the first statement in each
transaction is issued against the remote table emp in the sales database).
3. Transaction processing in a distributed System:
A remote transaction contains only statements that access a single remote node.
A distributed transaction contains statements that access more than one node.
A remote query statement is a query that selects information from one or more
remote tables, all of which reside at the same remote node. For example, the following
query accesses data from the dept table in the scott schema of the remote sales
database:
A distributed query statement retrieves information from two or more nodes. For
example, the following query accesses data from the local database as well as the remote
sales database:
Remote Transactions
UPDATE scott.dept@sales.us.americas.acme_auto.com
SET loc = 'NEW YORK'
WHERE deptno = 10;
UPDATE scott.emp@sales.us.americas.acme_auto.com
SET deptno = 11
WHERE deptno = 10;
COMMIT;
Distributed Transactions
The database two-phase commit mechanism guarantees that all database servers
participating in a distributed transaction either all commit or all roll back the statements
in the transaction. A two-phase commit mechanism also protects implicit DML
operations performed by integrity constraints, remote procedure calls, and triggers.
A global object name is an object specified using a database link. The essential
components of a global object name are:
• Object name
• Database name
• Domain
The database always searches for matching database links in the following order:
1. Private database links in the schema of the user who issued the SQL statement.
2. Public database links in the local database.
3. Global database links (only if a directory server is available).
After the local Oracle Database connects to the specified remote database on
behalf of the local user that issued the SQL statement, object resolution continues as if
the remote user had issued the associated SQL statement. The first match determines the
remote schema according to the following rules:
If the database cannot find the object, then it checks public objects of the remote
database. If it cannot resolve the object, then the established remote session remains but
the SQL statement cannot execute and returns an error.
4. Advantage:
5. Disadvantage:
Additional software is required.
Operating System should support distributed environment.
Concurrency control: it is a major issue. It is solved by locking and timestamping.
Complexity.