You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Oracle 19c无法创建用户及测试连接问题求助(附操作步骤图片)

Hey there, let’s troubleshoot your Oracle 19c user creation and connection issues together. Based on common pain points in 19c, here’s a step-by-step breakdown to get to the bottom of this:

1. Verify Your Current Session’s Privileges

To create a user, you need the CREATE USER privilege. If you’re working in a Container Database (CDB), you might need additional container-specific permissions. First, check what privileges you have:

SELECT * FROM SESSION_PRIVS WHERE PRIVILEGE LIKE '%CREATE USER%';
  • If you don’t see CREATE USER in the results, log in as a user with SYSDBA privileges (like SYS) and grant the necessary permissions:
    GRANT CREATE USER TO your_current_username;
    -- For cross-container access in CDBs, add CONTAINER=ALL
    GRANT CREATE USER TO your_current_username CONTAINER=ALL;
    
2. Ensure You’re Working in the Correct Container (CDB vs. PDB)

Oracle 19c defaults to a CDB architecture, and this trips up a lot of folks:

  • If you’re in the root container (CDB$ROOT), you can only create common users which require a C## prefix:
    CREATE USER C##testuser IDENTIFIED BY your_secure_password;
    
  • For regular (local) users, you need to switch to a Pluggable Database (PDB) first. Start by listing available PDBs:
    SELECT NAME, OPEN_MODE FROM V$PDBS;
    
  • Switch to your target PDB (replace PDBORCL with your actual PDB name):
    ALTER SESSION SET CONTAINER=PDBORCL;
    
  • Now you can create a regular user without the C## prefix:
    CREATE USER testuser IDENTIFIED BY your_secure_password;
    
3. Check Password Policy Restrictions

Oracle 19c enforces default password complexity rules that might block user creation. Let’s check the current policy:

SELECT * FROM DBA_PROFILES WHERE PROFILE='DEFAULT' AND RESOURCE_NAME LIKE '%PASSWORD%';
  • If your password doesn’t meet the requirements, either:
    1. Choose a password that matches the complexity rules (e.g., mix of letters, numbers, special characters), or
    2. Temporarily adjust the profile (not recommended for production environments):
      ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNCTION NULL;
      ALTER PROFILE DEFAULT LIMIT PASSWORD_REUSE_MAX UNLIMITED;
      
4. Troubleshoot Connection Test Failures

Even if you create the user successfully, you might still hit connection issues. Try these checks:

  • Grant the CREATE SESSION privilege: Users can’t log in without this. Run:
    GRANT CREATE SESSION TO testuser;
    
  • Check the Oracle Listener: Make sure the listener service is running. Open a command prompt and run:
    lsnrctl status
    
    If it’s stopped, start it with lsnrctl start.
  • Validate Your Connection String: For PDB connections, you need to specify the PDB service name in your connection string. Example:
    sqlplus testuser/your_password@//localhost:1521/PDBORCL
    
    If using a TNS alias, double-check your tnsnames.ora file to ensure it points to the correct PDB service.
  • Check if the User is Locked: Multiple failed login attempts can lock the user. Verify the status:
    SELECT USERNAME, ACCOUNT_STATUS FROM DBA_USERS WHERE USERNAME='TESTUSER';
    
    If locked, unlock the user with:
    ALTER USER testuser ACCOUNT UNLOCK;
    
5. Use Error Codes to Narrow Down the Issue

If none of the above works, pay close attention to the exact error message and ORA-xxxx code you get when creating the user or testing the connection. Codes like ORA-01031 (insufficient privileges) or ORA-65096 (invalid common user name) will directly point to the root cause. Sharing these codes will help us zero in on the problem faster.

内容的提问来源于stack exchange,提问作者Parth

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 21:42:55