Logo

SQL Script

Connect as another user

Tested on Oracle 8.1 Tested on Oracle 8.0 Tested on Oracle 7

Updated : 1-June-1998
Version : 1.0

Description

This script allows you to change to connect to another schema from any DBA database user without you knowing the password. It resets the password back to the original so nobody knows you've connected, (unless the database is being audited or course!)

Parameters

&user - Schema to connect as

SQL Source

CLEAR
SET HEAD ON
SET VERIFY OFF

PROMPT
ACCEPT user PROMPT ' Goto which user : ' 

set pages 0
set feed off
set verify off
set echo off
set term off

spool temp.sql

select 'alter user &user identified by values '||chr(39)||password||chr(39)||';'
from dba_users
where username = UPPER('&user')
/

spool off

PROMPT
PROMPT Changing password of &user to TEMP ...
PROMPT

alter user &user identified by temp;

PROMPT 
PROMPT Connect as &user ...
PROMPT

connect &user/temp

PROMPT 
PROMPT Resetting Password to original ...
PROMPT

START temp.sql

Return to Index of SQL Scripts


Home | Company Profile | Services | Contact Us | SQL scripts and tips | Quiz
Legal

Logo