Monthly Archive: August 2015

Oracle Enterprise Manager 12cR5 – Clone a PDB to the Oracle Cloud

Cloning an on-premise PDB to the Oracle Cloud is basically done in three steps. 1. Select your PDB – 2. Start Clone Menu – 3. Verify new PDB. In the basic clone menu, Oracle uses some default settings in the background, for example the source datafiles will be packed in a compressed file which is located in /tmp directory of the source server. When your /tmp directory is too small, the clone process fails. Why this directory is used? I don’t know. But it could be a problem when you clone bigger databases. Maybe we can edit the clone procedure, but this is a task for me for a day when it’s raining outside… All cloning steps are well monitored, in case of an error you see a detailed error message so you can go on from the step where the error occurred.

To clone a PDB, there are some prerequisites which has to be fulfilled like same characterset, endianess and options. Don’t worry, if your source database has a wrong characterset, the clone procedure will be stopped.

The source PDB

My source PDB is a small database called CRM02 located in a Trivadis Datacenter – the container database is called TVD12CDB. I want to clone the local PDB to the Cloud database TVDHIPER.

cloud_2_cloud02

Start the Clone Procedure

In the menu Oracle DatabaseCloning select “Clone to Oracle Cloud”.

cloud_2_cloud02

Source and Destination Information

Enter the source and destination information like credentials, passwords etc. As destination Database Host Credentials select the SSH credential.This credebtial will be used to copy the files to the new server. In the right top corner you have the buttons Advanced and Clone. Clone starts the process with default settings immediately, if you select Advanced you can set destination directory, scheduler the execution etc. I select Clone.

cloud_2_cloud03

The Process starts immediately

This is the main menu where all the steps are monitored. You see all the details which are executed in the background. It’s an excellent overview.

cloud_2_cloud04

I one of the firsts steps, Oracle creates the PDB XML manifest and puts all datafiles in a compressed tar.gz file. As I said in one the first lines in this blog post, the directory is /tmp…

The tar.gz file will be transferred to the new target and after the transfer it’s deleted. But you have to clean up the datafiles manually.

What happens on Target Server

The tar.file will be extracted in a new folder and then the database will be plugged in. Here is the tar.gz file on target server. After the successful plug-in, the files will be deleted at this location. Oracle uses OMF – Oracle Managed Files, the extracted files are then located in this directory structure.

If the plug-in action fails, you can see that immediately in EM12c. During my clone process, an error occured when Oracle wants to apply a patch to the new PDB.

cloud_2_cloud05

In this case, the plugged in PDB has a wrong state. Oracle was not able to apply the datapatch because the pluggable database was not in UPGRADE state.

cloud_2_cloud_error01

As workaround I logged in as SYSDBA into the target database in the Oracle cloud and changed the mode manually.

Then I restarted the procedure from the position where the error occurred.

retry

Welcome to the cloned PDB

After some minutes, all steps are done, no errors. the pluggable database is now cloned and up and running. The task has status succeeded.

cloud_2_cloud06

EM12c Integration

EM12c target discovery is not required, the new pluggable database CRM02_CL will be added automatically as new target.

cloud_2_cloud07

Summary

First I wanted to try to clone a PDB from cloud database to cloud database, but this is not implemented at the moment. So I tried out to clone an on-premise database to the cloud. I have tested the basic functionality with a small database and it works fine. There are some issues like why does Oracle write files to /tmp or why has the plugged-in PDB the wrong state to apply the patches. But in general when you fulfill all the prerequisites to clone a PDB like character set etc. as you have to to on conventional way too, it runs. One of my next tests will be how it works when the source PDB version is not 12.1.0.2, when it’s a 12.1.0.1 PDB. But I assume it works as designed, there will be a message in PDB_PLUG_IN_VIOLATIONS view and the I have to solve it manually. Or do you think Oracle will upgrade my PDB automatically? We will see… 🙂

Oracle Enterprise Manager 12cR5 – Let’s connect to the Oracle Cloud

Since EM12c Release 5 Oracle has integrated the connection to the Oracle cloud, databases can be monitored and handled very easy, on-premise databases and cloud databases are now managed in one tool. Adding a cloud database to an on-premise EM12c from cloud.oracle.com is very easy and done in a few steps:

  • Create a SSH key
  • Create a DBaaS instance on cloud.oracle.com
  • Configure a local Linux agent as Hybrid Cloud Gateway Agent
  • Create an EM12c credential for SSH login
  • Install EM12c Agent via push method on the DBaaS machine
  • Discover and add the new targets
  • Enjoy

