ORACLE安装好后修改LINUX机器名

    由于LINUX上的ORACLE软件和数据已经安装好了,现在要更改机器名,即将原机器名 LINUX10 更改为 LINUX15,特地将相关的步骤记录下来。

查看服务器版本信息
  1. [oracle@LINUX15 ~]$ lsb_release -a
  2. LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
  3. Distributor ID:    OracleServer
  4. Description:    Oracle Linux Server release 6.5
  5. Release:    6.5
  6. Codename:    n/a

修改hosts文件

  1. -- 将hosts 文件中本地IP 对应的 LINUX10 更改成 LINUX15
  2. [oracle@LINUX10 ~]$ vi /etc/hosts

  3. [oracle@LINUX15 ~]$ more /etc/hosts
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.56.15 LINUX15

修改network

    1. -- 将network 文件中本地IP 对应的 LINUX10 更改成 LINUX15
  1. [root@LINUX10 ~]# vi /etc/sysconfig/network

  2. [oracle@LINUX15 ~]$ more /etc/sysconfig/network
  3. NETWORKING=yes
  4. HOSTNAME=LINUX15

查看监听配置文件及本地服务名文件

如果监听配置文件中是用的主机名,就需要将原主机名更改成新的主机名,如果是配置的IP地址,就不需要调整

  1. [oracle@LINUX15 j2ee]$ cd /u01/app/oracle/product/11.2.3/oracle/network/admin
  2. [oracle@LINUX15 admin]$ ls
  3. listener.ora samples shrept.lst
  4. [oracle@LINUX15 admin]$ more listener.ora
  5. # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.3/oracle/network/admin/listener.ora
  6. # Generated by Oracle configuration tools.

  7. SID_LIST_LISTENER =
  8.   (SID_LIST =
  9.     (SID_DESC =
  10.       (GLOBAL_DBNAME = orcl)
  11.       (ORACLE_HOME = /u01/app/oracle/product/11.2.3/oracle)
  12.       (SID_NAME = orcl)
  13.     )
  14.   )

  15. LISTENER =
  16.   (DESCRIPTION =
  17.     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.×××.×××)(PORT = 1521))
  18.   )

  19. ADR_BASE_LISTENER = /u01/app/oracle
上面监听文件中是配置的IP地址,所以不需要调整,直接启动监听即可

  1. [oracle@LINUX15 ~]$ lsnrctl start

  2. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 07-MAR-2015 22:32:48

  3. Copyright (c) 1991, 2011, Oracle. All rights reserved.

  4. Starting /u01/app/oracle/product/11.2.3/oracle/bin/tnslsnr: please wait...

  5. TNSLSNR for Linux: Version 11.2.0.3.0 - Production
  6. System parameter file is /u01/app/oracle/product/11.2.3/oracle/network/admin/listener.ora
  7. Log messages written to /u01/app/oracle/diag/tnslsnr/LINUX15/listener/alert/log.xml
  8. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.15)(PORT=1521)))

  9. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.15)(PORT=1521)))
  10. STATUS of the LISTENER
  11. ------------------------
  12. Alias LISTENER
  13. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
  14. Start Date 07-MAR-2015 22:32:49
  15. Uptime 0 days 0 hr. 0 min. 0 sec
  16. Trace Level off
  17. Security ON: Local OS Authentication
  18. SNMP OFF
  19. Listener Parameter File /u01/app/oracle/product/11.2.3/oracle/network/admin/listener.ora
  20. Listener Log File /u01/app/oracle/diag/tnslsnr/LINUX15/listener/alert/log.xml
  21. Listening Endpoints Summary...
  22.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.15)(PORT=1521)))
  23. Services Summary...
  24. Service "orcl" has 1 instance(s).
  25.   Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
  26. The command completed successfully
