--简单的测试了一下,应该是10.2提出的agent user的概念
SQL> create user test1 identified by test1;
用户已创建。
SQL> create user test2 identified by test2;
用户已创建。
SQL> grant connect to test1,test2;
授权成功。
SQL> alter user test2 grant connect through test1;
用户已更改。
SQL> connect test1[test2]/test1 --test1用户代理test2用户
已连接。
SQL> show user
USER 为 "TEST2"
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
C:>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 11月 17 11:25:51 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> grant alter system , unlimited tablespace,create table to test2;
授权成功。
SQL> grant alter session , unlimited tablespace,create table to test1;
授权成功。
SQL> connect test1[test2]/test1
已连接。
SQL> show user
USER 为 "TEST2"
--显然登录用户还是test2,当然session中的权限也是test2用户的权限
SQL> select *from session_privs;
PRIVILEGE
----------------------------------------
ALTER SYSTEM
CREATE SESSION
UNLIMITED TABLESPACE
CREATE TABLE
SQL> create table t_agent(id int);
表已创建。
SQL> connect / as sysdba
已连接。
SQL> select owner from dba_tables where table_name='T_AGENT';
OWNER
------------------------------
TEST2
SQL>
--一切操作似乎和test1无关
--======================================
--在没有agent user之前,如果我们想以test1的身份登录db的话(如果事先不知道test1的口令)需要先保留test1的password:
SQL> select password from dba_users where username='TEST1';
PASSWORD
------------------------------
22F2E341BF4B8764
SQL> alter user test1 identified by test123;
用户已更改。
SQL> connect test1/test123
已连接。
SQL> show user
USER 为 "TEST1"
SQL>
此时可以在这个session中以test1用户的身份工作
那么在另一个session中最好理解把test1的口令改回去,防止test1用户登录时出现口令错误提示:
C:>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 11月 17 11:56:57 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> alter user test1 identified by values '22F2E341BF4B8764';
用户已更改。
SQL> connect test1/test1
已连接。
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/19602/viewspace-1028790/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/19602/viewspace-1028790/