Monday, April 29, 2013

Synonyms In Oracle

Synonyms is a database object which it is alternate name or a duplicate name for original base table.

1) Once we create synonyms,the synonym will be created on entire table,but it is not possible to create a synonyms based on the partial table or subset of the table.

2) If we perform any operation on synonyms then same operation automatically affected to corresponding base table and vice-verse.

3)  We cannot create synonyms based on the more than one table.

4)  We can create synonyms up-to user requirement,means n number of times.

5)  We can create a synonyms with a base table or without a base table

6)  Once we drop base table corresponding synonyms will not be dropped but it becomes invalid.

7)  Synonyms will becomes invalid in 2 cases.
       a) When we drop base table
       b) When we change the table name.

8) An invalid synonyms we cannot perform any operation on that table.

9) We can make invalid synonyms as valid synonyms.

Syntax To Create a Private Synonyms:

       create synonym synonym_name for table_name

Syntax To See List Of Synonyms:

       select * from user_s

Syntax To Create a Private Synonyms:

       drop synonym synonym_name



Post a Comment