微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Linux 下 Oracle 11g 更改默认端口号

文章目录

查看当前端口信息

进入 oracle 用户
[root@node2 ~]# su - oracle
进入 oracle 服务
[oracle@node2 ~]$ sqlplus / as sysdba

sql*Plus: Release 11.2.0.1.0 Production on Sun Nov 7 16:39:17 2021

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

Connected to an idle instance.

sql>
启动 oracle 服务
sql> startup       
ORACLE instance started.

Total System Global Area 1720328192 bytes
Fixed Size		    2214056 bytes
Variable Size		 1006634840 bytes
Database Buffers	  704643072 bytes
Redo Buffers		    6836224 bytes
Database mounted.
Database opened.
查看配置
sql> show parameter local_listen

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

修改远程端口

更改 oracle 配置
# host -- 指定 ip,port -- 指定远程端口
sql> alter system set local_listener='(address=(protocol=tcp)(host=10.10.200.49)(port=11521))';

System altered.
  • 查看结果
sql> show parameter local_listen   

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
local_listener			     string	 (address=(protocol=tcp)(host=10.10.200.49)(port=11521))
更改 listener.ora
# host + port 配置
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.200.49)(PORT = 11521))
    )
  )
更改 tnsnames.ora
# host + port 配置
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.200.49)(PORT = 11521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

重启服务

启动监听
[oracle@node2 ~]$ lsnrctl start
重启 oracle 服务
# 停止
sql> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.

# 启动
sql> startup
ORACLE instance started.

Total System Global Area 1720328192 bytes
Fixed Size		    2214056 bytes
Variable Size		 1006634840 bytes
Database Buffers	  704643072 bytes
Redo Buffers		    6836224 bytes
Database mounted.
Database opened.
sql> 

增加远程用户

表空间创建
sql> CREATE TABLESPACE test DATAFILE '/data/app/oracle/oradata/orcl/test.dbf' SIZE 50M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL;

Tablespace created.
用户创建
# 指定表空间 -- 创建用户
sql> CREATE USER lsr IDENTIFIED BY lsr DEFAULT TABLESPACE test ;

User created.
用户授权
# 管理员权限
sql> GRANT CONNECT, RESOURCE, DBA TO lsr ;

Grant succeeded.
用户密码配置
sql> ALTER USER lsr IDENTIFIED BY "123456" ;

User altered.
客户端验证

在这里插入图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