语法:
emca -config dbcontrol db [-repos (create | recreate)] [-cluster] [-silent] [-backup] [parameters]: configure Database Control for a database
1. 清除em相关配置
--删除db配置
emca -deconfig dbcontrol db
--清除repository
emca -repos drop
2. 配置em
--创建db control
emca -config dbcontrol db -repos recreate
3.启动em
emctl start dbconsole
em控制台地址:
需要添加hosts文件 C:\Windows\System32\drivers\etc\hosts
https://hostname:1158/em/console
https://192.168.17.35:1158/em/console
===============================================================================
SQL> alter user DBSNMP identified by oracle account unlock;
User altered.
SQL> select username ,account_status from dba_users order by user_id ;
USERNAME ACCOUNT_STATUS
------------------------------ --------------------------------
SYS OPEN
SYSTEM OPEN
OUTLN EXPIRED & LOCKED
DIP EXPIRED & LOCKED
ORACLE_OCM EXPIRED & LOCKED
DBSNMP OPEN
APPQOSSYS EXPIRED & LOCKED
TEST OPEN
GGS OPEN
SCOTT OPEN
SYSMAN OPEN
MGMT_VIEW OPEN
12 rows selected.
===========================================================
[oracle@prod ~]$ emca -config dbcontrol db -repos recreate
STARTED EMCA at Sep 20, 2018 7:39:13 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: prod
Listener port number: 1521
Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0/db_1 ]:
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN 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 ................ /u01/app/oracle/product/11.2.0/db_1
Local hostname ................ prod
Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1
Listener port number ................ 1521
Database SID ................ prod
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2018 7:41:04 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/prod/emca_2018_09_20_19_39_13.log.
Sep 20, 2018 7:41:05 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Sep 20, 2018 7:41:06 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Sep 20, 2018 7:41:06 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Sep 20, 2018 7:46:14 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Sep 20, 2018 7:46:21 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Sep 20, 2018 7:47:10 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Sep 20, 2018 7:47:14 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Sep 20, 2018 7:47:18 PM oracle.sysman.emcp.util.PlatformInterface executeCommand
WARNING: Error executing /u01/app/oracle/product/11.2.0/db_1/bin/emctl config emkey -repos
Sep 20, 2018 7:47:18 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
WARNING: Configuring EM-Key failed.
Sep 20, 2018 7:47:18 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
WARNING: Error securing Database control.
Sep 20, 2018 7:47:18 PM oracle.sysman.emcp.EMDBPostConfig setWarnMsg
INFO: Error securing Database Control. Database Control has been brought-up in non-secure mode. To secure the Database Control execute the following command(s):
1) Set the environment variable ORACLE_UNQNAME to Database unique name
2) /u01/app/oracle/product/11.2.0/db_1/bin/emctl stop dbconsole
3) /u01/app/oracle/product/11.2.0/db_1/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user >
4) /u01/app/oracle/product/11.2.0/db_1/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user >
5) /u01/app/oracle/product/11.2.0/db_1/bin/emctl start dbconsole
To secure Em Key, run /u01/app/oracle/product/11.2.0/db_1/bin/emctl config emkey -remove_from_repos -sysman_pwd < Password for SYSMAN user >
Sep 20, 2018 7:47:18 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2018 7:48:59 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Sep 20, 2018 7:48:59 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is http://prod:1158/em <<<<<<<<<<<
Error securing Database Control. Database Control has been brought-up in non-secure mode. To secure the Database Control execute the following command(s):
1) Set the environment variable ORACLE_UNQNAME to Database unique name
2) /u01/app/oracle/product/11.2.0/db_1/bin/emctl stop dbconsole
3) /u01/app/oracle/product/11.2.0/db_1/bin/emctl config emkey -repos -sysman_pwd < Password for SYSMAN user >
4) /u01/app/oracle/product/11.2.0/db_1/bin/emctl secure dbconsole -sysman_pwd < Password for SYSMAN user >
5) /u01/app/oracle/product/11.2.0/db_1/bin/emctl start dbconsole
To secure Em Key, run /u01/app/oracle/product/11.2.0/db_1/bin/emctl config emkey -remove_from_repos -sysman_pwd < Password for SYSMAN user >
[oracle@prod ~]$
[oracle@prod ~]$ exit
logout
s[root@prod ~]# su - oracle
[oracle@prod ~]$ /u01/app/oracle/product/11.2.0/db_1/bin/emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
http://prod:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
all attemps to stop oc4j failed... now trying to kill 9
--- Failed to shutdown DBConsole Gracefully ---
... Stopped.
[oracle@prod ~]$ /u01/app/oracle/product/11.2.0/db_1/bin/emctl config emkey -repos -sysman_pwd oracle
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
The Em Key has been configured successfully.
[oracle@prod ~]$ /u01/app/oracle/product/11.2.0/db_1/bin/emctl secure dbconsole -sysman_pwd oracle
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
http://prod:1158/em/console/aboutApplication
DBCONSOLE already stopped... Done.
Agent is already stopped... Done.
Securing dbconsole... Started.
Please enter repository schema password:
Securing dbconsole... Sucessful.
[oracle@prod ~]$
[oracle@prod ~]$ /u01/app/oracle/product/11.2.0/db_1/bin/emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
https://prod:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control .... started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/db_1/prod_prod/sysman/log