We may need sometimes to export or import the monitoring templates in Oracle grid control from one environment to new environment, for example when you upgrade or a new OMS infrastructure has been built, in this case the emcli export/import will help you to copy the monitoring templates between environments, lets see how to do it.
1) Log into emcli (sysman)
2) exporting from UAT environment
emcli export_template -name="TEST skeleton listener" -target_type=oracle_listener > TEST_listener.xml
emcli export_template -name="TEST skeleton db instance" -target_type=oracle_database > TEST_db.xml
emcli export_template -name="TEST skeleton rac" -target_type=rac_database > TEST_rac.xml
emcli export_template -name="TEST skeleton host" -target_type=host > TEST_host.xml
emcli export_template -name="TEST skeleton cluster" -target_type=cluster > TEST_cluster.xml
emcli export_template -name="TEST skeleton ASM" -target_type=osm_instance > TEST_asm.xml
emcli export_template -name="TEST skeleton agent" -target_type=oracle_emd > TEST_agent.xml
3) importing into Production environment after logging into emcli in OMS
emcli import_template -files="TEST_listener.xml;TEST_db.xml;
TEST_rac.xml;TEST_host.xml;TEST_cluster.xml;TEST_asm.xml;TEST_agent.xml"
4) Assign the new templates to them from OEMGC Console GUI, in a controlled manner.
In OEM, navigate to Setup -> Monitoring Templates
Choose the radio button against the standard template of your target type, and Click --> Apply.
Under --> Destination Targets--> , click --> Add.
Check the databases that you want this template to be applied to, and Click ->Select .
Click OK.
Reference:-
How To Export , Import Templates via emcli Utility. (Doc ID 740806.1)
1) Find templates in source Repository database. Connect to the repository Database as
SYSMAN and execute the following SQL statement.
SQL> select TARGET_TYPE,TEMPLATE_NAME from MGMT_TEMPLATES where TEMPLATE_NAME like '%TEMPLATE NAME%';
2) Export template from source environment.
$ emcli export_template -name=Host -target_type=host -output_file=Host.XML
$ emcli export_template -name=Listener -target_type=listener -output_file=Listener.XML
$ emcli export_template -name=Database -target_type=oracle_database -output_file=Database.XML
3) Copy file to another server, with emcli configured for target environment.
4) Import exported template at target environment.
$ emcli import_template -files=Host.XML
$ emcli import_template -files=Listener.XML
$ emcli import_template -files=Database.XML
Hope this helps
-Thanks
Geek DBA
Follow Me!!!