| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Becoming another user using Oracle's OCI
A copy of this was sent to "Viewer" <bmotzer_at_spacestar.com>
(if that email address didn't require changing)
On Sun, 28 Mar 1999 14:47:36 -0600, you wrote:
>Fellow DBA's,
>
>I know that there are 3rd party tools that can connect as any user if they
>have the become user
>privilege. As a DBA I believe that Oracle should have had this feature
>available in sqlplus as well a long time ago. I've seen 3rd party tools
>connect as other users and I also know that they are doing this through OCI
>(Oracle's call interface). The question is what command are they issuing and
>how are they issuing it? Any information that could lead me in the right
>direction would be appreciated.
>
>Thanks
>
Its not a command but rather an undocumented API call. In sqlplus if you want to 'become' a user, the following script works well for DBAs. It relies on the alter user command:
column password new_value pw
declare
l_passwd varchar2(45);
begin
select password into l_passwd
from sys.dba_users
where username = upper('&1');
select password
from sys.dba_users
where username = upper( '&1' )
/
alter user &1 identified by Hello;
connect &1/hello
alter user &1 identified by values '&pw';
show user
whenever sqlerror continue
Just go:
SQL> @su <someuser>
to become that user..
it starts by testing your access to the sys.dba_users table -- if that fails -- it exits. If zero rows returned -- it exits.
It then selects the 'password' from the dba_users table and stuffs it into a macro variable "&pw"
We alter the user you want to become to have a known password (if that fails, we exit).
We 'fix' their password back after loggin in as them....
Note, you need to have access to dba_users and the alter user privelege.
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |