About
Oracle Synonyms
Administration and
Creation of Synonyms
Synonyms are a very
powerful feature of Oracle and other
SQL-compliant relational database systems.
They are used as a database shorthand. They
make it possible to shorten the
specification of long or complex object
names. This is especially useful for shared
tables or views. In addition, the use of
DATABASE LINKS in synonyms allows
transparent access to other databases on
other nodes or even other entire systems
halfway around the globe.
Synonyms are created
using the CREATE SYNONYM command. Synonyms
can be either PRIVATE (the default) or
PUBLIC. Private synonyms can only be used by
the user creating them. You must have a
specific grant or one of the special ROLES
assigned to you before you can create
synonyms. Only users with appropriate
privileges (usually DBAs) can create PUBLIC
synonyms. Since only the owner can use them,
PRIVATE synonyms are more secure.
Monitoring
Synonyms Using the V$ and DBA_ Views
Synonyms
remain the same in Oracle8, Oracle8i, and
Oracle9i. The major changes that have
affected Oracle synonyms are those to the
structure of the connection strings from
SQL*NET V1 to V2 to NET8. Despite the fact
that synonyms are the key to providing
cross-database access for queries, and a
means of implementing distributed data
across nodes, systems, and databases, in all
the reports reviewed for this book, not one
seemed to cover synonyms. Recall that a
synonym allows a shorthand version of an
object name to be specified. The parts of a
synonym are the object name (which usually
includes an owner) and, possibly, a database
link that will also provide an Oracle user
name and password to a remote system. A
complete report will show all of these
items.
Why is it important
to monitor Oracle synonyms? Oracle synonyms
can be used to access data, sometimes data
that shouldn't be accessed if object grants
have been too widely granted. In addition,
they are the means for reaching other nodes
and databases. If a connect string becomes
invalid, a user name is disconnected or its
password changes or node name changes, it is
good to be able to see which object synonyms
will be affected.
You may also want to create private synonyms
for the objects you are going to replicate
with the create synonym command. You can use
this command to create private Oracle
synonyms as seen in this example:
CREATE
SYNONYM my_tab FOR tab_own.my_tab; |
|