DBA script (6)

From: Paultje Bakker <bakker_at_cs.uq.oz.au>
Date: 21 Feb 1994 01:05:33 GMT
Message-ID: <2k91ct$3tn_at_uqcspe.cs.uq.oz.au>


Hi people,

Here's my final script; just a handy little one to make connecting to another user easy.

REM CONNECT_TO.SQL
REM Created 19-NOV-93 by R. Bakker
REM
REM Purpose is to let a DBA connect to another username without having to REM know the password. Method is to store the (encrypted) password, REM change the password to some string, spawn a SQLPLUS session with REM that user and the new password, and reset it when the spawned REM session is exited from.
REM
REM Single parameter is the username.
REM
set echo off
set embedded on
set verify off
set feedback off
set head off
define CR = "CHR(10)"
REM
select upper('&1')||' is not a valid user.' from sys.dual
where not exists (select 'x'

                   from   sys.dba_users
                   where  username = upper('&1'));
REM
set termout off
spool tmp.tmp
select
'alter user &1 identified by aaabbb;'||&CR||
'prompt '||&CR||
'prompt Connecting to '||upper('&1')||'.'||&CR||
'prompt When you exit out, the password shall be automatically reset.'||&CR||
'prompt '||&CR||
'$sqlplus &1/aaabbb'||&CR||
'alter user &1 identified by values '''||password||''';'
from sys.dba_users
where username = upper('&1');
spool off
set termout on
_at_tmp.tmp
set head on
set feedback on

Rick Bakker, roving DBA.

--
Paul Bakker  bakker_at_cs.uq.oz.au | "PhD theses usually marshall an
Computer Science Dept.          | army of facts to starve a
The University of Qld           | slender and tedious truth
QLD 4072 Australia              | into submission" - The Guardian              
Received on Mon Feb 21 1994 - 02:05:33 CET

Original text of this message