A few documents are available how this setup has to be done. But the best way to get some experience is just to do it. We do not start from scratch with the EM12c integration, I have already created a new DbaaS instance which is up and running:

cloud_1

Configure a local Linux Agent as Hybrid Cloud Gateway Agent

A local agent has to be configured to communicate to the Oracle cloud as gateway. This has to be an existing Agent. I have decided to use the local OMS agent as Hybrid Cloud Gateway agent. The concept behind the Hybrid Cloud Gateway and the configuration is well described here, also how to configure it high available, the used ports etc.

http://docs.oracle.com/cd/E24628_01/doc.121/e24473/hybrid-cloud.htm#EMADM15149

Create an EM12c Credential for SSH Login

The credential contains an username and the private ssh key for the passwordless connection to the new host of the DBaaS. The scope is global, so all new cloud connections can use it. You can create the credential in menu Setup – Security – Named Credential. A test run is not possible because there were no other cloud targets configured at the moment.

cloud_2

Install EM12c Agent via Push Method on the DBaaS Machine

The installation of the agent is simple, it’s almost like local installations. The only two changes are a) to use the SSH credential and b) to choose the Hybrid Cloud Gateway Agent.

Setup – Add Target – Add Targets Manually – Add Host Targets – Add Host …

Information: During tests I ran into errors when I wanted to resolve the cloud hostname via /etc/hosts file. I was able to install the agent, but not to configure the databases. So I used the IP address here instead of the hostname, this works fine.

cloud_3

Select Named Credential and activate Checkbox to enable the Hybrid Cloud Gateway Agent. This port will be set automatically.

cloud_4

Deploy the agent and run root.sh on cloud host.

cloud_5

In the agent details via Setup – Manage Cloud Control – Agents you can verify if it’s a cloud agent or not.

cloud_6

Discover and add new Targets

After the successful agent installation, the cloud database can be added. Target – Databases – Add Enter Hostname – Next.

cloud_7

The fresh added database is available after a few minutes. The look and feel is as usual, only the small cloud icon on top shows you that the database is hosted at Oracle.

cloud_8

Enjoy

The integration of a cloud database into a on-premise EM12c is well done by Oracle. This is only the beginning, in the next days I will test more features like cloning a on-premise pluggable database to the cloud, set up a cloud database in the EM12c Self Service Portal and many more. It’s important to verify what it’s possible – and what’s not. Have fun with in the cloud!

Links:

  • https://cloud.oracle.com/database
  • http://docs.oracle.com/cloud/latest/dbcs_dbaas/index.html
  • http://docs.oracle.com/cd/E24628_01/doc.121/e24473/hybrid-cloud.htm#EMADM15141

EM12c Cloud Control – falsche Anzeige nach Rollentausch

Ausgangslage

Nach einem manuellen Switchover auf Kommandozeile mit DGMGRL wird in EM12c Cloud Control die falsche Rolle angezeigt respektive nicht aktualisiert. Wenn man aber die Detailseite vom Target ansieht, so wird die Rolle richtig dargestellt.

em12c_beide_primary

Analyse

Das Verhalten kam mir bekannt vor, das gab es auch schon in EM11g Grid Control. Es gibt dazu die My Oracle Support Note Database Role not shown correctly in EM after switchover (Doc ID 1645496.1).

Once switchover is done outside EM using dgmgrl and once this is done successfully, the roles of databases are not reflected correctly(targets > Databases. Here checking type) 

Hier noch der Link zur 11g Note: https://support.oracle.com/epmos/faces/DocumentDisplay?id=1067752.1&displayIndex=1#FIX.

Lösung

Auf dem Server wo der Agent läuft, muss mittels emctl Kommando die Konfiguration der Standby-Datenbank auf den neusten Stand gebracht werden.

1. Anzeige vom Target

2. Update der Konfiguration

3. Verifizierung in EM12c Cloud Control

em12c_primary_standby

Fazit

Wer den Switchover nicht via EM12c ausfĂĽhrt, muss die Konfiguration manuell aktualisieren.