Oracle Synonym Concepts

Source: Internet
Author: User

OracleSynonyms

Oracle synonym for (synonyms) similar to view features, but more powerful. Most database objects in an Oracle database, such as tables, views, materialized views, sequences, functions, stored procedures, packages, synonyms, and so on, can be synonyms. There are 2 main purposes: to simplify object access and improve the security of object access .

Here's a quick demo:

Sql> Conn Scott/tiger

Connected.

Sql> CREATE TABLE test1 (ID number);

Table created.

sql> INSERT INTO test1 values (1);

1 row created.

Sql> commit;

1 , create a connected user:

Sql> Conn/as sysdba;

Connected.

Sql> create user ZSL identified by ZSL;

User created.

2 , create profile:

Sql> Create profile Zsl_test1 Limitsessions_per_user 5;

Profile created.

3 , set profile binding User:

sql> alter user ZSL profile Zsl_test1;

User altered.

4 , granting Permissions

Sql> Grant create session to ZSL;

Grant succeeded.

Sql> Grant Select on Scott.test1 to ZSL;

Grant succeeded.

5 , creating synonyms

sql> create synonym Zsl.test1 forscott.test1;

Synonym created.

6 , switch to ZSL user under test

Sql> Conn ZSL/ZSL

Connected.

Sql> select * from Test1;

Id

----------

1

7 , find the owner

Sql> Conn/as sysdba;

Connected.

Sql> Set Line 150

Sql> Select Owner,synonym_name,table_owner, table_name from dba_synonyms where Synonym_name=upper (' test1 ');

OWNER Synonym_name Table_owner table_name

---------------- ------------------------- ----------------   -------------------

ZSL TEST1 SCOTT TEST1


Oracle Synonym Concepts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.