Speedy #em12c template export

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

Please follow and like:
Comments
  • I think that everything published made a ton of sense. However, what about this?
    suppose you composed a catchier post title? I am not suggesting your information is
    not solid, but what if you added something that makes people desire more?
    I mean Speedy #em12c template export – DBASolved is a little
    vanilla. You might glance at Yahoo’s front page and see how they write news titles to get viewers to open the links.
    You might add a video or a related picture or two to
    grab people interested about everything’ve written. In my opinion, it could make your posts a little bit more interesting.

    My webpage: try this web-site

  • Write more, thats all I have to say. Literally, it seems as though you relied
    on the video to make your point. You definitely know what youre
    talking about, why throw away your intelligence on just posting videos to your site when you could
    be giving us something enlightening to read?

    My web blog address

  • Hey There. I found your blog using msn. This is an extremely well written article.
    I will be sure to bookmark it and return to read more of your useful
    info. Thanks for the post. I’ll certainly comeback.

    Also visit my blog; like it

  • I’ve learn several just right stuff here. Certainly price bookmarking for
    revisiting. I wonder how much effort you set
    to make such a magnificent informative website.

    Feel free to visit my blog post: see it here

  • Ein Casino im Internet ist eine plattform, auf
    der nutzer verschiedene casino-spiele wiee tischsppiele und roulette
    genießen können. Ob Sie gerne ab und zu spielen, Online-Casinos biedten vielfältige
    optionen für alle artten von spielern.

    Viele plattformen bieten willkommensboni, um spieler zu motivieren. Zusätzlich können loyalitätssysteme den Spielern weitere vorteile bieten.

    Transaktionen in online-casinos sind sicher, mit optionen wie kreditkarten, die schnelle einzahlungen ermöglichen. Vertrauenswürdige anbieter sorgen für die sicherheit
    der spieler.

    Spielen im online-casino macht spaß für spieler, die viel spaß beim glücksspiel haben. https://de.trustpilot.com/review/nine-onlinecasino.top

  • hey there and thank you for your information – I’ve definitely picked up something
    new from right here. I did however expertise several technical points using
    this web site, as I experienced to reload the site a lot of times
    previous to I could get it to load correctly. I had been wondering if your
    hosting is OK? Not that I’m complaining, but sluggish loading
    instances times will sometimes affect your placement in google and
    can damage your high quality score if ads and
    marketing with Adwords. Well I am adding this RSS to my
    e-mail and could look out for much more of your respective fascinating content.
    Ensure that you update this again soon.

    Have a look at my site – best site

  • Hi there, this weekend is fastidious designed for me, for the
    reason that this moment i am reading this enormous informative piece of writing here at my home.

    Here is my blog post continued

  • I’m really enjoying the design and layout of your website.
    It’s a very easy on the eyes which makes it
    much more enjoyable for me to come here and visit more
    often. Did you hire out a developer to create your theme?
    Outstanding work!

    my web page :: blog here

  • Great beat ! I would like to apprentice whilst you amend your web site,
    how could i subscribe for a weblog web site? The account helped me a acceptable deal.
    I had been a little bit acquainted of this your broadcast provided shiny transparent concept

    My webpage: you can find out more

Leave a Reply

Your email address will not be published. Required fields are marked *

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.