Create & Grant Oracle Synonyms Guide
To create a synonym in Oracle and grant access to other users, you can follow these steps:
- Connect to the Oracle database using the command: sqlplus username/password@database
- Create a synonym called synonym_name for the table schema_name.table_name.
- synonym_name is the name of the synonym you want to create, schema_name is the name of the schema where the table is located, and table_name is the name of the table for which you want to create the synonym.
- Grant permission for other users to access the synonym under the name “synonym_name”.
- In this case, synonym_name is the name of the synonym you created, and other_username is the username of the other user you want to grant access to.
- Submit changes:
COMMIT; - Exit SQL*Plus by typing “EXIT;”.
In this way, you have successfully created synonyms and granted permission to other users. Now, other users can access the table using the synonyms without needing to know the actual table and schema names.