How to change the Oracle10g Port

Source: Internet
Author: User
Tags time 0

Generally, the default port 1521 after Oracle is installed is used for security purposes. How to change.
1. view the listening port:
C: \ Documents ents and Settings \ mengzhaoliang> lsnrctl status
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0-Production on-2008
8: 20
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = orcl )))
LISTENER STATUS
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0-Produ
Ction
Start Date: 15-12 months-2008 17:35:26
Normal operation time 2 days 0 hours 52 minutes 58 seconds
Tracking level off
Security ON: Local OS Authentication
SNMP OFF
Listener parameter file D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ admin \ listener. o
Ra
Listener log file D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ log \ listener. log
Listener endpoint overview...
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (PIPENAME = \. \ pipe \ orclipc )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 127.0.0.1) (PORT = 1521 )))
Service summary ..
The Service "orcl" contains two routines.
Routine "orcl", status UNKNOWN, contains 1 handler of this service...
Routine "orcl", status READY, contains 1 handler of this service...
The Service "orclXDB" contains one routine.
Routine "orcl", status READY, contains 1 handler of this service...
The Service "orcl_XPT" contains one routine.
Routine "orcl", status READY, contains 1 handler of this service...
Command executed successfully
 
2. Change the port number.
In the D: \ oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN \ listener. ora file
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = orcl ))
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
)
)

Changed:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = orcl ))
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1568 ))
)
)
 
3. Stop listening command:
C: \ Documents ents and Settings \ mengzhaoliang> lsnrctl stop
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0-Production on-2008 18:30:31
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = orcl )))
Command executed successfully

4. Restart the listening command:
C: \ Documents ents and Settings \ mengzhaoliang> lsnrctl start
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0-Production on-2008 18:30:44
Copyright (c) 1991,200 5, Oracle. All rights reserved.
Start tnslsnr: Please wait...
TNSLSNR for 32-bit Windows: Version 10.2.0.1.0-Production
The system parameter file is D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ admin \ listener. ora.
Write the log information of D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ log \ listener. log
Listener: (DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (PIPENAME = \. \ pipe \ orclipc )))
Listener: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 127.0.0.1) (PORT = 1568 )))
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = orcl )))
LISTENER STATUS
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0-Produ
Ction
Start date: 17-12 months-2008 18:30:45
Normal operation time 0 days 0 hours 0 minutes 1 second
Tracking level off
Security ON: Local OS Authentication
SNMP OFF
Listener parameter file D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ admin \ listener. ora
Listener log file D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ log \ listener. log
Listener endpoint overview...
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (PIPENAME = \. \ pipe \ orclipc )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 127.0.0.1) (PORT = 1568 )))
Service summary ..
The Service "orcl" contains one routine.
Routine "orcl", status UNKNOWN, contains 1 handler of this service...
Command executed successfully
In this way, the listening port number can be changed successfully.
 
5. test whether the database is successfully accessed
Super Users can connect to the Database SQL> sqlplus "/as sysdba"
But it cannot be used by common users, such as SQL> sqlplus test/test @ ORCL.
User connection is not a database: the following error occurs:
ERROR:
ORA-12514: TNS: The Listener currently cannot identify the Service requested in the connection Descriptor
 
Original listener. ora content:
# Listener. ora Network Configuration File: D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ admin \ listener. ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E: \ oracle \ product \ 10.2.0 \ db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
)
)
Change to (add or modify the red part ):
# Listener. ora Network Configuration File: D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ admin \ listener. ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D: \ oracle \ product \ 10.2.0 \ db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D: \ oracle \ product \ 10.2.0 \ db_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1568 ))
)
)

The content of tnsnames. ora is:
# Tnsnames. ora Network Configuration File: D: \ oracle \ product \ 10.2.0 \ db_1 \ network \ admin \ tnsnames. ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1568 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1 ))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
 

Finally, restart Oracle's listener server (OracleOraDb10g_home1TNSListener) in "Control Panel"> "Administrative Tools"> "services" in windows.
 
6. log on to the database with a common user:
SQL> sqlplus test/test @ ORCL
The database is successfully entered.
 
 
 
Appendix:
If you are using a local Oracle database to connect to a remote Oracle database, go to $ ORACLE_HOME \ NETWORK \ ADMIN \ tnsnames. ora (for example, D: \ oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN \ tnsnames. add remote database information. In this way, we can use PLSQL and other third-party software to connect.
Add information, for example:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.169.1.118) (PORT = 1568 ))
(CONNECT_DATA =
(SID = ORCL)
(SERVER = DEDICATED)
)
)
 
Note: in linux, the only difference is that the storage path of lisenter. ora is different from that of windows.

Author "cas1991321"
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.