1. 程式人生 > >修改oracle所在的linux主機名-單機

修改oracle所在的linux主機名-單機

修改Oracle所在linux主機名 原主機名為node3,需改為node4 一、linux系統方面的修改 [[email protected] /]# hostname
node3 [[email protected] /]# vim /etc/hosts 192.168.56.16 node4  -- 改為node4
[[email protected] /]# vim /etc/sysconfig/network HOSTNAME=node4  --node3 改為node4
[[email protected] /]# hostname node4 [[email protected]
/]# hostname
node4 [[email protected] /]# 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出錯。 [[email protected] ~]$ 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. 修改監聽配置檔案 [[email protected] ~]$ 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. 啟動監聽程式 [[email protected] ~]$ 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 [[email protected] ~]$  監聽程式正常啟動,修改成功。