Wednesday, July 30, 2014

Login without password

LOGIN iwith out PASSWORD 

STEP 1:  First, we extract the encrypted password:
select 
'alter user "'||username||'" identified by values '''||extract(xmltype(dbms_metadata.get_xml('USER',username)),'//USER_T/PASSWORD/text()').getStringVal()||''';'  old_password 
from 
   dba_users
where
username = ‘FRED’;
 
OLD_PASSWORD
--------------------------------------------------------------------
alter user "FRED" identified by values '15EC3EC6EAF863C';

STEP 2:  You can now change FRED’s password and sign-on for testing:
alter user FRED identified by FLINTSTONE;
connect fred/flintstone;
select stuff from tables;
STEP 3:  When you have completed your testing you can set-back the original encrypted password using the output from the query in step 1:
alter user "FRED" identified by values '15EC3EC6EAF863C';



The above works only for case insensitive passwords (10g).
To retrieve 10g and 11g hashes, use the following:
set lin 200 hea off longc 1000000 long 1000000 feed off; exec
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE); 
select replace(DBMS_METADATA.GET_DDL('USER','SCOTT'),'CREATE USER','ALTER USER') from dual; 
ALTER USER "SCOTT" IDENTIFIED BY VALUES'S:F0091E6EDDBA71592E8E9A40B1459492C3E7778B5194A5358A0122DF8FA7;F894844C34402B67'
      DEFAULT TABLESPACE "USERS"
      TEMPORARY TABLESPACE "TEMP";


No comments:

Post a Comment