Recently a customer asked if it was possible to promote unmanaged targets automatically without any interaction. They were already using auto-discovery.
The answer is yes, and of course as soon as you see words like “without any interaction” you know there’s going to be scripting involved. In the Enterprise Manager world, scripting is handled by the EM Command Line Interface, better known as EMCLI. I’ve posted some example scripts of using EMCLI a while back (see this post), but I thought it was worthwhile to show you how this particular request is handled as well. If you have the latest bundle patch on either 220.127.116.11 or 18.104.22.168, you can also use additional parameters to the get_targets verb to list discovered targets (-unmanaged). This includes listing the associated instance targets if you want to promote a RAC database (-associations).
Now on to the script. This one is a python script which promotes some or all single instance databases, just as an example. And of course, all the usual caveats apply – use at your own risk, Oracle does not support this script, yaddah yaddah yaddah. 🙂 The script comes courtesy of my boss, Dave, so if there’s something wrong you can blame him!
Since WordPress does some funky stuff with lesser than and greater than signs, it’s easiest if I post this as a file, so here’s the link to the file on DropBox. If DropBox is blocked by your work, just shoot me an email and I’ll get a copy of it to you that way.
Hope that example is of use to you!