Using Oracle Enterprise Manager Command Line Interface Part 1 – Installing and Basic Configuration

Oracle Enterprise Manager 12c brings a wealth of configuration, monitoring and maintenance tools to DBAs. The primary emphasis of OEM 12c is the web-based graphical interface. However OEM also has a command line interface, which can be used to perform many of the activities that the graphical interface does. The command line interface (Enterprise Manager Command Line Interface – EM CLI) can also be used to configure several options that allow for monitoring and auditing the actions performed by users in the graphical interface.

The EM CLI is integrated with EM’s user security functionality, which means that we can perform activities using EM CLI with the same security features and restrictions that have been defined in the graphic console.

Components of the EM CLI

The EM CLI actually has two separate components, the client interface (EM CLI Client) and the EM CLI Oracle Management Service (OMS) Extension.

The EM CLI Client can be installed on any system, the EM CLI OMS is installed as part of the OMS and it is the interface between the EM CLI Client and the OMS itself.

Installing the EM CLI Client

Before the EM CLI client can be fully used it must be installed and configured. The steps to install the EM CLI Client are

1) Download the EM CLI Client kit from your EM 12c installation (emclikit.jar).

http(s)://your_oms_home:port/em/console/emcli/download

2) Make sure you have Java JDK 1.6.0_24 or higher installed and ensure that your JAVA_HOME and PATH environment variables are properly set to the Java JDK installation.

3) Install the EM CLI Client using the following:

cd <directory where you downloaded emclikit.jar>
java -jar emclikit,jar client -install_dir=<emcli_client_dir>

Once it is installed, you can run the EM CLI from the install directory (or add it to your PATH variable if you prefer). After installation, only these basic commands are initially configured and available for use:

  • argfile (to execute commands from a file)
  • help
  • login/logout
  • setup (to configure communication with the OMS)
  • status
  • sync (to synchronize with the OMS)
  • version

Configuring the EM CLI Client

In order to install the remaining commands for full functionality and to actually be able to communicate with the OMS, the setup command must be run. The setup command configures the EM CLI Client to interface with the EM CLI OMS extension, which in turn communicates with its OMS. (to see the full help options ./emcli help setup).

The setup command syntax is:

./emcli setup -url=http://your_oms_home:port/em -username=em_admin_user

Once you see the “Emcli Setup Successful” message – it’s fully installed, configured and ready to go.

EM CLI Client setup is in secure mode by default (-noautologin is the default option for the setup command). This means that each time it is used you will have to issue a login command and specify a username/password combination to be able to run commands to your OMS. The non-secure option for setup is -autologin. This mode will also automatically re-login after a session timeout. Session timeout defaults to 45 minutes. Autologin should only be configured on secured client systems.

The full list of options for the setup command is as follows:

-url

the url for the OMS location (http://yourhost:port/em)

-username

the EM admin user

-password

password for the user account – if you do not enter this as part of the setup command you will be prompted, which is more secure

-dir

directory for the EM CLI configuration – must be a locally mounted file system – defaults to the users home directory

-localdirans

yes/no option, which indicates if the -dir option is a local directory

-trustall

automatically accept server certificates from the OMS (lower security)

-licans

yes/no as to whether the current user accepts the license agreement

-certans

yes/no option, which indicates if the certificate can be trusted without prompting the user

-nocertvalidate

does not validate the hostname in the SSL certificate provided by the OMS

-novalidate

does not authenticate the username against EM or SSO and assumes the username is valid – you might need to do this if you are trying to set up the EM CLI client and Enterprise Manager itself is not running

-autologin

login credentials are stored on the EM CLI local client system (in the configuration files in the location specified by the -dir parameter above)

if the password for the user changes in EM – the login command would have to be run to change the password in the configuration file

-noautologin

default configuration option – requires that login commands be executed prior to running any commands

-noregister

does not register the EM CLI client

-custom_attrib_file

contains the path name of the file that contains any custom auditing attributes and is required if the OMS is configured for custom auditing

If you want to verify the current EM CLI Client setup information simply enter:

./emcli setup (for basic info)
./emcli status (for more detailed info)

EM CLI does generate log files that contain both error and informational messages. These files can be used by individuals with system expertise for troubleshooting. They are not really designed for the casual user as the information contained in the logs tends to be very technical in nature. These logs can be easily deleted without impacting performance, as they’ll get re-created and appended to as necessary.

The default location for the EM CLI log files is the client home (from the -dir option used when running the setup command. The logs are called .emcli.log and .emcli.log.1 EM CLI alternates between these two files filling them to .5MB in size before switching and overwriting them.

Before most commands can be run you will need to make sure you are logged in to the client (unless -autologin was specified as part of the setup command). The two commands that are used are login and logout – and the basic syntax of these commands is:

./emcli login -username -password -force

-username is the EM user

-password is the password, you will be prompted if you do not specify this as part of the command line which is more secure

-force logs you in even if there was an existing session/connection

./emcli logout

After Installation and Configuration…What Next?

Once the EM CLI Client has been installed and configured, we can run commands for a significant number of different activities. Next month, we will look at three of the categories of commands that relate to user security within EM: Auditing, Credential Management and User Administration.

See all articles by Karen Reliford

Karen Reliford
Karen Reliford
Karen Reliford is an IT professional who has been in the industry for over 25 years. Karen's experience ranges from programming, to database administration, to Information Systems Auditing, to consulting and now primarily to sharing her knowledge as an Oracle Certified Instructor in the Oracle University Partner Network. Karen currently works for TransAmerica Training Management, one of the foremost Oracle Authorized Education Centers (OAEC) in the Oracle University North America region. TransAmerica Training Management offers official Oracle and Peoplesoft Training in Coral Gables FL, Fayetteville AR, Albuquerque NM, Providence RI and San Juan PR. Karen has now been teaching Oracle for Oracle University for more than 15 years. Karen has attained her Certified Technical Trainer designation along with several Oracle certifications including OCP-DBA, OCP-Internet Developer, Oracle Expert - Oracle 10g RAC and Oracle Expert - Oracle Application Express (3.2). Additionally, Karen achieved her Oracle 10g Oracle Certified Master (OCM) in 2008. Karen was raised in Canada, and in November 2009 became a US Citizen. Karen resides in Columbus OH with her husband, Ron along with their 20 pets, affectionately referred to as the "Reliford Zoo".

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles