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.
客户端验证

在这里插入图片描述

相关文章

Java Oracle 结果集是Java语言中处理数据库查询结果的一种方...
Java AES和Oracle AES是现代加密技术中最常使用的两种AES加密...
Java是一种广泛应用的编程语言,具备可靠性、安全性、跨平台...
随着移动互联网的发展,抽奖活动成为了营销活动中不可或缺的...
Java和Oracle都是在计算机领域应用非常广泛的技术,他们经常...
Java 是一门非常流行的编程语言,它可以运行于各种操作系统上...