🧩 How to Fix ORA-01017: Invalid Username/Password; Logon Denied
🧩 Introduction:
The ORA-01017 error occurs when a user attempts to connect to the Oracle database with an incorrect username or password. This error is one of the most common login issues and can happen due to typos, expired passwords, or misconfigured database connections. Proper troubleshooting ensures database security and seamless access.
Step 1: Verify Username and Password
Double-check the credentials being used:
sqlplus username/password@db_service
➡️ Ensure no typos or extra spaces exist in the username or password.
Step 2: Check for Case Sensitivity
Oracle 11g and later treat passwords as case-sensitive by default. Make sure the correct case is used:
ALTER USER your_user IDENTIFIED BY "NewPassword";
Step 3: Check Account Status
Sometimes the user account is locked or expired:
SELECT username, account_status
FROM dba_users
WHERE username = 'YOUR_USER';
➡️ If locked:
ALTER USER your_user ACCOUNT UNLOCK;
➡️ If expired:
ALTER USER your_user IDENTIFIED BY new_password;
Step 4: Verify Database Connection Details
Ensure the tnsnames.ora file points to the correct service name and host. Test the connection:
tnsping DB_SERVICE
Step 5: Example Scenario
A developer tries to log in:
sqlplus hr/hrpass@orcl
and gets ORA-01017. Checking the dba_users table:
SELECT username, account_status FROM dba_users WHERE username='HR';
shows the account is LOCKED. The DBA unlocks it:
ALTER USER HR ACCOUNT UNLOCK;
and resets the password:
ALTER USER HR IDENTIFIED BY hrpass123;
Login now succeeds.
Conclusion:
ORA-01017 errors are typically due to wrong credentials, expired passwords, or locked accounts. By carefully verifying credentials, checking account status, and validating connection details, DBAs can quickly resolve login issues and maintain secure access to the database.

Comments
Post a Comment