🧩 How to Fix ORA-01017: Invalid Username/Password
🧩 Introduction
The ORA-01017 error occurs when a user attempts to log in to an Oracle database with incorrect credentials. This can happen due to mistyped usernames or passwords, expired passwords, or incorrect database connections. Troubleshooting this error is crucial because it prevents legitimate users and applications from accessing the database.
---
Step 1: Verify Username and Password
Ensure you are using the correct Oracle username.
Confirm the password is accurate, including case sensitivity (Oracle passwords are case-sensitive).
If unsure, contact the DBA or use a known working account to verify connectivity.
---
Step 2: Check the Database Connection String
Ensure the tnsnames.ora or connection string matches the database service.
Example of a correct connection string:
sqlplus username/password@//hostname:1521/service_name
A mismatch in the service name or host can result in ORA-01017 even with correct credentials.
---
Step 3: Check for Expired Passwords
Oracle accounts can expire or be locked. Check the status:
SELECT username, account_status
FROM dba_users
WHERE username = 'YOUR_USERNAME';
If the account is EXPIRED, reset the password:
ALTER USER username IDENTIFIED BY new_password;
If the account is LOCKED, unlock it:
ALTER USER username ACCOUNT UNLOCK;
---
Step 4: Verify NLS Settings
Oracle passwords are case-sensitive and affected by NLS parameters.
Check the NLS settings on both client and server to ensure compatibility.
---
Step 5: Test the Connection
After confirming credentials and account status, attempt to connect:
sqlplus username/new_password@//hostname:1521/service_name
If the connection succeeds, the issue is resolved.
---
Step 6: Prevent Future Occurrences
Enforce proper password policies and expiration notifications.
Document login credentials securely.
Consider using Oracle Wallet or other secure methods for automated applications to store credentials safely.
---
Conclusion
ORA-01017 (Invalid Username/Password) is a common login error that usually stems from incorrect credentials, expired passwords, or misconfigured connection strings. By verifying credentials, checking account status, and ensuring proper connection configuration, DBAs can quickly resolve this error and restore database access.
---

Comments
Post a Comment