您的位置:首页 > 数据库 > Oracle

修改oracle数据库监听端口号

2016-05-10 16:23 597 查看
oracle默认端口号是1521.很容易就被黑客扫描到然后天天惦记你的数据库

所以修改默认端口号就很有必要了

1、首先查看监听状态

lsnrctl status

2、关闭监听

lsnrctl stop

3、修改监听文件1521====>10001

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (ORACLE_HOME = /u01/11g)

      (SID_NAME = pu)

    )

  )

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = target)(PORT = 10001))

    )

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

  )

ADR_BASE_LISTENER = /u01/oracle

4、登陆数据库修改local_listenner

SQL> show parameter local_listener

NAME                                 TYPE

------------------------------------ ----------------------

VALUE

------------------------------

local_listener                       string

VALUES值为空

修改local_listener参数

SQL> show parameter local_liste

NAME                                 TYPE

------------------------------------ ----------------------

VALUE

------------------------------

local_listener                       string

SQL> alter system set local_listener="(address = (protocol = tcp)(host = target)

  2  (port = 10001))";

System altered.

SQL> show parameter local_lis

NAME                                 TYPE

------------------------------------ ----------------------

VALUE

------------------------------

local_listener                       string

(address = (protocol = tcp)(ho

st = target)

(port = 10001))

5、启动监听

[oracle@target ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 10-MAY-2016 16:48:35

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

Starting /u01/11g/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production

System parameter file is /u01/11g/network/admin/listener.ora

Log messages written to /u01/oracle/diag/tnslsnr/target/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=target)(PORT=10001)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=target)(PORT=10001)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production

Start Date                10-MAY-2016 16:48:36

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/11g/network/admin/listener.ora

Listener Log File         /u01/oracle/diag/tnslsnr/target/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=target)(PORT=10001)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary...

Service "pu" has 1 instance(s).

  Instance "pu", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

6、查看系统状态

[oracle@target ~]$ netstat -ano|grep 10001

tcp        0      0 192.168.6.152:26082         192.168.6.152:10001         ESTABLISHED off (0.00/0/0)

tcp        0      0 :::10001                    :::*                        LISTEN      off (0.00/0/0)

tcp        0      0 ::ffff:192.168.6.152:10001  ::ffff:192.168.6.152:26082  ESTABLISHED keepalive (7193.37/0/0)

已经开启10001端口号

7、验证登陆

[oracle@target ~]$ sqlplus / as sysdba@target:10001:pu

SQL*Plus: Release 11.2.0.3.0 Production on Tue May 10 16:50:50 2016

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Oracle Label Security, OLAP, Data Mining,

Oracle Database Vault and Real Application Testing options

SQL>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: