SoFunction
Updated on 2025-04-08

Detailed guide to modifying Oracle passwords under Linux

introduction

Navicat is a powerful database management tool that allows easy connection and management of multiple types of databases, including Oracle. However, when connecting to Oracle databases, many newbies may be unable to complete the operation because they are not clear about their password. This article will start by modifying the Oracle user password and gradually explain how to successfully connect to the Oracle database using Navicat.

text

1. Understand the principle of connecting Navicat and Oracle

Navicat communicates with Oracle database through OCI (Oracle Call Interface). When connecting, the following key information is required:

  • username:likeSYSSYSTEMOr customize the user.
  • password: The user's login password.
  • Connection information: Includes the host address, port (default 1521), and service name or SID.

If the password is wrong or forgotten, you need to reset the user password on the server side (Linux system).

2. Steps to modify Oracle user password

2.1 Prerequisites

Before starting the operation, make sure:

  1. You have permissions to install the user of Oracle (usuallyoracleuser).
  2. Configured environment variables, such asORACLE_HOMEandORACLE_SID
  3. You can access the terminal of the Linux system.

2.2 Log in to Linux system

Log in to the Linux system running Oracle database via SSH or physical terminal.

2.3 Switch to Oracle User

Use the following command to switch to the Oracle installation user:

su - oracle

2.4 Enter SQL*Plus tool

SQLPlus is a command line tool provided by Oracle that can be used to manage databases. Use the following command to enter SQLPlus:

sqlplus / as sysdba

After successful execution, a prompt for SQL*Plus will be displayed:

SQL>

2.5 Modify user password

Run the following command in SQL*Plus to modify the password of the target user. For example, to use the userSYSTEMReset the password tonewpassword

alter user SYSTEM identified by newpassword;

After successful execution, you will see the following prompt:

User altered.

2.6 Exit SQL*Plus

Enter at the SQL*Plus promptexitquit:

exit

3. Connect to Oracle database using Navicat

3.1 Configuring connection information

Open Navicat, click "New Connection", and select "Oracle". Fill in the following information in the pop-up window:

  • Connection name: Customize a name, such asOracle_Connection
  • username: Fill in Oracle's username, for exampleSYSTEM
  • password: Fill in the new password you just set, for examplenewpassword
  • Host: Enter the IP address of the server where the Oracle database is located.
  • port: Default is1521
  • Service name/SID: Fill in according to the actual configuration.

3.2 Test connection

Click the "Test Connection" button. If set correctly, Navicat will display a prompt for a successful connection.

3.3 Connect to the database

After saving the connection configuration, double-click the connection name to open the database and start the operation.

4. Frequently Asked Questions and Solutions

Question 1: ORA-01017: invalid username/password; logon denied

  • reason: Incorrect username or password.

  • Solution:

    • Confirm that the username and password are correct.
    • If you don't remember your password, please refer to the steps above to reset your password.

Issue 2: Cannot connect to the database

  • reason: The host address or service name is configured incorrectly.

  • Solution:

Confirm whether the host address and port filled in Navicat are correct.

Use the following command to check whether the Oracle listener is started:

lsnrctl status

If the listener is not started, start with the following command:

lsnrctl start

Issue 3: The connection failed due to missing dynamic libraries

  • reason: Navicat does not load the OCI dynamic library correctly.

  • Solution

    • Specify the path to the OCI dynamic library in Navicat's connection settings (usually located in$ORACLE_HOME/lib)。

5. Recommended scripts

To simplify the password reset process, you can write the following shell script:

#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH

# Switch to Oracle Usersu - oracle -c "sqlplus / as sysdba <<EOF
alter user SYSTEM identified by newpassword;
exit;
EOF"

Save asreset_oracle_password.sh, and grant execution permissions:

chmod +x reset_oracle_password.sh

Run the script to reset the password:

./reset_oracle_password.sh

Summarize

This article explains in detail how to deal with password issues when using Navicat to connect to Oracle database, including detailed steps to modify Oracle user passwords in Linux systems, as well as Navicat's connection configuration methods and solutions to common problems. With these steps, you can easily complete the connection.

The above is the detailed guide to modifying Oracle passwords under Linux. For more information about modifying Oracle passwords in Linux, please follow my other related articles!