Home >Database >Oracle >How to modify the oracle database port number

How to modify the oracle database port number

下次还敢
下次还敢Original
2024-04-18 21:00:361100browse

How to change the Oracle database port number? Stop the database service. Edit the listener configuration file and replace the old port number with the new port number. Edit the database configuration file and replace the old port number with the new port number. Start the database service. Test whether the new port number was changed successfully.

How to modify the oracle database port number

Change the Oracle database port number

How to change the Oracle database port number?

Changing the Oracle database port number involves the following steps:

Step 1: Stop the Oracle database service

  • Stop using the following command Database service:
<code class="bash">lsnrctl stop</code>

Step 2: Edit the listener configuration file

  • Open the listener configuration file listener.ora. It is usually located in the following directory:

    • Windows: ORACLE_HOME\network\admin
    • Unix: /etc/oracle/listener.ora
  • Find the section containing the following line:
<code class="text">LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = old_port))
  )</code>
  • Replace old_port with the new port number.

Step 3: Edit the database configuration file

  • Open the database configuration file init.ora or spfile. They are typically located in the following directories:

    • Windows: ORACLE_HOME\database
    • Unix: /etc/oracle/init.ora
  • Find the section containing the following line:
<code class="text"># LISTENER ADDRESS
LISTENER = (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = old_port))</code>
  • Replace old_port with the new port number.

Step 4: Start the Oracle database service

  • Use the following command to start the database service:
<code class="bash">lsnrctl start</code>

Step 5: Test the new port number

  • Test the new port number using the following command:
<code class="bash">tnsping hostname:<new_port></code>

If the connection is successful, the port number has been changed successfully. Otherwise, check that all settings are configured correctly.

The above is the detailed content of How to modify the oracle database port number. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn