标签:oracle number profile created synonyms
Oracle的同义词(synonyms)跟View功能类似,但更强大。在Oracle数据库中的大部分数据库对象,如表、视图、物化视图、序列、函数、存储过程、包、同义词等等都可以做为同义词。其目的主要有2个:用于简化对象访问和提高对象访问的安全性。
下面简单做个演示:
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、创建连接用户:
SQL> conn /as sysdba;
Connected.
SQL> create user zsl identified by zsl;
User created.
2、创建profile:
SQL> create profile zsl_test1 limitsessions_per_user 5;
Profile created.
3、设置profile绑定用户:
SQL> alter user zsl profile zsl_test1;
User altered.
4、赋予权限
SQL> grant create session to zsl;
Grant succeeded.
SQL> grant select on scott.test1 to zsl;
Grant succeeded.
5、创建同义词
SQL> create synonym zsl.test1 forscott.test1;
Synonym created.
6、切换到zsl用户下测试
SQL> conn zsl/zsl
Connected.
SQL> select * from test1;
ID
----------
1
7、查找属主
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 number profile created synonyms
原文地址:http://fjzsl.blog.51cto.com/6280606/1812627