由于我没有配置本地服务名,所以没有 tnsnames.ora 文件,如果有该文件,也需要进行调整( 将原主机名更改成新的主机名,如果是配置的IP地址,就不需要调整

启动数据库

  1. [oracle@LINUX15 ~]$ sqlplus / as sysdba

  2. SQL*Plus: Release 11.2.0.3.0 Production on Sat Mar 7 22:32:59 2015

  3. Copyright (c) 1982, 2011, Oracle. All rights reserved.

  4. Connected to an idle instance.

  5. SQL> startup
  6. ORACLE instance started.

  7. Total System Global Area 939495424 bytes
  8. Fixed Size         2233960 bytes
  9. Variable Size         629148056 bytes
  10. Database Buffers     301989888 bytes
  11. Redo Buffers         6123520 bytes
  12. Database mounted.
  13. Database opened.

数据库可以正常启动

启动EM报错处理

  1. [oracle@LINUX15 ~]$ emctl status dbconsole
  2. OC4J Configuration issue. /u01/app/oracle/product/11.2.3/oracle/oc4j/j2ee/OC4J_DBConsole_LINUX15_orcl not found.
提示文件找不到,此时要更改两个文件夹的名称
  1. [oracle@LINUX15 ~]$ cd $ORACLE_HOME
  2. [oracle@LINUX15 oracle]$ ll
  3. total 312
  4. ......
  5. ......
  6. drwxr-xr-x. 4 oracle oinstall 12288 Feb 15 22:57 lib
  7. drwxr-----. 3 oracle oinstall 4096 Mar 7 17:04 LINUX10_orcl
  8. drwxr-xr-x. 5 oracle oinstall 4096 Mar 7 22:32 log
  9. ......
  10. ......
将文件夹 LINUX10_orcl(机器名+数据库名) 重命名为 LINUX15_orcl
  1. [oracle@LINUX15 oracle]$ mv LINUX10_orcl LINUX15_orcl
重命名文件夹  OC4J_DBConsole_LINUX10_orcl 为  OC4J_DBConsole_LINUX15_orcl
  1. [oracle@LINUX15 j2ee]$ pwd
  2. /u01/app/oracle/product/11.2.3/oracle/oc4j/j2ee
  3. [oracle@LINUX15 j2ee]$ ll
  4. total 32
  5. -rw-r--r--. 1 oracle oinstall 1000 Feb 15 22:55 deploy_db_wf.ini
  6. drwxr-xr-x. 14 oracle oinstall 4096 Feb 15 22:53 home
  7. drwxr-xr-x. 3 oracle oinstall 4096 Feb 15 22:52 oc4j_applications
  8. drwxr-x---. 6 oracle oinstall 4096 Feb 15 22:52 OC4J_DBConsole
  9. drwxr-x---. 10 oracle oinstall 4096 Feb 16 00:01 OC4J_DBConsole_LINUX10_orcl
  10. drwxr-xr-x. 5 oracle oinstall 4096 Feb 15 22:52 OC4J_Workflow_Component_Container
  11. drwxr-xr-x. 5 oracle oinstall 4096 Feb 15 22:52 OC4J_Workflow_Management_Container
  12. drwxr-xr-x. 2 oracle oinstall 4096 Feb 15 22:53 utilities
  13. [oracle@LINUX15 j2ee]$
  14. [oracle@LINUX15 j2ee]$ mv OC4J_DBConsole_LINUX10_orcl OC4J_DBConsole_LINUX15_orcl

再次启动EM还是报错处理

  1. [oracle@LINUX15 j2ee]$ emctl start dbconsole
  2. Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
  3. Copyright (c) 1996, 2011 Oracle Corporation. All rights reserved.
  4. https://LINUX10:1158/em/console/aboutApplication
  5. Starting Oracle Enterprise Manager 11g Database Control ....................................... failed.
  6. ------------------------------------------------------------------
  7. Logs are generated in directory /u01/app/oracle/product/11.2.3/oracle/LINUX15_orcl/sysman/log
查看  /u01/app/oracle/product/11 . 2 . 3/oracle/LINUX15_orcl/sysman/log 下面的跟踪日志文件
  1. [oracle@LINUX15 j2ee]$ cd /u01/app/oracle/product/11.2.3/oracle/LINUX15_orcl/sysman/log

  2. [oracle@LINUX15 log]$ tail -10 emdctl.trc
  3. 2015-03-07 23:26:43,128 Thread-3461998336 ERROR http: nmehl_connect_internal: failed to get host info. Could not resolve name
    2015-03-07 23:26:55,169 Thread-686225152 ERROR http: nmehl_connect_internal: failed to get host info. Could not resolve name
    2015-03-07 23:27:01,293 Thread-2620741376 ERROR http: nmehl_connect_internal: failed to get host info. Could not resolve name
    2015-03-07 23:27:01,398 Thread-2324297472 ERROR http: nmehl_connect_internal: failed to get host info. Could not resolve name
    2015-03-07 23:27:01,398 Thread-2324297472 ERROR main: nmectla_agentctl: Error connecting to https://LINUX10:3938/emd/main. Returning status code 1
    2015-03-07 23:27:07,423 Thread-1574823680 ERROR http: nmehl_connect_internal: failed to get host info. Could not resolve name
    2015-03-07 23:27:19,460 Thread-316806912 ERROR http: nmehl_connect_internal: failed to get host info. Could not resolve name
    2015-03-07 23:27:31,495 Thread-1615763200 ERROR http: nmehl_connect_internal: failed to get host info. Could not resolve name
    2015-03-07 23:27:31,559 Thread-3334194944 ERROR http: nmehl_connect_internal: failed to get host info. Could not resolve name
    2015-03-07 23:27:31,559 Thread-3334194944 ERROR main: nmectla_agentctl: Error connecting to https://LINUX10:3938/emd/main. Returning status code 1
看到em还是默认是以前的机器名,看来要重新配置em了

重新配置EM

重新配置EM可以参考网址 http://blog.itpub.net/30150152/viewspace-1452052/

首先,删除EM资料库
  1. [oracle@LINUX15 log]$ emca -repos drop

  2. STARTED EMCA at Mar 7, 2015 11:40:53 PM
  3. EM Configuration Assistant, Version 11.2.0.3.0 Production
  4. Copyright (c) 2003, 2011, Oracle. All rights reserved.

  5. Enter the following information:
  6. Database SID: orcl
  7. Listener port number: 1521
  8. Password for SYS user:
  9. Password for SYSMAN user:

  10. ----------------------------------------------------------------------
  11. WARNING : While repository is dropped the database will be put in quiesce mode.
  12. ----------------------------------------------------------------------
  13. Do you wish to continue? [yes(Y)/no(N)]: Y
  14. Mar 7, 2015 11:41:32 PM oracle.sysman.emcp.EMConfig perform
  15. INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_03_07_23_40_52.log.
  16. Mar 7, 2015 11:41:34 PM oracle.sysman.emcp.EMReposConfig invoke
  17. INFO: Dropping the EM repository (this may take a while) ...
  18. Mar 7, 2015 11:46:50 PM oracle.sysman.emcp.EMReposConfig invoke
  19. INFO: Repository successfully dropped
  20. Enterprise Manager configuration completed successfully
  21. FINISHED EMCA at Mar 7, 2015 11:46:50 PM
资料库删除成功。

其次,创建EM资料库
[oracle@LINUX15 log]$ emca -repos create

STARTED EMCA at Mar 8, 2015 12:24:13 AM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle. All rights reserved.

Enter the following information:
Database SID: orcl
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:

Do you wish to continue? [yes(Y)/no(N)]: Y
Mar 8, 2015 12:24:40 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_03_08_00_24_11.log.
Mar 8, 2015 12:24:41 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Mar 8, 2015 12:41:29 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Enterprise Manager configuration completed successfully FINISHED EMCA at Mar 8, 2015 12:41:29 AM
最后配置database control
  1. [oracle@LINUX15 ~]$ emca -config dbcontrol db
  2. STARTED EMCA at Mar 8, 2015 8:30:50 PM
  3. EM Configuration Assistant, Version 11.2.0.3.0 Production
  4. Copyright (c) 2003, 2011, Oracle. All rights reserved.
  5. Enter the following information:
  6. Database SID: orcl
  7. Database Control is already configured for the database orcl
  8. You have chosen to configure Database Control for managing the database orcl
  9. This will remove the existing configuration and the default settings and perform a fresh configuration
  10. Do you wish to continue? [yes(Y)/no(N)]: Y
  11. Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.3/oracle ]:
  12. Password for SYS user: le
  13. Password for DBSNMP user: l
  14. Password for SYSMAN user: a
  15. Email address for notifications (optional):
  16. Outgoing Mail (SMTP) server for notifications (optional):
  17. -----------------------------------------------------------------
  18. You have specified the following settings
  19. Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.3/oracle
  20. Local hostname ................ LINUX15
  21. Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.3/oracle
  22. Listener port number ................ 1521
  23. Database SID ................ orcl
  24. Email address for notifications ...............
  25. Outgoing Mail (SMTP) server for notifications ...............
  26. -----------------------------------------------------------------
  27. Do you wish to continue? [yes(Y)/no(N)]: y
  28. Mar 8, 2015 8:32:09 PM oracle.sysman.emcp.EMConfig perform
  29. INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_03_08_20_30_49.log.
  30. Mar 8, 2015 8:32:10 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
  31. INFO: Stopping Database Control (this may take a while) ...
  32. Mar 8, 2015 8:32:24 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
  33. INFO: Uploading configuration data to EM repository (this may take a while) ...
  34. Mar 8, 2015 8:33:51 PM oracle.sysman.emcp.EMReposConfig invoke
  35. INFO: Uploaded configuration data successfully
  36. Mar 8, 2015 8:33:56 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
  37. INFO: Securing Database Control (this may take a while) ...
  38. Mar 8, 2015 8:35:04 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
  39. INFO: Database Control secured successfully.
  40. Mar 8, 2015 8:35:04 PM oracle.sysman.emcp.util.DBControlUtil startOMS
  41. INFO: Starting Database Control (this may take a while) ...
  42. Mar 8, 2015 8:36:17 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
  43. INFO: Database Control started successfully
  44. Mar 8, 2015 8:36:17 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
  45. INFO: >>>>>>>>>>> The Database Control URL is https://LINUX15:1158/em <<<<<<<<<<<
  46. Mar 8, 2015 8:36:20 PM oracle.sysman.emcp.EMDBPostConfig invoke
  47. WARNING:
  48. ************************ WARNING ************************
  49. Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted. The encryption key has been placed in the file: /u01/app/oracle/product/11.2.3/oracle/LINUX15_orcl/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost.
  50. ***********************************************************
  51. Enterprise Manager configuration completed successfully
  52. FINISHED EMCA at Mar 8, 2015 8:36:20 PM
看EM是否启动
  1. [oracle@LINUX15 ~]$ emctl status dbconsole
  2. Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0
  3. Copyright (c) 1996, 2011 Oracle Corporation. All rights reserved.
  4. https://LINUX15:1158/em/console/aboutApplication
  5. Oracle Enterprise Manager 11g is running.
  6. ------------------------------------------------------------------
  7. Logs are generated in directory /u01/app/oracle/product/11.2.3/oracle/LINUX15_orcl/sysman/log
现在EM也已经配置好了,可以通过页面访问了。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30150152/viewspace-1452077/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30150152/viewspace-1452077/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值