Previous |
Next |
A synonym is a database object that acts as an alias for another database object. You can create both public and private synonyms. Every database user can access a public synonym. A private synonym is in the schema of a specific user, and only users who are granted access to the private synonym can use it.
In a distributed environment, synonyms can provide location transparency for database objects. A synonym hides the location of a database object from applications and users. If the database object must be moved or renamed, then you can redefine the synonym, and applications and users can continue to use the synonym without any modifications.
For example, suppose an application must access the hr.employees
table at a remote database with the global name ii2.example.com
. A database link exists for the remote database, and the name of the database link is ii2.example.com
. In this case, you can create a synonym named employees
in the hr
schema that points to the table hr.employees@ii2.example.com
. After the synonym is in place, the application at the local database can use hr.employees
to access the remote table.