Install and configure OracleDatabaseControl using emca on the command line interface

Source: Internet
Author: User
Tags oracle database installation

Install and configure OracleDatabaseControl using emca on the command line interface

As a loyal user of the command line, the O & M of the server software tends to be completed using commands or scripts, so it is annoying to use a large amount of GUI resources. As an important server software, Oracle database installation and O & M naturally fully supports the command line method, although it also provides the oui gui installer. For the Silent Installation of Oracle11g in command lines, I have previously written a detailed blog post. For more information, see http://blog.csdn.net/smstong/article/details/7352036. The database installed in this blog post is fully available. This article is a supplement to the previous blog post, that is, to install and configure Oracle Enterprise Manager based on the database installation, so that the Administrator is tired of SQL plus, you can use a browser to manage Oracle databases.

1 Oracle Enterprise Manager and Oracle Database Control

OEMs are collectively referred to as graphical enterprise-level management tools provided by Oracle. There are three available tools:

(1) Database Control

It is used for managementOne Database(It Can Be a rac cluster database), with real-time management and monitoring functions, running scheduling jobs, and alarm functions.

(2) Application Server Control

Used to manage one or moreApplication ServerInstance.

(3) Grid Control

Grid Control can be managedMultiple databases and application serversYou can also manage computer nodes and manage third-party products through third-party plug-ins.

Before Oracle9i and Oracle, the OEM appeared in the C/S architecture. The B/S architecture was used starting from 10 Gb, so that the administrator can directly manage it through a browser without installing the client. This article focuses on the Database Control Tool. Database Control does not need to be installed independently. It is automatically installed together when oracle is installed, but must be carefully configured before it can be used.

2 Oracle Database Control directory structure and working principle analysis any software needs to start from the static and dynamic aspects, static corresponds to the physical directory and file layout after the software is installed; it dynamically corresponds to the interaction process and memory layout between various parts during software running. 2.1 directory structure

The directory structure of Database Control in 10g and 11g is slightly different. This article describes the differences based on 11g.

After installing oracle 11g, the $ ORACLE_HOME directory contains a directory dedicated to providing services for Database Control, as shown in. In this example, the oracle oc4j iner for j2ee is abbreviated as the oracle-dedicated j2ee container, which is similar to tomcat.

2.2 working principle in essence, Database Control itself is a j2EE application, but this application has a single function, that is, managing the Oracle Database. It runs in oracle's custom j2EE container, uses its managed oracle database to store its own data, and uses a proxy process to collect system information outside the database.
The management data used by Database Control is stored in the SYSMAN mode.

After understanding the working principle, the configuration is easy to understand. Like deploying other j2EE programs, you need to do so in terms of data and program files. In essence, all these operations can be done manually. However, whether creating a large number of configuration files or creating a large number of data tables, manual operations are inefficient and error-prone. Therefore, Oracle provides specialized tools and software for Database Control deployment.

If you use OUI to install Oracle, you can configure Database Control During the installation phase. After the installation is complete, you can also configure it through DBCA. These are easy-to-use GUI tools, however, the purpose of this article is to configure in command line only, so the above method is unavailable.

To cope with the Configuration in command line mode, ORACLE provides the Configuration Assistant emca (Enterprise manager Configuration Assistant) for Database Control ).

3. Use EMCA to configure Database Control3.1.

The command used is: emca-repos create

It is used to create necessary users (modes) (sysman, dbsnmp, etc.) and schema objects (stored procedures, tables, indexes, etc.) in the Database Control ). Emca itself is a script file and ultimately calls a java program to complete the actual work. Because some functions or processes provided by the Oracle Database need to be called as sysman during object creation, you must ensure that sysman has relevant permissions. This is also a common problem in the configuration.

Note that emca first creates a sysman account as sys, and then creates a subsequent object as a sysman account. Then the two are continuous and there is no chance to modify the sysman permission for us. Therefore, we need to grant the permissions required by sysman to the public account before running emca, so that when the sysman account is created, it will automatically have the corresponding permissions.

So what permissions do we need to grant to sysman? There are many answers. My method is to first run emca. If the permission is incorrect, emca will be rough. Then, based on the error log, find the missing permission and grant it to public, then emca-repos recreate.

The following is an example of troubleshooting:

