简体   繁体   中英

Oracle 12c Username forgot

a couple of days ago I installed oracle 12c. I ran it after a days or two but I completely lost my Username, I do remember my password but not username. I there any way by which I can see what username I set

Assuming that you can login as SYS , you can use:

select *
from dba_users

This will give all the users, including the one you defined; here you find something more.

There is new procedure for generating password since Oracle 11g. You can use

create or replace function get_hash_11g(p_password varchar2, p_salt varchar2) return varchar2 is
    lv_pwd_raw    RAW(128);
    lv_enc_raw    RAW(2048);
  BEGIN 
    lv_pwd_raw    := utl_raw.cast_to_raw(p_password) || hextoraw(p_salt);
    lv_enc_raw    := sys.dbms_crypto.hash(lv_pwd_raw, 3);

    return lv_enc_raw;
  end get_hash_11g;
/

Then run select

select w.name from sys.user$ w
where substr(w.spare4, 3, 40) = get_hash_11g(/*your password*/'&pass', substr(spare4, 43, 20));
/

Set up the following environment variables. They are not necessary for the process itself, but will help you navigate. In this case my domain is called "ClassicDomain". Remember to change the value to match your domain.

export MW_HOME=/u01/app/oracle/middleware
export DOMAIN_HOME=$MW_HOME/user_projects/domains/ClassicDomain

Shut down the WebLogic domain.

$ $DOMAIN_HOME/bin/stopWebLogic.sh

Rename the data folder.

$ mv $DOMAIN_HOME/servers/AdminServer/data $DOMAIN_HOME/servers/AdminServer/data-old

Reset the password using the following command. Remember to substitute the appropriate username and password.

$ cd $DOMAIN_HOME/security
$ java weblogic.security.utils.AdminAccount <username> <password> .

If you are able to invoke sqlplus then follow this:

sqlplus:/ as sysdba - this is the command needed to login as sys .

password: - don't give any password . Just hit enter

SQL> select username from dba_users; - this command will give list of users in the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM