Saturday, December 1, 2012

Deploying Database Objects to Oracle Cloud using JDeveloper


As announced in my previous post I am going to show now how to deploy Database Objects from a "local" Database to the Oracle Database Cloud. For that showcase I am using the following environment

Environment
  • JDeveloper (JDEVADF_11.1.1.6.0CLOUD_GENERIC_121118.1600.6229)
  • Oracle XE Database 11gR2 with HR schema
  • Oracle Database Cloud Service
Goal
The primary goal is to deploy the tables HR.DEPARTMENTS and HR.EMPLOYEES into the Cloud Schema. So in a next step it will be possible to build an Apex or an ADF Application associated to these tables in the cloud.

Prepare DB Deployment
In order to use the tools provided in JDeveloper for seamless deployment of DB objects into the Oracle Cloud start JDeveloper and open the Database Navigator (View > Database > Database Navigator)

Now create an IDE DB connection to the desired database. I am using the well known HR schema on an Oracle XE DB. This is really straight forward. Just click "+" and add a Database Connection by providing the appropriate account details. Double Click on the created node connects to the database and explores its contents.


Next we need to connect to the Oracle Cloud Database Service. That is pretty simple too.

Enter your cloud service details


et voila, the cloud connection is established!


Important note: Before we go further let me explain the cloud connection details because this is really new and should be noted. The cloud connection actually has two channels. One for "read only" operations and another for DDL, and any SQLPlus scripts. That second channel works technically through SFTP and logically through the "Database Cart" where every db object or script is bundled into a ZIP for sending out to the cloud. Therefor you have to provide that information in the cloud connection wizard.

OK, so the last preparation step is to configure that "Database Cart". Goto: Tools > Preferences >Database > Utitlites > Cart > Cart Deploy and set the deploy directory according to you project needs.


Deploy DB Objects to the Cloud
After establishing the connections and configuring the Database Cart we are ready for deployment. Open Database Cart (View > Database > Database Cart) and Drag and Drop the DB Objects you want to deploy into the database cart.
Next: Click on Save

Click on Apply. 

The selected db objects (metadata) will be saved as an XML File. The Database Cart File contains Metadata about the database objects you want to deploy. To have a better understanding: it looks like that


It is kind of configuration file for the deployment of database objects into the oracle cloud.

Next Step is to deploy the selected DB objects + data into a ZIP file which afterwards will be used to transfer into Oracle Database Cloud.


The ZIP contains the corresponding scripts in order to deploy the objects and data some where else (cloud). Actually it contains a bunch of SQL scripts:


Now the last part is to deploy that ZIP file to Oracle Cloud.

Press Apply.

The data now is exported and transferred as a Deployment Unit on your Database Cloud Service.
You can verify your deployment by refreshing the cloud connection in JDeveloper

and also look into the processing log


The newly created Table DEPARTMENTS can be verified/viewed right from JDevelopers Cloud Connection



Once again - How does it work?
The chosen DB Objects + Data are exported from a database and put together in a deploy.zip file. By providing the SFTP DB Service Account details this file is transferred to the cloud through SFTP. You can verify this by logging into your SFTP Account:


To summarize
  • Configure Database Cart
  • Drag and Drop DB Objects into Database Cart
  • Deploy into Cloud
  • Verify Processing through Deployment Status/ Log
  • Verify deployed DB Objects through Cloud Connection right from the JDeveloper IDE
Having performed this steps next it is possible to build 
  • Apex Application
  • ADF / Java EE Application
  • RESTful Services
based on the deployed data structure. Stay tuned.

I really like that everything is bundled inside JDeveloper. No need to download any plugins or extra tools. Use JDeveloper to Build, Deploy DB and Java Applications (as I will show in the next post). Cool stuff! Goto cloud.oracle.com and try yourself!

Related Posts / Documentation


No comments:

Post a Comment