[oracle@db001 ~]$ emca -repos recreate;STARTED EMCA at Jul 10, 2014 4:18:24 PMEM Configuration Assistant, Version 11.2.0.0.2 ProductionCopyright (c) 2003, 2005, Oracle.  All rights reserved.Enter the following information:Database SID: xgdbListener port number: 1521Password for SYS user:Password for SYSMAN user:Password for SYSMAN user:Do you wish to continue? [yes(Y)/no(N)]: yJul 10, 2014 4:18:37 PM oracle.sysman.emcp.EMConfig performINFO: This operation is being logged at /oracle/cfgtoollogs/emca/xgdb/emca_2014_07_10_16_18_24.log.Jul 10, 2014 4:18:37 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Dropping the EM repository (this may take a while) ...Jul 10, 2014 4:19:44 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Repository successfully droppedJul 10, 2014 4:19:44 PM oracle.sysman.emcp.EMReposConfig createRepositoryINFO: Creating the EM repository (this may take a while) ...Jul 10, 2014 4:21:53 PM oracle.sysman.emcp.EMReposConfig invokeSEVERE: Error creating the repositoryJul 10, 2014 4:21:53 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Refer to the log file at /oracle/cfgtoollogs/emca/xgdb/emca_repos_create_<date>.log for more details.Jul 10, 2014 4:21:53 PM oracle.sysman.emcp.EMConfig performSEVERE: Error creating the repositoryRefer to the log file at /oracle/cfgtoollogs/emca/xgdb/emca_2014_07_10_16_18_24.log for more details.Could not complete the configuration. Refer to the log file at /oracle/cfgtoollogs/emca/xgdb/emca_2014_07_10_16_18_24.log for more details.
313 Jul 10, 2014 4:19:44 PM oracle.sysman.emcp.EMReposConfig createRepository314 CONFIG: Spooling to /oracle/cfgtoollogs/emca/xgdb/emca_repos_create_2014_07_10_16_19_44.log315 Jul 10, 2014 4:19:44 PM oracle.sysman.emcp.EMReposConfig createRepository316 INFO: Creating the EM repository (this may take a while) ...317 Jul 10, 2014 4:21:53 PM oracle.sysman.emcp.EMReposConfig createRepository318 CONFIG: ORA-04063: package body "SYSMAN.MGMT_LOGIN_ASSISTANT" has errors319 ORA-06508: PL/SQL: could not find program unit being called:
Here we can see that the approximate error is that the SYSMAN. MGMT_LOGIN_ASSISTANT package has a compilation problem. To get the detailed error, continue to view the log file prompted.
PL/SQL procedure successfully completed.Commit complete.BEGIN*ERROR at line 1:ORA-04063: package body "SYSMAN.MGMT_LOGIN_ASSISTANT" has errorsORA-06508: PL/SQL: could not find program unit being called:"SYSMAN.MGMT_LOGIN_ASSISTANT"

Execute SQL> alter package mgmt_login_assistant compile body;

An error is reported. continue to view the cause of the error:

SQL> show errors;

The ENCRYPT invalid function is displayed.

This indicates that the package magmt_login_assistant depends on the ENCRYPT function, and the ENCRYPT function itself has problems. Let's continue to see what the ENCRYPT function has.

SQL> alter function encrypt compile;Warning: Function altered with compilation errors.SQL> show errors;Errors for FUNCTION ENCRYPT:9/5      PL/SQL: Statement ignored10/22    PLS-00201: identifier 'SYS.UTL_I18N' must be declared 

After finding the root cause of the error, it is much easier to solve the problem. log on to the sys account and grant the public role the permission to execute the SYS. UTL_I18N package.

SQL>  grant execute on UTL_I18N to public;Grant succeeded. 

SYSMAN. MGMT_LOGIN_ASSISTANT package <SYSMAN. ENCRYPT function <SYS. UTL_I18N package.

Then exit the SQL statement and re-Execute emca-repos recreate. If an error is still reported, follow the above troubleshooting methods until the problem is resolved successfully.

[oracle@db001 ~]$ emca -repos recreate;STARTED EMCA at Jul 10, 2014 4:37:11 PMEM Configuration Assistant, Version 11.2.0.0.2 ProductionCopyright (c) 2003, 2005, Oracle.  All rights reserved.Enter the following information:Database SID: xgdbListener port number: 1521Password for SYS user:Password for SYSMAN user:Do you wish to continue? [yes(Y)/no(N)]: yJul 10, 2014 4:37:24 PM oracle.sysman.emcp.EMConfig performINFO: This operation is being logged at /oracle/cfgtoollogs/emca/xgdb/emca_2014_07_10_16_37_11.log.Jul 10, 2014 4:37:25 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Dropping the EM repository (this may take a while) ...Jul 10, 2014 4:38:28 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Repository successfully droppedJul 10, 2014 4:38:29 PM oracle.sysman.emcp.EMReposConfig createRepositoryINFO: Creating the EM repository (this may take a while) ...Jul 10, 2014 4:42:47 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Repository successfully createdEnterprise Manager configuration completed successfullyFINISHED EMCA at Jul 10, 2014 4:42:47 PM
3.2 use the emca-config dbcontrol db command to create the necessary configuration file for the configuration file layout. This operation generally does not cause errors. You can enter the correct password for each account.
[Oracle @ db001 ~] $ Emca-config dbcontrol db started emca at Jul 10,201 4 4:47:43 pm em Configuration Assistant, Version 11.2.0.0.2 Production Copyright (c) 2003,200 5, Oracle. all rights reserved. enter the following information: Database SID: xgdb Listener port number: 1521 Listener ORACLE_HOME [/oracle/11.2.0]: Password for SYS user: Password for DBSNMP user: Password for SYSMAN user: email address for specified IC Ations (optional): Outgoing Mail (SMTP) server for communications (optional ): ----------------------------------------------------------------- You have specified the following settings Database ORACLE_HOME ................ /oracle/11.2.0 Local hostname ................ localhost Listener ORACLE_HOME ................ /oracle/11.2.0 Listener port number ................ 1521 Database SID ........... ..... Xgdb Email address for communications ............... outgoing Mail (SMTP) server for communications ............... ------------------------------------------------------------------- Do you wish to continue? [Yes (Y)/no (N)]: y Jul 10,201 4 4:48:05 oracle. sysman. emcp. EMConfig perform INFO: This operation is being logged at/oracle/export toollogs/emca/xgdb/emca_2014_07_10_16_47_43.log. jul 10,201 4 4:48:08 oracle. sysman. emcp. EMReposConfig uploadconfigoreorepository INFO: Uploading configuration data to EM repository (this may take a while )... jul 10,201 4 4:49:06 oracle. sysman. emcp. EMReposConfig invoke INFO: Uploaded configuration data successfully Jul 10,201 4 4:49:08 oracle. sysman. emcp. util. DBControlUtil configureSoftwareLib INFO: Software library configured successfully. jul 10,201 4 4:49:08 oracle. sysman. emcp. EMDBPostConfig configureSoftwareLibrary INFO: Deploying Provisioning archives... jul 10,201 4 4:49:34 oracle. sysman. emcp. EMDBPostConfig configureSoftwareLibrary INFO: Provisioning archives deployed successfully. jul 10,201 4 4:49:34 oracle. sysman. emcp. util. DBControlUtil secureDBConsole INFO: Securing Database Control (this may take a while )... jul 10,201 4 4:50:11 oracle. sysman. emcp. util. DBControlUtil secureDBConsole INFO: Database Control secured successfully. jul 10,201 4 4:50:11 oracle. sysman. emcp. util. DBControlUtil startOMS INFO: Starting Database Control (this may take a while )... jul 10,201 4 4:50:29 oracle. sysman. emcp. EMDBPostConfig configure mconfiguration INFO: Database Control started successfully Jul 10,201 4 4:50:29 oracle. sysman. emcp. EMDBPostConfig configure mconfiguration INFO: >>>>>>>>>>> The Database Control URL is https://localhost:1158/em <Jul 10,201 4 4:50:34 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/11.2.0/localhost_xgdb/sysman/config/emkey. ora. please 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 Jul 10,201 4 4:50:34
4. Access Database Control through a browser
After the preceding configuration, Database Control is automatically started. You can use the emctl status dbconsole to view the status.
[oracle@db001 ~]$ emctl status dbconsole;Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.https://localhost:1158/em/console/aboutApplicationOracle Enterprise Manager 11g is running.------------------------------------------------------------------Logs are generated in directory /oracle/11.2.0/localhost_xgdb/sysman/log[oracle@db001 ~]$

[Oracle @ db001 ~] $ Emctl stop dbconsole Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996,200 9 Oracle Corporation. all rights reserved. https: // localhost: 1158/em/console/aboutApplication Stopping Oracle Enterprise Manager 11g Database Control ...... stopped. [oracle @ db001 ~] $ Emctl start dbconsole Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996,200 9 Oracle Corporation. all rights reserved. https: // localhost: 1158/em/console/aboutApplication Starting Oracle Enterprise Manager 11g Database Control ........ started. ------------------------------------------------------------------ Logs are generated in directory/oracle/11.2.0/localhost_xgdb/sysman/log

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.