首页 > Linux操作系统 > Linux操作系统 > oracle成为另一个用户
oracle成为另一个用户:
为了调试应用程序,DBA有时需要作为另一个用户连接,从而模仿存在的问题。
不需要知道该用户的纯文本密码,DBA可以从数据库中检索加密的密码,改变该用户的密码,
使用改过的密码连接,然后使用alter user命令中没有规定的子句改回密码。
上面的操作假设dba可以访问dba_users表,同时具有alter user权限。如果dba具有dba角色,则同时具有以上两种权限。
实验验证过程如下:
C:\>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on 星期六 11月 26 10:49:14 2011
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show user
USER 为 "SYS"
SQL> alter user test identified by test;
用户已更改。
SQL> commit;
提交完成。
SQL> select password from dba_users where username = 'TEST';
PASSWORD
------------------------------
7A0F2B316C212D67
SQL> alter user test identified by temp;
用户已更改。
SQL> connect test/temp
已连接。
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
TRE TABLE
TY TABLE
SQL> select * from tre;
未选定行
SQL> select * from ty;
未选定行
SQL> desc ty;
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
T CHAR(10)
Y VARCHAR2(10)
SQL> alter user test identified by values '7A0F2B316C212D67';
用户已更改。
SQL> commit;
提交完成。
SQL> connect test/test;
已连接。
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
TRE TABLE
TY TABLE
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21256317/viewspace-776726/ ,如需转载,请注明出处,否则将追究法律责任。