19 June 2014

Import and Export Reports from Cloud Control

If you create a nice Cloud Control report, you might want to re-use it in another Cloud Control environment. The emcli command gives you the option to export the report in an xml format and import it again in the same (if you edit it) or in another Cloud Control.

It's very easy to do so, but you have to be familiar with the emcli (Enterprise Manager Command Line Interface).

Let's give an example, starting on the OEM server (Linux) as user oracle.

First login to the emcli. This creates a session.

oracle@oemsv01:/opt/oracle/Middleware/oms/bin> ./emcli login -username=SYSMAN -password=xxxxxxxxx
Login successful

Now you can export the report. You need to have the name of the report as you see it in Cloud Control.

oracle@oemsv01:/opt/oracle/Middleware/oms/bin> ./emcli export_report -title="Oracle Database Backups" -owner="SYSMAN" -output_file="$HOME/CC_db_backups_report.xml"
Report "Oracle Database Backups", owned by "SYSMAN", has been exported from the repository.
Exported reports may not contain all information from original report.  Repository specific information such as targets, administrator access, and schedules are not exported.  Imported reports should be edited after import to supply all necessary report parameters.


You can now import it. But if you don't change the name, you will get a duplicate error.

oracle@oemsv01:/opt/oracle/Middleware/oms/bin> ./emcli import_report  -files="$HOME/CC_db_backups_report.xml"
Error: The report named "Oracle Database Backups", owned by "SYSMAN", already exists in the repository. Use -force option to overwrite this report.


Edit title in xml file, to prevent duplicate, or use force option.

oracle@oemsv01:/opt/oracle/Middleware/oms/bin> ./emcli import_report  -files="$HOME/CC_db_backups_report.xml"
File "/home/oracle/CC_db_backups_report.xml" has been imported into the repository.
Imported reports should be edited after import to supply all necessary report parameters.

There are many advantages of using this. You can develop the reports and deploy them in a production-Cloud Control. You can create versions, and easily store them in your version tooling. You might think of other options.


Enjoy!

No comments:

Post a Comment