ORA-01017: invalid username/password; logon denied
When encountering an ORA-01017 error, it means that the login is denied. The main reason is that the user name or password is wrong or the account status is abnormal. 1. First, manually check the user name and password, and note that the upper and lower case and special characters must be wrapped in double quotes; 2. Confirm that the service name or SID of the connection is correct, and you can test the connection through tnsping; 3. Check whether the account is locked or the password expires, and the DBA needs to query the dba_users view to confirm the status; 4. If the account is locked or expired, you need to execute the ALTER USER command to unlock and reset the password; 5. Note that Oracle 11g and above versions are case-sensitive by default, and you need to ensure that the input is accurate. 6. When logging in to special users such as SYS, you should use the as sysdba method, and ensure that the password file and listening configuration are correct; 7. Check whether the password file exists and the REMOTE_LOGIN_PASSWORDFILE parameter settings in advanced scenarios. The complete investigation needs to be verified one by one according to the steps to ultimately ensure that the authentication information is consistent with the database configuration, and the problem can be solved.
When you encounter an ORA-01017: invalid username/password; logon denied error, it means that the Oracle database rejects your login request, usually because the username or password is incorrect. Although the problem may seem simple, it may be caused by a variety of reasons in actual use. Here are the common causes and solutions:

✅ 1. Check whether the username and password are correct
This is the most common reason, especially when:
- Passwords are case sensitive (especially in 11g and above)
- Incorrect characters were used (such as
0
andO
,l
and1
) - Copy and paste with spaces
suggestion:

- Manually re-enter the username and password
- Make sure Caps Lock is not turned on
- If using tools (such as SQL*Plus, Toad, PL/SQL Developer), try to explicitly type in the command line:
sqlplus username/password@service_name
⚠️ Note: If the password contains special characters (such as
@
,/
,#
), it needs to be enclosed in double quotes:sqlplus myuser/"P@ssw0rd123"@orcl
✅ 2. Confirm whether the database service name or SID is correct
Even if the username and password are correct, connecting to the wrong instance can cause login to fail or timeout, and sometimes it can appear as ORA-01017.

Inspection method:
- Confirm that the service name in the TNS configuration (
tnsnames.ora
) is correct - Test connection using
tnsping
:
tnsping orcl
- Or use the full connection string directly in SQL*Plus:
sqlplus username/password@//hostname:port/service_name
For example:
sqlplus scott/tiger@//192.168.1.100:1521/orclpdb
✅ 3. Check whether the account is locked or expired
Oracle users may be locked due to multiple login failures, or their password has expired.
How to confirm: Log in to the database as DBA and execute:
SELECT username, account_status, expiry_date, lock_date FROM dba_users WHERE username = 'YOUR_USERNAME';
Common Status:
-
LOCKED
: Account is locked -
EXPIRED
: Password expired -
EXPIRED(GRACE)
: Expired but within grace period
Solution (requires DBA permission):
-- Unlock the account ALTER USER scott ACCOUNT UNLOCK; -- Reset password and unlock ALTER USER scott IDENTIFIED BY newpassword ACCOUNT UNLOCK;
✅ 4. Pay attention to password case sensitive settings
Starting with Oracle 11g, password case sensitivity is enabled by default ( SEC_CASE_SENSITIVE_LOGON=TRUE
).
This means:
-
Password123
≠password123
Inspection method:
SHOW PARAMETER SEC_CASE_SENSITIVE_LOGON
suggestion:
- Strictly match case when entering a password
- If you need to temporarily shut down (production environment is not recommended):
ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON=FALSE;
✅ 5. Check whether the correct authentication method is used
Some users (such as SYS
) must log in using a specific method:
sqlplus sys/password as sysdba
If you log in to SYS
in normal way, it may fail.
Notice:
-
AS SYSDBA
requires operating system authentication or password file support - Make sure
ORACLE_SID
is set correctly - On Windows, you may need to run the command line as a service account
✅ 6. Password file or listener issues (less common)
If you use SYSDBA
to log in to the remote database, but the password file is corrupt or not configured correctly, you may also report ORA-01017.
Check items:
- Whether the password file exists (
orapw<sid></sid>
) - Is the parameter
REMOTE_LOGIN_PASSWORDFILE
set toEXCLUSIVE
- Is there multiple instances confusion
Summary of the steps to check
- [ ] 1. Manually enter the username/password, pay attention to case and special characters
- [ ] 2. Use
tnsping
to test the connection service name - [ ] 3. Check the account status (locked/expired)
- [ ] 4. DBA assists in unlocking or resetting passwords
- [ ] 5. Confirm whether
AS SYSDBA
permission is required - [ ] 6. Check password file and listening configuration (advanced scenario)
Basically these common reasons. ORA-01017 seems simple, but it may become complicated after being configured in combination with the environment. The key is to first confirm "whether you really lost the right one", and then gradually eliminate account status and connection issues.
The above is the detailed content of ORA-01017: invalid username/password; logon denied. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

ArtGPT
AI image generator for creative art from text prompts.

Stock Market GPT
AI powered investment research for smarter decisions

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

Redis is superior to traditional databases in high concurrency and low latency scenarios, but is not suitable for complex queries and transaction processing. 1.Redis uses memory storage, fast read and write speed, suitable for high concurrency and low latency requirements. 2. Traditional databases are based on disk, support complex queries and transaction processing, and have strong data consistency and persistence. 3. Redis is suitable as a supplement or substitute for traditional databases, but it needs to be selected according to specific business needs.

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.

Redis is a memory data structure storage system, mainly used as a database, cache and message broker. Its core features include single-threaded model, I/O multiplexing, persistence mechanism, replication and clustering functions. Redis is commonly used in practical applications for caching, session storage, and message queues. It can significantly improve its performance by selecting the right data structure, using pipelines and transactions, and monitoring and tuning.
