On Oracle Community forum, I’ve seen a good question about using EMCLI to add targets. The forum user says that they decided to name the database targets with combining db_name and hostname. As you may know, when you add a database target, EM also creates a database system for the new target (or assign it with an existing one). The new database system’s name is generated by adding “_sys” to the database target name. Let’s we add a database target named TEST, EM will create a database system as TEST_sys. If we name our database target as “TEST_test.gokhanatil.com”, EM will create a database system named “TEST_test.gokhanatil.com_sys”. In my personal opinion, Enterprise Manager provides enough flexibility to report these information so I wouldn’t use this kind of naming system but that’s not the point. As you see, it works well for stand alone databases but when you add a standby database to this system, it becomes confusing. For example, your TESTSTBY_stby.gokhanatil.com will be part of TEST_test.gokhanatil.com_sys. So the forum user asks if we can give a specific name to the database system instead of default naming. For example, our database system will be named as TEST_sys although its members are TEST_test.gokhanatil.com and TESTSTBY_stby.gokhanatil.com. If you use the web console, it’s possible to set a name for the database system, but as I see, there’s no option or parameter for it on emcli. So my solution is using a “hidden gem” in emcli verbs: rename_target. Let’s say we add a target databases like this: ./emcli add_target -name="TEST_test.gokhanatil.com" \ -type="oracle_database" -host="test.gokhanatil.com" \ -prop="SID:TESTERE;MachineName:test.gokhanatil.com" \ -prop="OracleHome:/u01/OracleHomes/db/product/dbhome_1;Port:1521" \ -credentials="UserName:dbsnmp;password:welcome1;Role:normal" Wait for a while and check if the database system is created: ./emcli get_targets -targets="TEST_test.gokhanatil.com%:%" Status Status Target Type Target Name ID 1 Up oracle_database TEST_test.gokhanatil.com 1 Up oracle_dbsys TEST_test.gokhanatil.com_sys Now let’s rename the new database system and check the result: ./emcli rename_target -target_name="TEST_test.gokhanatil.com_sys" \ -target_type="oracle_dbsys" -new_target_name="TEST_sys" Target TEST_test.gokhanatil.com_sys successfully renamed to TEST_sys. ./emcli get_targets -targets="TEST%:%" Status Status Target Type Target Name ID 1 Up oracle_database TEST_test.gokhanatil.com 1 Up oracle_dbsys TEST_sys When we add the standby database of TEST_test.gokhanatil.com, Enterprise Manager will assign it to TEST_sys system. I hope this method solves the problem. We couldn’t give a specific name to the database system when adding the database target because there’s no (documented) parameter for it. So as a workaround, we renamed it after it’s created. Related Posts How to Download New Agent Software for Oracle Cloud Control 12c in Offline Mode Win A Free Copy of Packt’s Oracle Enterprise Manager 12c Administration Cookbook e-book How to Install Oracle Enterprise Manager Cloud Control 12c Oracle Enterprise Manager Cloud Control 12c Plugin for PostgreSQL How to Download New Agent Software for Oracle Cloud Control 12c
↧