Centos7下Oracle11g数据库 遇到em无法开启

问题BUG:

   在Centos7下安装Oracle11g数据库时候,会遇到em的bug,导致数据库安装完成后,em无法启动。
Centos7下Oracle11g数据库 遇到em无法开启_第1张图片
image.png

1、根据官方解释,在Centos7下安装Oracle11g的时候,em开启会遇到bug,必须打补丁后才能正常开启em服务。

在oracle官网下载补丁包文件:p19692824_112040_Linux-x86-64.zip

1.1、上传补丁包,并解压:
[oracle@oracle-test ~]$ll
total 44
drwxr-xr-x 5 oracle dba         81 Dec  1  2014 19692824
drwxr-xr-x 7 oracle oinstall   136 Aug 27  2013 database
-rw-r--r-- 1 oracle dba      44600 Jan 11 15:54 p19692824_112040_Linux-x86-64.zip
[oracle@oracle-test ~]$unzip p19692824_112040_Linux-x86-64.zip
1.2、进入解压的p开头的补丁目录中,并用opatch命令执行补丁升级操作:
[oracle@oracle-test ~]$cd 19692824/
[oracle@oracle-test ~/19692824]$
[oracle@oracle-test ~/19692824]$ /oracle/product/11.2.0/db_1/OPatch/opatch   apply
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation.  All rights reserved.


Oracle Home       : /oracle/product/11.2.0/db_1
Central Inventory : /oracle/oraInventory
  from           : /oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.4
OUI version       : 11.2.0.4.0
Log file location : /oracle/product/11.2.0/db_1/cfgtoollogs/opatch/19692824_Jan_12_2021_10_29_43/apply2021-01-12_10-29-43AM_1.log

Applying interim patch '19692824' to OH '/oracle/product/11.2.0/db_1'
Verifying environment and performing prerequisite checks...

The following patch(es) are already installed in the Oracle Home.
[19692824]
Please roll back the existing identical patch(es) first.

OPatch system modification phase did not start:
Log file location: /oracle/product/11.2.0/db_1/cfgtoollogs/opatch/19692824_Jan_12_2021_10_29_43/apply2021-01-12_10-29-43AM_1.log

OPatch stopped on request.

2、删除之前安装过程中的无效em:

2.1 删除数据库中无效的em数据:
[oracle@oracle-test ~]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 11 16:15:55 2021

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 4092055552 bytes
Fixed Size                  2259640 bytes
Variable Size            1291846984 bytes
Database Buffers         2785017856 bytes
Redo Buffers               12931072 bytes
Database mounted.
Database opened.
SQL> DROP public synonym SETEMVIEWUSERCONTEXT;

Synonym dropped.

SQL> DROP PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;

Synonym dropped.

SQL> drop role MGMT_USER;

Role dropped.

SQL> DROP USER MGMT_VIEW CASCADE;

User dropped.

SQL> DROP USER SYSMAN CASCADE;

User dropped.

SQL>exit
2.2 删除em(末尾显示successfully dropped代表删除成功,里面的WARNING不用管):
[oracle@oracle-test ~]$emca -deconfig dbcontrol db -repos drop

STARTED EMCA at Jan 11, 2021 4:23:34 PM
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:
Password for SYSMAN user:
----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Jan 11, 2021 4:23:56 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/cfgtoollogs/emca/orcl/emca_2021_01_11_16_23_33.log.
Jan 11, 2021 4:23:57 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly
WARNING: ORA-01017: invalid username/password; logon denied

Jan 11, 2021 4:23:57 PM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
WARNING: Error initializing SQL connection. SQL operations cannot be performed
Jan 11, 2021 4:23:57 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed. Some of the possible reasons may be:
 1) EM is configured with different hostname then physical host. Set environment variable ORACLE_HOSTNAME= and re-run EMCA script
 2) ORACLE_HOSTNAME is set. Unset it and re-run EMCA script
Jan 11, 2021 4:23:57 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Jan 11, 2021 4:24:06 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Jan 11, 2021 4:24:07 PM

备注:上面出现WARNING: ORA-01017: invalid username/password; logon denied错误,这是因为目前没有em库导致,先不用去管,新建em即可。

2.3 重新创建em:
[oracle@oracle-test ~]$emca -config dbcontrol db -repos create

STARTED EMCA at Jan 11, 2021 4:24:56 PM
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
Listener ORACLE_HOME [ /oracle/product/11.2.0/db_1 ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /oracle/product/11.2.0/db_1

Local hostname ................ oracle-test
Listener ORACLE_HOME ................ /oracle/product/11.2.0/db_1
Listener port number ................ 1521
Database SID ................ orcl
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Jan 11, 2021 4:25:32 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /oracle/cfgtoollogs/emca/orcl/emca_2021_01_11_16_24_56.log.
Jan 11, 2021 4:25:34 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Jan 11, 2021 4:31:00 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Jan 11, 2021 4:31:05 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Jan 11, 2021 4:32:13 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Jan 11, 2021 4:32:19 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Jan 11, 2021 4:32:30 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Jan 11, 2021 4:32:30 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Jan 11, 2021 4:32:57 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Jan 11, 2021 4:32:57 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://oracle-test:1158/em <<<<<<<<<<<
Jan 11, 2021 4:33:00 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************  WARNING  ************************

Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /oracle/product/11.2.0/db_1/oracle-test_orcl/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost.

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Jan 11, 2021 4:33:00 PM

注意:在新建em的时候不能报错,报错会导致em无法启动。
2.4 em新建完成后,开启em服务:
[oracle@oracle-test ~]$emctl start dbconsole
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "AMERICAN_AMERICA.ZHS16GBK"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://oracle-test:1158/em/console/aboutApplication
 - An instance of Oracle Enterprise Manager 11g Database Control is already running.

[oracle@oracle-test ~]$emctl status dbconsole
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "AMERICAN_AMERICA.ZHS16GBK"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://oracle-test:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /oracle/product/11.2.0/db_1/oracle-test_orcl/sysman/log

备注:里面的语言报警先不用管,只要em显示启动就可以进行访问。
2.5 访问em服务:

URL:https://192.168.99.238:1158/em/

Centos7下Oracle11g数据库 遇到em无法开启_第2张图片
image.png

你可能感兴趣的:(Centos7下Oracle11g数据库 遇到em无法开启)