Wither you use a single OEM and migrating to a new OEM or have multiple OEMs, the need to move templates between environments will arise. I had this exact problem come up recently at a customer site between an OEM 11g and OEM 12c. In order to move the templates, I needed to export the multiple monitoring templates using EMCLI. The command that I used to do individual exports was the following:
./emcli export_template -name="<template name>" -target_type="<target_type>" -output_file="/tmp/<template name>.xml"
If you have only one template to move, the EMCLI command above will work. If you have more than one template to move, the easiest thing to do is to have the EMCLI command run in a script. This is the beauty of EMCLI; the ability to interact with OEM at the command line and use it in scripts for repeated executions. Below is a script that I wrote to export templates based on target_types.
Note: If you need to identify the target_types that are supported by OEM, they can be found in SYSMAN.EM_TARGET_TYPES in the repository.
#!/usr/bin/perl -w # #Author: Bobby Curtis, Oracle ACE #Copyright: 2014 # use strict; use warnings; #Parameters my $oem_home_bin = "/opt/oracle/app/product/12.1.0.4/middleware/oms/bin"; my @columns = ("", 0, 0, 0, 0); my @buf; my $target_type = $ARGV[0]; #Program if (scalar @ARGV != 1) { print "\nUsage:\n"; print "perl ./emcli_export_templates.pl <target_type>\n\n"; print "<target_type> = target type for template being exported\n"; print "refer to sysman.em_target_types in repository for more info."; print "\n"; exit; } system($oem_home_bin.'/emcli login -username=<userid> -password=<password>'); system($oem_home_bin.'/emcli sync'); @buf = `$oem_home_bin/emcli list_templates`; foreach (@buf) { @columns = split (/ {2,}/, $_); if ($columns[2] eq $target_type ) { my $cmd = 'emcli export_template -name="'.$columns[0].'" -target_type="'.$columns[2].'" -output_file="/tmp/'.$columns[0].'.xml"'; system($oem_home_bin.'/'.$cmd); print "Finished export of: $columns[0] template\n"; } } system($oem_home_bin.'/emcli logout');
If you would like to learn more about EMCLI and other ways to use it have a look at these other blogs:
Ray Smith: https://oramanageability.wordpress.com/
Kellyn Pot’Vin: http://dbakevlar.com/
Seth Miller: http://sethmiller.org/
Enjoy!
twitter: @dbasolved
blog: http://dbasolved.com
Current Oracle Certs
Bobby Curtis
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Hello there! Do you know if they make any plugins to assist with SEO?
I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good gains.
If you know of any please share. Thank you! I saw similar blog
here: Eco blankets
We’ll see how effective employee management can have a a lot larger impact on employee productiveness than whether a worker is paid by the hour or by the month.