Thursday, February 16, 2017

EECS - Oracle Exadate Express Cloud Service, Step 3

Once you have defined your users for your Express Cloud Service, all users with the role of Database Developer or higher can access the database Service Console. From here all database related actions can be started.
The upper category, Web Access, brings you to the specified part of the APEX builder - more on that in the next post. In the lower category you can create database schema's. For our goal within smart4apex, I created a schema for every developer.
You can define whether the schema should be accessible from within APEX and creating an separate tablespace is optional.
I haven't played around with the Document Store yet, so I have to skip that part. You can also set the password of the administrator of your PDB - the most privileged user within your PDB you have access to. Franck Pachot did an excellent writeup about the privileges of that user. I hoped the "Manage Application Express" would bring me to the "APEX Admin" environment - a.k.a. the "INTERNAL" workspace. But in fact it's a very downsized form of that. 
You can enable Application Archiving (using the Application Archive packaged app), enable or disable workspace-to-schema associations and manage a very small number of workspace preferences.
What I had expected and missing the most here is the option to create multiple workspaces! So one EECS instance means one and only one APEX Workspace! I still haven't found the document that lists that limitation. That was a real surprise for me.

The middle part of the Service Console is the most interesting one for this post. As we would like to access our EECS database like a local one! Assuming you have your favorite tool (SQL Developer, SQL Plus or sqlcl already installed), you have to download the "Client Credentials". On downloading you have to enter a password. You'll need that again to set up the connection using SQL Developer. So fire up a a recent version - I used 4.2 - of SQL Developer and define the connection, using "Cloud PDB" as the Connection Type, point the Configuration File to the downloaded zip file and enter the previous defined password. Make the connection and voila, you are running SQL Developer connecting to a database in the cloud! 

And while you can do most of the regular database development stuff, there is quite a list of restrictions, limitations and issues, all listed in this document. So no multimedia, spatial, RAS, to name a few.

Connecting with sqlcl is just as simple. Drop the zip-file in a location easy to find by sqlcl (as you can see in the screenshot above, I dropped it in the sqlcl/bin directory). Fire it up with "sqlcl /nolog" and define the cloud configuration using the zip file:

set cloudconfig /Applications/oracle/sqlcl/bin/

As you don't want to type that line each and every time, it's convenient to put that in a login.sql file in the sqlcl directory. 
The zipfile is unzipped in a new directory on your file system - it seems to create a new directory each and every time you issue that command. I hope it gets cleaned up somewhere somehow eventually ...

And is it fast? It feels pretty fast - hey it is an Exadata machine  - , but now and then I noticed some latency in the connection. Not too bad and expected as the server is in the US. I'm sure that will be a lot better once there will be a real European roll-out. In the Service Console there is a little diagnostics tool hidden in the menu in the upper right corner where you can measure your latency. I measured it three times and the latency was around 180ms on average. So that's not super, but not really annoying in a sqlcl / SQL Developer environment. But what would happen if I start clicking around in the APEX Builder?

EECS - Oracle Exadata Express Cloud Service, Step 2

Once you get your services up and running, you can log into your domain - in this screenhot "smart4apex" - on the Oracle Cloud.
Then you'll end up in the "My Services" dashboard. As I have only one, my dashboard looks quite clean, showing just this widget:
Just a few remarks for the designers of this: I am very curious why there is an extra "(Number of ..." in the chart title. The same superflous text is also on another location on that page.
And, more intriguing, what would "0.0323 database instances" mean? 1/0.0323 = 31. So something like days? But February has 28 days...
It would make way more sense to just show here how many instances I had on those day (so, "1" al over the place...).
From this widget you can drill into the "Service Details", where you can set rules and alerts and see the (historical) status of your instance. Funny thing is, I noticed this:

