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

修改oracle所在的linux主机名-单机

2015-12-08 23:46 519 查看
修改Oracle所在linux主机名

原主机名为node3,需改为node4

一、linux系统方面的修改

[root@node3 /]# hostname

node3

[root@node3 /]# vim /etc/hosts
192.168.56.16 node4 -- 改为node4

[root@node3 /]# vim /etc/sysconfig/network
HOSTNAME=node4 --node3 改为node4

[root@node3 /]# hostname node4
[root@node3 /]# hostname
node4

[root@node3 /]# service network restart

Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]

二、Oracle配置方面的修改

1. 执行lsnrctl status出错。

[oracle@node4 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-DEC-2015 23:38:19
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node3)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist --因目标主机或对象不存在,
连接失败
TNS-12560: TNS:protocol adapter error --协议适配器错误
TNS-00515: Connect failed because target host or object does not exist --因目标主机或对象不存在, 连接失败
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 08-DEC-2015 23:34:33
Uptime 0 days 0 hr. 3 min. 47 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/node3/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=node3)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

这是因为listener.ora文件中主机名与现在本机的主机名不符。重新配置listener.ora文件

2. 修改监听配置文件

[oracle@node4 ~]$ vim $ORACLE_HOME/network/admin/listener.ora

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node3)(PORT
= 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

将"HOST = node3"改为"HOST = node4"

3. 启动监听程序

[oracle@node4 ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-DEC-2015 23:40:42

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

Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/node4/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=node4)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 08-DEC-2015 23:40:42
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/node4/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=node4)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@node4 ~]$

监听程序正常启动,修改成功。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: