Use emca to install and configure Oracle Database Control on the command line interface.

Source: Internet
Author: User
Tags oracle database installation

Use emca to install and configure Oracle Database Control 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.
From a program perspective, Database Control is actually not associated with the oracle Database managed by it (called the target Database). You can use a separate Database (such as a separate oracle Database or mysql Database) can also run in a single machine's j2EE-compliant container (such as Tomcat ). However, Oracle has customized specialized containers for the efficiency and configuration, and uses the target database to store management data, and runs on the machine where the target database instance is located.
Shows how Database Control works.


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.

The above is an example of an error. We can see from the Red Section that the data creation failed. view the log file based on the provided information:

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"

This determines that this package is indeed a problem. Why did the package fail to be compiled? At this point, the sysman account has been created. We use the sysman account to log on to sqlplus, and then manually compile the package to see where the error is.

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

The visible error is that the ENCRYPT function depends on the SYS. UTL_I18N package, and this package is not declared. In fact, the sysman user has no execution permission.

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.

Then, log on again with sysman, compile the ENCRYPT function successfully, and continue to compile MGMT_LOGIN_ASSISTANT. This indicates that the problem is found. Summarize the above dependencies:

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 dbSTARTED EMCA at Jul 10, 2014 4:47:43 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: 1521Listener ORACLE_HOME [ /oracle/11.2.0 ]: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 settingsDatabase ORACLE_HOME ................ /oracle/11.2.0Local hostname ................ localhostListener ORACLE_HOME ................ /oracle/11.2.0Listener port number ................ 1521Database SID ................ xgdbEmail address for notifications ...............Outgoing Mail (SMTP) server for notifications ...............-----------------------------------------------------------------Do you wish to continue? [yes(Y)/no(N)]: yJul 10, 2014 4:48:05 PM oracle.sysman.emcp.EMConfig performINFO: This operation is being logged at /oracle/cfgtoollogs/emca/xgdb/emca_2014_07_10_16_47_43.log.Jul 10, 2014 4:48:08 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepositoryINFO: Uploading configuration data to EM repository (this may take a while) ...Jul 10, 2014 4:49:06 PM oracle.sysman.emcp.EMReposConfig invokeINFO: Uploaded configuration data successfullyJul 10, 2014 4:49:08 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLibINFO: Software library configured successfully.Jul 10, 2014 4:49:08 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibraryINFO: Deploying Provisioning archives ...Jul 10, 2014 4:49:34 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibraryINFO: Provisioning archives deployed successfully.Jul 10, 2014 4:49:34 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsoleINFO: Securing Database Control (this may take a while) ...Jul 10, 2014 4:50:11 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsoleINFO: Database Control secured successfully.Jul 10, 2014 4:50:11 PM oracle.sysman.emcp.util.DBControlUtil startOMSINFO: Starting Database Control (this may take a while) ...Jul 10, 2014 4:50:29 PM oracle.sysman.emcp.EMDBPostConfig performConfigurationINFO: Database Control started successfullyJul 10, 2014 4:50:29 PM oracle.sysman.emcp.EMDBPostConfig performConfigurationINFO: >>>>>>>>>>> The Database Control URL is https://localhost:1158/em <<<<<<<<<<<Jul 10, 2014 4:50:34 PM oracle.sysman.emcp.EMDBPostConfig invokeWARNING:************************  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 successfullyFINISHED EMCA at Jul 10, 2014 4:50:34 PM

4. After accessing the Database Control configured in the browser, the 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 ~]$

You can use emctl stop dbconsole to stop Database Control. You can use emctl start dbconsole to start Database Control.
[oracle@db001 ~]$ emctl stop dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.https://localhost:1158/em/console/aboutApplicationStopping Oracle Enterprise Manager 11g Database Control ... ...  Stopped.[oracle@db001 ~]$ emctl start dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.https://localhost:1158/em/console/aboutApplicationStarting Oracle Enterprise Manager 11g Database Control ........ started.------------------------------------------------------------------Logs are generated in directory /oracle/11.2.0/localhost_xgdb/sysman/log

Make sure that you can access: https: // IP: 1158/em in the browser after Database Conrol is started.



Oracle emca operations

You can directly execute emca without any parameters. The command description is displayed.
Here are some common commands:
1. Configure dbconsole
Create an EM Database: emca-repos create
Re-create an EM Database: emca-repos recreate
Delete An EM Database: emca-repos drop
2. Configure Database Control for the Database: emca-config dbcontrol db
3. Delete the Database Control Configuration of the Database: emca-deconfig dbcontrol db
4. reconfigure the db control port (the default port is 1158)
Emctl start dbconsole
Emca-reconfig ports-dbcontrol_http_port 1160
Emca-reconfig ports-agent_port 3940

Emca-repos create
Emca-config dbcontrol db

Emctl start dbconsole
5. reconfigure dbconsole
Emca-repos drop
Emca-repos create
Emca-config dbcontrol db
6. Other emctl commands
Set the ORACLE_SID environment variable and then start the EM console service emctl start dbconsole
Set the ORACLE_SID environment variable, and then stop the EM console service emctl stop dbconsole.
After setting the ORACLE_SID environment variable, check the emctl status dbconsole service status.
 
After installing oracle11g, how does one solve the problem of no database control? During the installation process, I also made the configuration EM unaware of you.

In the database startup status, run the command line
<ORACLE_HOME>/bin/emca-config dbcontrol db-repos recreate
 

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.