oracle修改监听端口号(1521)

修改oracle监听端口

1,查看当前监听状态

[oracle@DSJ-RTB-4T-349 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 05-JUL-2018 14:26:26
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.162.4.68)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                11-JUN-2018 17:39:44
Uptime                    23 days 20 hr. 46 min. 42 sec
Trace Level               off
Security                  ON: Password or Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /data/app/oracle/diag/tnslsnr/DSJ-RTB-4T-349/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.162.4.68)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "dwca" has 1 instance(s).
  Instance "dwca", status READY, has 1 handler(s) for this service...
Service "dwcaXDB" has 1 instance(s).
  Instance "dwca", status READY, has 1 handler(s) for this service...
The command completed successfully

2,关闭监听

[oracle@DSJ-RTB-4T-349 ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 05-JUL-2018 14:29:30

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.162.4.68)(PORT=1521)))
The command completed successfully

3,修改监听端口号(端口修改为8521)

[oracle@DSJ-RTB-4T-349 admin]$ cd $ORACLE_HOME/network/admin/
[oracle@DSJ-RTB-4T-349 admin]$ vim listener.ora
[oracle@DSJ-RTB-4T-349 admin]$ cat listener.ora
# listener.ora Network Configuration File: /data/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /data/app/oracle/product/11.2.0/dbhome_1)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.162.4.68)(PORT = 8521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

#----ADDED BY TNSLSNR 11-APR-2018 16:08:51---
PASSWORDS_LISTENER = 313DBE5E70EB94B5
#--------------------------------------------
[oracle@DSJ-RTB-4T-349 admin]$ vi tnsnames.ora
[oracle@DSJ-RTB-4T-349 admin]$ cat tnsnames.ora
DWCA =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.162.4.68)(PORT = 8521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dwca)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )
LISTENER_DWCA =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

 

4,修改初始化参数local_listener

[oracle@DSJ-RTB-4T-349 admin]$ sqlplus / as sysdba;

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 5 14:38:41 2018

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show parameter local_listener;

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
local_listener			     string	 LISTENER_DWCA

SQL>   alter system set local_listener="(address=(protocol=tcp)(host=10.162.4.68)(port=8521))";

System altered.

5,开启监听

[oracle@DSJ-RTB-4T-349 admin]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 05-JUL-2018 14:41:06

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /data/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /data/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /data/app/oracle/diag/tnslsnr/DSJ-RTB-4T-349/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.162.4.68)(PORT=8521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.162.4.68)(PORT=8521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                05-JUL-2018 14:41:06
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Password or Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /data/app/oracle/diag/tnslsnr/DSJ-RTB-4T-349/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.162.4.68)(PORT=8521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

5,更换主机并做连接测试

[oracle@iptrace0903-RP-0468 ~]$ sqlplus scott/[email protected]:8521/dwca

SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 5 14:53:25 2018

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

你可能感兴趣的:(oracle维护)