Now that the Oracle Cloud is publicly available, I want to show you what it takes to put your APEX application on there.
As an example I will use the application "DGTournament" that I created in 2006 to promote APEX and upgraded every two years to the latest version of APEX. I thought this would be a good app to use as there's some legacy code in, but it also contains many new features that came with every release of APEX. Next to that you might actually have played with it, the app/site is still live and we can also do a side-by-side comparison of Amazon EC2 vs Oracle Cloud.
In this first post I want to take my current application with all it's data and move that onto the Oracle Cloud.
Step 1: Get an Oracle Database Cloud Service
You can apply for an account on this link and you will receive some emails when you are ready to go as described in a previous post.
Step 2: Connect to the Oracle Cloud from Oracle SQL Developer
Kris Rice did an excellent blog post about it. Next to that post I would definitely recommend reading the Oracle Cloud documentation as it contains important information how to connect with SFTP. You have to reset your password first, to do that you need to connect to IDM, all that is in the doc very well explained.
Step 3: Move your database objects, data and APEX app to the Oracle Cloud
Normally I would take a datapump export of my existing schema and take an export of my APEX application. So that was the route I wanted to follow, however I couldn't find the option to do a datapump import in the Oracle Cloud! (not through the tree, not through the Datapump wizard in SQL Developer)
After looking into the Oracle Cloud documentation again, it said you have to use the Cart option (which you find under the View menu) in SQL Developer. I used that before, I even asked for an enhancement request.
So I connected to the database DGTournament is currently in and dragged everything from the tree into the Cart. (note that you need to specifically drag the package bodies, otherwise you just have the specifications) I also thought to be smart and dragged my APEX application into the cart (see next screenshot at the bottom)...
So once everything is in the cart (and you can say you want all data for all tables as well) you can deploy to the cloud by clicking on the cloud icon (top, most left).
Fill out the details of the Oracle Cloud connection and hit Apply. A few minutes later all my database objects and data were in the Oracle Cloud! I was impressed how smooth it was.
The following screenshot shows the deployment overview and I expanded the tables tree of my Oracle Cloud connection so you can see everything is effectively in, even the BLOB columns and data got transferred without any issue.
As I dragged the APEX application in the Cart as well, I thought I would find it in my APEX Builder, but it wasn't there, so you have to manually import your APEX application.
Step 4: Import your APEX application (through the APEX Application Builder)
Importing an APEX app is not a big deal, export your app from one APEX instance and import through the wizards in the other APEX instance and done.
Step 5: Run your APEX application
Step 6: Review (and try to recompile) all invalid database objects
And here is the biggest catch with the Oracle Cloud: some database packages are not available in the Oracle Public Cloud. So for example I recompiled one of my packages and got this error:
So after reviewing my code, following packages I used are not working in the Oracle Cloud:
- I used this to hash the password
- I used it to calculate timings
- I used it for crlf (character linefeed)
- I used it to send out mails with attachments
Step 7: Make your code "Oracle Public Cloud"-compatible
So this basically means that all the package calls I do, that don't work, I will need to either remove or rewrite to something that does work.
For example the DBMS_UTILITY package I don't really need anymore as you can get timings native in APEX today, so not necessary to calculate yourselves.
The call to UTL_TCP for just the character linefeed I can remove too.
UTL_SMTP is interesting... in 2006 (and later in 2008), when I wrote some part of the application, there wasn't the apex_mail package yet that supported attachments, so that is why I had to use utl_smtp and write everything myself... but even using the apex_mail package wouldn't work as sending mails from the database in general is not supported in the Oracle Cloud. So the only way to solve that issue, is to integrate with a service (for example MailChimp) that sends emails for you.
And showing the images I wouldn't really code anymore using my own procedure either, as you can now use the native BLOB (image) support in APEX.
So that leaves me with DBMS_OBFUSCATION_TOOLKIT which I need to replace by something else that works in the Oracle Cloud.
There might be some code flying around in your application which should have been in packages (but isn't) or other components of the APEX app that are not compatible, for example some third party plugins which need some specific filesystem files and folders which you can't create in the Oracle Public Cloud.
To identify the code that should be in packages and which might not be compatible I use the APEX Advisor to find those and I did! When you upload your profile picture in DGTournament I create a thumbnail on the fly with ORDSYS.ORDIMAGE... and it looks like that's something you can't use either in the Oracle Public Cloud. It actually remembers me of one of my conversations with the Oracle team during my beta testing; I really would love to see Intermedia and Locator support in the Oracle Cloud as many of my applications are using that... the answer was it might come in the future, but it's not available yet.
For the rest you just need to go through your application and test it...
Step 9: Enjoy the Oracle Public Cloud
Once you have everything running and everything is compatible, you can enjoy the Oracle Public Cloud... Click this link to see DGTournament in action in the Oracle Public Cloud. (note that I didn't correct all incompatibilities yet and didn't upload all external files it needs)
In my next blog posts I will talk about other things like the performance, doing the maintenance etc. ... and my last post will be a conclusion.