3.14 Managing Synonyms

A synonym is an alias for a schema object. Use Object Browser to create, view and drop a synonym.

Synonyms can provide a level of security by masking the name and owner of an object and providing location transparency for remote objects of a distributed database. Synonyms are also convenient to use and reduce the complexity of SQL statements for database users.

See Also:

Managing Views_ Sequences_ and Synonyms in Oracle Database Administrator’s Guide for information about synonyms

3.14.1 Creating Synonyms

Use Object Browser to create synonyms.

To create a synonym:

  1. In Object Browser, click the Create Database Objects menu and select Synonym.

    Tip:

    To create new objects from the Object Tree, right-click the object and select the Create option.

    The Create Synonym dialog appears.

On Create Synonym:

  1. Synonym Name - Identify the name of the synonym. Synonym names must conform to Oracle naming conventions and cannot contain spaces, or start with a number or underscore.
  2. Object Owner - Specify the database schema (or username) that owns the object upon which you wish to create your synonym.
  3. If your schema contains database links, additional fields display depending on configuration:
    1. Create Synonym On - Choose whether to create a synonym on a Local Object object from the local database or a Remote Object from a remote database.
    2. Remote Object - Enter the name of the remote object upon which you wish to create a synonym.
    3. Database Link - Select a database link to be used to access the Remote Object.
  4. Object - Select an object upon which you wish to create a synonym.

    Tip:

    The SQL Script region displays SQL generated by this dialog. To copy the SQL, click the Copy icon.
  5. Click Create Synonym.
    The Object Details tab appears.

3.14.2 Viewing a Synonym

View existing synonyms in Object Browser.

To view an existing synonym:

  1. In Object Browser, Object Tree, expand Synonyms and select a synonym to view.
  2. The Object Detail View appears and displays the following tab:
    • Object Details - Displays details about the synonym. Clicking the object name (for example, a table name) displays the details of that object. Available actions include:
      • Drop
      • Refresh

3.14.3 Dropping a Synonym

Select a synonym from the Object Selection pane and click Drop on the Object Details tab.

To drop a synonym:

  1. In Object Browser, Object Tree, expand Synonyms and select a synonym to view.
    The Object Detail View appears.
  2. Click Drop.

    In the Drop dialog:

    1. Drop - Review the details.
    2. SQL - The SQL Script region displays the SQL generated to drop the synonym. To copy the displayed SQL, click the Copy icon.
    3. Confirm your selection and click Drop again.