These figures indicate, I have a storage limit of 23Gb. But my service is based on 20Gb. So I get 3Gb "for free"!
Probably that's (more or less) used by Oracle itself (SYS, APEX etc.). So if you buy 20Gb, you really get 20Gb to store your own data!
Now it is time to add some users to this instance. As we - as smart4apex - would like to use it as a development environment, I added all colleagues as a user. 
And i can assign Roles to every user. There is a standard list of roles defined. From the documentation I figured out that the first two are entitled to add or modify other users, but what the privileges and restrictions of the other three are, I still have to discover. What I do know is, if you just assign the "Database User" role to a user, you can log in to the My Services page, but if you try to use the Exadata Express service, you get an "Acces Denied" message. You need at least Database Developer or Database Administrator to access the APEX builder (more about that in a later post).
A nice feature is, you can upload a csv file to create multiple users and assign roles in batch. Saves you a lot of clicks....
And every user you create receives a nice welcome email with a temporary password and a login link. Once you use that link, and login you end up on a (rather outdated - ADF faces built) page of Oracle Identity Self Service to change your password and register three (!) challenge questions. That is a challenge in itself ;-)
Apart from the standard Roles, you can define "Custom Roles" and assign those to users. But any information about how to use these roles in an APEX application is welcome, as I couldn't find any documentation on this subject.

In the next post, I'll go into the database (in)side of the service and in the subsequent one, the APEX development environment of the Exadata Express Cloud Service (EECS).

Monday, February 13, 2017

Intermittent ORA-06502 error when running APEX 5 on 12c

We upgraded our environment from 11.2 to 12c last week. This week we noticed an error in one of our APEX pages, a rather simple form for entering data. Nothing fancy, nothing spectacular - only a spectacular error when you tried to edit a record. 
Running the page in debug mode (even on LEVEL9) wasn't very helpful as you can see below (10 points who immediately spots the error!).
The error didn't occur for all records. It seems that a long(er) Code and Description field on the page resulted in an error more frequently. Also fiddling with a couple of the checkbox fields on the page had an effect.
So I asked Twitter for help. And within a few minutes I got all kinds of tips and advice. But especially one, from Peter Raganitsch was spot on. He suggested, looking at the debug output above, to take a look at the #CLOSE# position in the template. .
My buttons are positioned in that #CLOSE# position, so I took a closer look at those. There were three that passed the Id, Code and Description to other pages as a parameter. So ... the longer the description ... the longer the generated URL would be. And as one of the checkboxes would toggle the availability of one of the buttons, that would also have an effect on the total length of the URL's in that region position. 
So I changed a little code, to pass only the Id's to the other pages (and add a select statement there to (re)fetch the Code and Description. And since then ... it runs as a breeze.

Very weird though this was not on issue on 11.2, but is on 12c....

So what causes this issue, what is the difference?
The answer is: the checksum!

If I create a Report and a Form on DEMO_CUSTOMERS, using the CUSTOMER_ID as the Primary Key, the URL has this checksum on 11.2 : " &cs=3Fqn7QOYkP-TDSLkssvzU7i7QL1E "
On 12c however, the checksum is :" &cs=36Drf3ULxGXswIlT5btBujofcmgwdjJsr-luSfpLjSMpXP71DILliWBz31qkpRJHyPj2RS8iLce5qNkXSSeGbvQ "
And that was probably enough extra length to pass a certain varchar2(<some number here>) in the APEX code that generates the page output....

Thursday, February 09, 2017

First steps using the Oracle Exadata Express Cloud Service

The Oracle Exadata Express Cloud Service was announced at Oracle Open World 2016. This service looks like an excellent use case for Oracle Database development purposes as well as setting up a test environment. And even for small to medium sized production situations it looks very promising as you can see in the table below. Especially the cheapest option offers a lot of bang for your bucks.
But alas, this service was not as widely available as I expected. The first months it was US-only and you could only figure out by ordering the service and then you would find out on the last page that you should "contact your Oracle sales rep". I sincerely doubt whether he or she could provide you with that service, so I just waited until it would be more generally available.
And since a few weeks the Oracle Exadata Express Cloud Service is also available in Europe - I don't know about other parts of the world. A missed chance though that Oracle didn't announce that properly. You can only find out by trial-and-error. And to be clear, your data will still reside on US soil...

After entering my credit card number I made my purchase irreversible and I immediately received an order confirmation. As I expected these cloud things go very fast I started waiting for the mail that would say that my service was ready. Not on that same day. Not on the next day. But two days later, I finally received my "Welcome to Oracle Cloud" email. If any webshop that ships physical items would move that slow, they would be out of business pretty soon. 
But now I was ready to go! First I had to create my "service instance". No clue what Oracle did the last two days, but effectively I only had access to a console where I could create such an instance. Why doesn't Oracle create that instance immediately? Because in the end what I ordered was a service instance - not the option to create one...

Nevertheless, with a few clicks I had requested my instance as seen in the screen below (notice the little missing icons / images on the upper left and right buttons...).
The only thing that had to be done was firing up a 20Gb Pluggable Database (PDB). On my VM that would take a few minutes. So on an Exadata beast ... a minute or maybe two?

Alas, no. For some reason it took 4 (four!) full days. All those days I logged in to see whether there was any progress and all I saw was:
After the Oracle internal issues were solved - the PDB was created super fast, but the registration process failed somewhere - I was finally up and running. 

It took a while, but I hope it was worth waiting for ....

Thursday, October 13, 2016

OTN Nordic ACE Tour : A Tale of Three Cities

3 days - 3 cities - 6 presentations (4 different ones)

My tour started on Monday afternoon when I left my house around 1.30PM to get on the bus to the train station. The 2PM train left exactly on time for the Amsterdam airport. I arrived at Schiphol around 3:30PM, perfectly on time to catch the 5PM flight to Copenhagen.
The flight to Copenhagen was very uneventful. From the airport I took the train / metro into the city. I already received an email message from one of my co-travellers, Martin Widlake, who was sitting al alone in a bar downtown. The poor guy. So I rescued him and was briefly after that joined by Sten Vesterli - another ACE Director from the organising country. After just one beer we head over to the restaurant where we met the rest of the board of the Danish Oracle User Group and the other two co-travellers, John King and Ludovico Caldera, for a very nice dinner.
As the city was crowded due to another - slightly larger - conference all hotel rooms were either booked or extremely expensive or far far away, the speakers were invited to stay the night at one of the board member's houses. I had the honour to stay at Sten's place and had a good night sleep.

The next morning we had a short drive to the Oracle office were breakfast was served and about 70 attendees showed up for the sessions. My two sessions - about JavaScript and APEX 5.1 - were well attended and went smooth (in my opinion). The lunch was excellent and the Miracle beer during the afternoon "coffee" break was very welcome. When the last speaker was done we went straight to the airport for our flight to Oslo. We killed the time by talking and drinking just one beer.
In Oslo we took the high speed train into town, walked a few 100 metres to our hotel and were welcomed by Øyvind. After dropping off our bags we quickly went to something called the "Beer Palace" at a very short distance of the hotel. But before we enjoyed the local drinks we went to the burger joint next door to grab a bite (we took it back into the bar to be exact). Not much later Ann-Sofie (another OUGN Board member) joined us as well. And after a drink or two we called it a night.

The venue in Oslo was very close by, so after an excellent breakfast we walked down there in just 5 minutes. I estimate about 50 attendees here. All 4 presenters had to deliver 3 presentations each - so at the end of the day we were quite "done". We declined the invitation to "have just one beer" (sorry Bjørn) and went to the train station and straight to the airport. While waiting for our next flight to Helsinki we grabbed a beer and a sandwich.
The flight to Helsinki took just over an hour, but included a time zone shift. When we arrived at the airport we took a shared cab that brought us to our hotel downtown were we arrived around 10:30PM. And the bar would close at 11PM. So a quick check-in, drop off the bags and use the remaining bar time properly.

For the next morning Heli had invited us for a tour through downtown Helsinki. So after breakfast we walked around enjoying the cool air (just above freezing) of Finland! This is were the local "Glögi" was more than welcome!
After returning safely back to the hotel, grabbed our stuff, checked out and walked 30 meteres to the Accenture office where the OUGF event was held. The event started with an excellent lunch, after which myself and Martin did our talks. And there is where our paths split. While Martin and I left for the airport to catch our 6PM'ish flights back home, John and Ludo stil had to do their presentations and will later catch their flights to the last stop, Stockholm.

As this was my very first ACED tour, I have to say it was quite an experience. It feels like: get into a taxi, onto a plane, into a train, find the hotel, do a presentation and then start this sequence all over again. So busy, very busy, But with the good company of Martin, John and Ludo it actually quite enjoyable!
Thanks to the local user groups for inviting me and thanks for the OTN ACE Program for the support! It was a blast.
(now in the lounge waiting for my flight back home....)

Monday, October 03, 2016

APEX 5.1 NF : Show Custom Application Icons in the APEX Builder

It just isn't fair. If you install a Packaged Application - and you should because there is a lot to learn from those apps - in your APEX Workspace they all have a cool looking icon. And your own applications, just show up with two characters in a (random?) coloured box. Why can't I have a nice looking icon for my application?

In APEX 5.1 you can!
Upload an image as a Static Application File. According to the help it should by 64 x 64 pixels, but I noticed it can be larger as well. It should be square though to show up nicely. Don't put it in a (sub)directory, it should be placed in the 'root' folder.

Then edit the Application Definition (either via Shared Components > Application Definition Attributes or by clicking on the "Edit Application Attributes" on the Application Builder home screen. Then scroll down until you see the "Icon File Name" property. Enter the name of the uploaded file there - but don't reference #APP_IMAGES# as you're used to! 

Now switch back to the APEX App Builder Home screen ... and your application is there with your custom application icon!

So in 5.1 there's no difference anymore in the presentation of Packaged Applications or your own... they can all look good!

It's happening again ... running for the ODTUG Board of Directors 😉

For the third time in a row I'll be running for ODTUG's Board of Directors. But after ending as a runner up twice, I am sure I'm going to make it this time! But not without your help!

My campaign statement this year is:

I have been attending and presenting at Kscope conferences since 2007. This not only resulted in a vast amount of knowledge, but also - and even more important - a huge number of friends from all over the globe.  I want to see ODTUG grow and spread this community feeling even more! 

My experience as an attendee, presenter and content lead has provided the basic foundation to be a director. Next to that, my personality and (global) network will be beneficial to the whole board and organization. 

Since March I have served on the Board of Directors in a limited term for a Director who stepped down due to a career change. This has allowed me to have unique insight of all the things that are going on in and around the ODTUG organization. As the train was already rolling full steam ahead, I tried to lend a helping hand wherever I could. 

Now, I seek your support as a full term elected member of the board so that I may become even more involved by heading a standing committee and serving a full two year term.  I am really looking forward to making a difference and helping the organization continue to move forward. I feel as if these last six months were a sort of internship that can give me a jump start for the next term! 

So don’t hesitate and vote for Roel! 

See for more details. You can even sign up as a supporter!
But even more important ... if you are eligible to vote: Please do so! 
You can vote from October 4 to 25.

Thursday, September 29, 2016

OTN Nordic ACE Tour

In 1.5 week I'll be travelling to and through the Nordics as one of the speakers during the OTN Nordic ACE Tour. It will be quite a busy schedule!

On Monday afternoon I'll be flying to Copenhagen and will meet my fellow travellers for the week during a dinner hosted by the Danish Oracle User Group. On Tuesday I have two sessions during the event: One about APEX JavaScript API's and one about APEX 5.1.  At the end of the day it's off to the airport to catch the flight to Oslo around 7PM. I foresee an airport dinner here....

Wednesday in Oslo I have even three sessions: About the Universal Theme, APEX 5.1 again and APEX and JET.  At the end of the day it's off to the airport again to catch the flight to Helsinki around 7PM. Probably another airport dinner here ....

Thursday morning Heli will take us for a short (but brisk) walk through Helsinki, before the Finnish event starts around noon. Here I have only one session, about APEX 5.1 again. And again ... back to the airport to catch the flight back to Amsterdam around 7PM. Airport dinner anyone?

So it'll be a very busy few days, but fun as well!
And of course thanks to OTN for supporting this trip.

Tuesday, August 30, 2016

Fix Interactive Report headers issue when using a Region Display Selector

When you have multiple Interactive Reports (IR) on your page and use a Region Display Selector to mimic tabs, you might notice some weird behaviour in the IR headings if you switch tabs. The headings are not positioned correctly and you get an extra empty row under the headings. It just looks weird and ugly. But if you resize your browser window, it all looks fine again (until you switch to another tab..)

So can we fix this by creating a Dynamic Action that mimics that "browser window resize" event?
Yes we can!

Create a Dynamic Action that fires on Click of the jQuery selector li.apex-rds-item a. That should fire a JavaScript snippet : 
apex.event.trigger(this.triggeringElement, "apexwindowresized");

So now a click on a tab not only switches from one IR to another but also fires that event that will "autofix" the IR headers. A simple solution for an annoying problem.

This applies to APEX 5.0, I assume it will be solved in 5.1.