pdb可以启动,但不知道pdb中创建的默认用户名是什么,而且即使知道用户名,密码也忘记了怎么办:
首先,如果知道pdb中的用户名,如果在CDB中,是没有办法修改PDB中的普通用户的,如下:
打开PDB:
[oracle@ocp ~]$ sqlplus / as sysdba
SQL>alter pluggable database SK_WMS open;
SQL> show con_name;
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 SK_WMS READ WRITE NO
SQL> alter user SK_WMS identified by 123456;
alter user SK_WMS identified by 123456
*
ERROR at line 1:
ORA-01918: user 'SK_WMS' does not exist
即使使用sys用户登录CDB,也无法修改pdb中的用户名和密码
如果只知道有SK_WMS这样一个容器,也不知道容器中创建的用户名和密码,可以通过以下方式找回并重置密码:
首先打开PDB容器;
[oracle@ocp ~]$ sqlplus / as sysdba
SQL>alter pluggable database SK_WMS open;
SQL> show con_name;
CON_NAME
------------------------------
CDB$ROOT
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 SK_WMS READ WRITE NO
查询不同pdb对应的用户和默认表空间:
set linesize 200;
col NAME format a20;
col USERNAME format a20;
col DEFAULT_TABLESPACE format a20;
col PASSWORD format a20;
select a.con_id,a.name,b.username, b.default_tablespace,b.password,b.created from v$pdbs a left join cdb_users b on a.con_id = b.con_id where b.default_tablespace not in ('SYSTEM','SYSAUX','USERS') and b.username not in ('GSMCATUSER','MDDATA','SYSBACKUP','REMOTE_SCHEDULER_AGENT','GSMUSER','SYSRAC','OJVMSYS','AUDSYS','DIP','SYSKM','SYS$UMF','SYSDG','SPATIAL_CSW_ADMIN_USR','ORACLE_OCM');
CON_ID NAME USERNAME DEFAULT_TABLESPACE PASSWORD CREATED
---------- -------------------- -------------------- -------------------- -------------------- ---------------
3 SK_WMS SK_WMS SK_WMS 30-NOV-23
上面找到了PDB名称和普通用户对应的关系
PDB名称为SK_WMS,对应的普通用户名称为SK_WMS,表空间也是SK_WMS
现在通过sys用户登录SK_WMS容器中,修改用户SK_WMS的密码:
[oracle@ocp ~]$ sqlplus sys/oracle@172.16.1.130:1521/SK_WMS as sysdba
SQL> show con_name;
CON_NAME
------------------------------
SK_WMS
SQL> alter user SK_WMS identified by SK_WMS;
User altered.
通过PDB SK_WMS的普通用户和密码登录:
[oracle@ocp ~]$ sqlplus SK_WMS/SK_WMS@172.16.1.130:1521/SK_WMS;
SQL*Plus: Release 12.2.0.1.0 Production on Sun Dec 3 16:58:08 2023
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Last Successful login time: Thu Nov 30 2023 11:02:03 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show con_name;
CON_NAME
------------------------------
SK_WMS
通过上面方法,破解了PDB普通用户的帐号和密码:
2023-12-03
ORACLE 12C PDB普通用户忘记密码找回方法
评论
发表评论
姓 名: