Oracle 18c XE创建用户后遭遇ORA-01017:无效用户名/密码;登录被拒绝问题的解决方法
Let's work through this issue step by step—here are the most likely fixes based on your setup:
1. Ensure you're logging into the correct PDB (XEPDB1)
You created the ashmeta user inside the XEPDB1 pluggable database, but by default, Oracle XE connects to the root container (XE) if you don't specify the PDB. That's probably the main issue here.
To log into the right container:
- If using SQL*Plus locally, use this command (replace
localhost:1521with your host/port if needed):sqlplus ashmeta/ashmeta@localhost:1521/XEPDB1 - If you have a TNS entry configured for
XEPDB1, you can also use:sqlplus ashmeta/ashmeta@XEPDB1
2. Verify the ashmeta user exists in XEPDB1
Double-check that the user was actually created in the correct PDB. Log into SYS in XEPDB1 and run:
ALTER SESSION SET CONTAINER=XEPDB1; SELECT username, account_status FROM dba_users WHERE username = 'ASHMETA';
- If the user doesn't show up, you might have run the
CREATE USERcommand before switching to XEPDB1. Re-run the create user statement after switching containers. - If the account status is
LOCKED, unlock it with:ALTER USER ashmeta ACCOUNT UNLOCK;
3. Confirm case-insensitive logon is active in XEPDB1
You set SEC_CASE_SENSITIVE_LOGON = FALSE at the system level, but let's confirm it's applied in the PDB. Run this in XEPDB1:
SHOW PARAMETER SEC_CASE_SENSITIVE_LOGON;
If the value isn't FALSE, set it for the current session (to test) or persistently:
-- Session-level (immediate effect for your current session) ALTER SESSION SET SEC_CASE_SENSITIVE_LOGON = FALSE; -- If you want it permanent for the PDB (requires restart if using SPFILE) ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON = FALSE CONTAINER=CURRENT;
4. Test with explicit case (just in case)
Even with case-insensitive logon enabled, sometimes typos or hidden formatting can cause issues. Try logging in with uppercase credentials to rule this out:
sqlplus ASHMETA/ASHMETA@XEPDB1
Most of the time, the first step (specifying the PDB in your connection string) fixes this issue—since users created in a PDB aren't visible in the root container.
内容的提问来源于stack exchange,提问作者Amir251

