oracle所在环境Linux更改主机名及ip

测试环境:redhat 6.5, oracle 11G

总共要修改3个地方

1)修改host

[root@NCDB /]# vi /etc/hosts
172.0.0.112 NCBD

127.0.0.1   localhost NCDB localhost4 localhost4.localdomain4
::1         localhost NCDB localhost6 localhost6.localdomain6
172.0.0.112   localhost NCDB localhost4 localhost4.localdomain4

2)修改network

[root@NCBD /]# vi /etc/sysconfig/network
HOSTNAME=B=NCDB

NETWORKING=yes
HOSTNAME=NCDB

3)修改oracle的listener.ora和tnsnames.ora文件找自己的安装路径

[oracle@NCDB~]$

vi /opt/oracle/product/12.2.0/dbhome/network/admin/listener.ora

(ADDRESS = (PROTOCOL = TCP)(HOST = NCDB)(PORT = 1521))

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

SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC =
   (GLOBAL_DBNAME = orcl)
   (SID_NAME = orcl)
   )
 )

tnsnames.ora文件修改
vi /opt/oracle/product/12.2.0/dbhome/network/admin/tnsnames.ora
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.0.112)(PORT = 1521))

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.0.112)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

重启oracle服务和监听

你可能感兴趣的:(oracle所在环境Linux更改主机名及ip)