How do synonyms work in oracle




















To keep the applications working properly, you can create a synonym that has the name the same as the old name of the table. Third, synonyms help moving objects between schemas, even databases, without breaking the existing code. A synonym is an alternative name for objects such as tables, views, sequences, stored procedures, and other database objects. You generally use synonyms when you are granting access to an object from another schema and you don't want the users to have to worry about knowing which schema owns the object.

You may wish to create a synonym so that users do not have to prefix the table name with the schema name when using the table in a query. Now, users of other schemas can reference the table called suppliers without having to prefix the table name with the schema named app. The Oracle Database adapter allows you to perform operations on synonyms. A synonym is an alias or friendly name for the database objects such as tables, views, stored procedures, functions, and packages. Working with different schemas : If you are working with different schemas, and need to access the objects across schemas, you have to use different SQL statements to access those objects.

You can create a synonym for an object in a schema, and use the synonym in your SQL statement to access the object. If you need to access the underlying object in a different schema, modify the definition of the synonym to point to the object in a different schema.

Thus, the applications based on the synonym continue to function without modification in the SQL statement. This ensures that you do not have to modify your SQL statements to perform operation on the object in different schemas. Changes in the underlying objects : The synonyms insulate you from any changes in the name or location of the underlying objects on which you are performing an operation.

You can modify the synonym definition to accommodate any changes in the name or location of the underlying objects. Note that synonyms themselves are not secured. When you grant object privileges on a synonym, you are granting privileges on the underlying object, and the synonym only acts as an alias in the GRANT statement.

Synonyms can be public or private.



0コメント

  • 1000 / 1000