1. 程式人生 > >oracle修改監聽埠號(1521)

oracle修改監聽埠號(1521)

修改oracle監聽埠

1,檢視當前監聽狀態

[[email protected] ~]$ 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,關閉監聽

[[email protected] ~]$ 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)

[[email protected] admin]$ cd $ORACLE_HOME/network/admin/
[[email protected] admin]$ vim listener.ora
[[email protected] 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 #-------------------------------------------- [[email protected] admin]$ vi tnsnames.ora [[email protected] 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

[[email protected] 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,開啟監聽

[[email protected] 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,更換主機並做連線測試

[[email protected] ~]$ 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>