Home  >  Article  >  Database  >  How to modify port in oracle

How to modify port in oracle

PHPz
PHPzOriginal
2023-04-25 09:01:203851browse

Oracle is a popular relational database management system through which large amounts of data can be stored and managed. Oracle uses the default port 1521 to establish connections with clients. However, if you need to install multiple instances on the same computer, or if you need to implement network security restrictions through a firewall, you need to modify the Oracle port. This article will introduce how to modify Oracle's port.

  1. Check the current Oracle port

Before modifying the port of Oracle, we need to check the port of the current Oracle instance. We can use sqlplus or other command line tools to connect to the Oracle instance. Enter the following command to view the current port:

SELECT dbms_xdb.gethttpport() from dual;

Execute this command, and the system will return the port number of the current Oracle instance.

  1. Modify the Oracle port

To modify the Oracle port, we need to edit the Oracle configuration file (listener.ora or tnsnames.ora), find the port of the current instance, and Modify it to the new port. Here we take modifying the listener.ora file as an example:

Find the NETWORK\ADMIN folder in the Oracle installation directory, find the listener.ora file and open it.

Find the following code:

(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))

This is the port configuration of the current Oracle instance.

Change the port number to a new port number. For example, we change the port number to 1818:

(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1818))

Save and close the listener.ora file.

  1. Restart the Oracle service

After modifying the Oracle port, we need to restart the Oracle service. You can restart the Oracle service through the service manager or use the following command on the command line:

net stop OracleServiceORCL 
net start OracleServiceORCL

Among them, ORCL represents the name of your Oracle instance, modify it as needed.

  1. Verify whether the new port is effective

After restarting the Oracle service, we need to verify whether the new port is effective. You can verify it by following the following steps:

Use sqlplus or other command line tools to connect to the Oracle instance, enter the following command:

SELECT dbms_xdb.gethttpport() from dual;

Execute this command, the system should return the new Oracle instance port number.

Use the new port number, username and password to conduct a connection test. If the connection can be normal, the new port has taken effect.

Summary

Oracle is a popular relational database management system that uses the default port 1521 to establish a connection with the client. If you need to install multiple instances on the same computer, or if you need to implement network security restrictions through a firewall, you need to modify the Oracle port. This article describes how to modify Oracle's port and check whether the modification is successful by verifying whether the new port takes effect.

The above is the detailed content of How to modify port in oracle. 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
Previous article:How to back up oracleNext article:How to back up oracle