Docker : My First Steps

In a blog post after OpenWorld I mentioned I might not be writing so much for a while as something at work was taking a lot of my “home time”, which might result in some articles, but then again might not… Well, that something was Docker…

After spending a couple of years saying I was going to start looking at Docker, in June I wrote a couple of articles, put them on the website, but didn’t mention them to anyone.  I was finding it quite hard to focus on Docker because of all the fun I was having with ORDS. More recently it became apparent that we have a couple of use-cases for Docker at work, one of which involved ORDS, so it reignited my interest. There’s nothing like actually needing to use something to make you knuckle down and learn it… 🙂

Having gone back to revisit Docker, I realised the two articles I wrote were terrible, which wasn’t surprising considering how little time I had spent using Docker at that point. The more I used Docker, the more I realised I had totally missed the point. I had come to it with too many preconceptions, mostly relating to virtualization, that were leading me astray. I reached out to a few people (Gerald Venzl, Bruno Borges & Avi Miller) for help and advice, which got me back on track…

I’ve been playing around with Docker a lot lately, which has resulted in a few articles, with some more on the way. I’m not trying to make out I’m “the Docker guy” now, because I’m clearly not. I’m not suggesting you use my Docker builds, because there are better ones around, like these. I’m just trying to learn this stuff and I do that by playing and writing. If other people find that useful and want to follow me on the journey, that’s great. If you prefer to go straight to the source (docs.docker.com) that’s probably a better idea. 🙂

I do a lot of rewrites of articles on my website in general. This is especially true of these Docker articles, which seem to be in a permanent state of flux at the moment. Part of me wanted to wait until I was a little more confident about it all, because I didn’t want to make all my mistakes in public, then part of me thought, “sod it!”

If you want to see what I’ve been doing all the articles are on my website and the Dockerfiles on Github.

I’m having a lot of fun playing around with Docker. You could say, I’m having a “whale” of a time! (I’ll get my coat…)

Cheers

Tim…

Oracle REST Data Services (ORDS) 3.0.11 Released

If you’ve been following the right people on Twitter (Kris Rice, Jeff Smith, Colm Divilly, OracleREST) recently you will have seen ORDS 3.0.11 has been released.

This is a really neat release for us as we run ORDS on Tomcat. ORDS version 3.0.10 introduced a bug which broke it on Tomcat 8.5.x, so we had to switch to the Tomcat 8.0.x branch to use it. With ORDS 3.0.11 we have been able to switch back to Tomcat 8.5.x. Happy days! 🙂

Thanks to Colm for fixing this on the plane. 🙂

If you’ve not had a play with ORDS yet, you really should! I’ve written a bunch of stuff about it here.

Cheers

Tim…

PS. It also works on Tomcat 9. 🙂

Oracle REST Data Services (ORDS) 3.0.10 : Going down the rabbit hole!

Oracle REST Data Services (ORDS) version 3.0.10 was released last week. In addition to a bunch of bug fixes it was the first release to include the Auto PL/SQL feature.

Auto PL/SQL is similar to the AutoREST feature available for tables and views, but it allows you to enable PL/SQL objects for Remote Procedure Call (RPC) over HTTP(S). At this point you might be asking yourself what the difference is between REST and RPC over HTTP and I explain that here. Regardless of whether it is REST or not, it’s a nice convenience feature that I’m sure some people will find useful.

Over the weekend I went full on down the rabbit hole, which resulted in this article.

There are a number of issues with the current release and the docs for it, all of which have been fed back to the relevant parties, but on the whole I think it’s a neat first step.

My preference is still to define conventional ORDS RESTful web services rather than use this feature, but Auto PL/SQL may be just what some others are looking for and it’s always good to have options! 🙂

As far as the 3.0.10 release generally, I upgraded 4 non-prod installations to this release, all actively used for fronting APEX and RESTful web services and nobody has had a problem yet. 🙂

If you are yet to experience the joys of ORDS you can read the articles I’ve written about it here, as well as an introduction to JSON here.

Cheers

Tim…

Old Database Sessions and some more ORDS

I spent some time on two totally unrelated things at the weekend.

Old Database Sessions

We’ve been having some problems with old database sessions recently. One of our reporting servers seems to grab loads of sessions and just not let go. In many cases they seem to remain active for a long time, while doing trivial tasks. My first thought was it was a problem with the database, but there doesn’t seem to be any evidence of that. On occasion we’ve restarted the reporting server and everything has been fine for a few days. I have no control over this reporting server, so I took the pragmatic approach of killing old sessions. Yes, I know it’s an ugly solution, but it works.

I was planning on using a profile to do this, but found there were several applications using the same credentials for different purposes (I inherited this, it’s not my fault OK. 🙂 ), so the profile approach was not going to cut it. Instead I wrote some code to identify the dodgy sessions and kill them, then called this from a job. Ugly, but it worked!

On Saturday I received a Facebook message asking me how to handle this exact same issue, so rather than answer directly I decided to write it up as an article.

I didn’t put it on the front page of the website because it is a back-fill article, rather than bringing anything new to the table.

New ORDS Article

After my recent UKOUG Tech16 session, where I talked about how *I* think you should use ORDS, I wanted to give a better example than the simple CRUD examples seen in most articles. One of my points was RESTful web services against Oracle should represent what Mark Farnham would call Logic Units of Work, rather than a CRUD interface over a table. That resulted in this article.

It includes processing the JSON payload with JSON_TABLE and the APEX_JSON package.

Cheers

Tim…

Playing with Oracle REST Data Services (ORDS)

ordsI think it’s been about 18 months since I first wrote about installing ORDS 3, but since then I’ve done little more than dabble. For historical reasons, we are fronting APEX and exposing data as web services using Oracle HTTP Server and mod_plsql, which comes with its own set of pros and cons.

During the OTN Cloud Developer Day we were supposed to be using ORDS to expose our tables as web services, and my lack of ORDS experience was evident. 🙂 Since then I’ve been determined to take a proper look at ORDS. If you’ve been looking at the website homepage recently, you will know that process has started in earnest.

It’s by no means complete and the more I play with this stuff, the more rewriting I find myself doing, but I’m well on my way to understanding this stuff now.

For someone used to using mod_plsql and Data Access Descriptors (DADs), the authentication model and configuration of database connections in ORDS seems a little weird at first. I tied myself up in knots a few times before I understood it. While you’re getting to grips with this stuff, I would advise regularly flipping back to a clean VM snapshot, so you can approach things with a clean slate. I kept jumping to conclusions, only to find some of my results/issues were due to remnants of previous tests.

The official ORDS documentation is not the best. It’s like you need a decent grasp of the situation, or the documentation won’t make sense. Not that helpful when you’re coming to it fresh. 🙂 The documentation for the OAUTH and ORDS packages is pretty poor. I found myself just using trial and error to figure stuff out because stuff was just plain missing from the docs. I swear this is one of the examples.

Examples

The following example creates a .

EXECUTE ORDS.DEFINE_MODULE(

There are also things like this, which don’t really help.

Examples

The following example ...

EXECUTE ORDS.ENABLE_OBJECT((
   p_enabled      => ...,
   p_schema       => '...',
   p_object       => '...',
   p_object_type  => '...',
   p_object_slias => '...',
   p_auto_rest_auth => ...);

One of the last articles I did was the SQL Developer one, which in hindsight was a mistake. Some, but not all, of the SQL Developer screens allow you to see the package calls it is using to get the job done, which would have saved me a lot of time. Having said that, I probably learned a lot more because of the rough ride. 🙂

Like I said, I’m still learning so don’t give me a hard time if I’ve goofed up, but by all means drop me a line if you spot any mistakes and I’ll correct them. 🙂

Cheers

Tim…

PS. Jeff Smith just reminded me that SQLcl can export ORDS module definitions, so I’ve added it to the SQL Developer article here.

PPS. Added in the SODA functionality also.

Oracle REST Data Services (ORDS) 3.0 on Tomcat 7

What started out being a quick dabble with Oracle REST Data Services (ORDS) 3.0 spawned a bunch of different things…

First, I needed a fresh APEX installation to play around with. Most of the APEX stuff I’ve been using recently has been against Oracle 11.2 databases and I follow this kind of method. Standard stuff…

That’s fine, but the default installation of APEX in Oracle 12c multitenant environments splits APEX between the CDB and the PDBs. On the surface that sounds like a good thing. Installing APEX multiple times sounds like a waste right? In practice, this “shared APEX” situation is a complete pain in the ass and I hate it. So the first thing I now do on a new installation is to remove the shared APEX stuff. That spawned this note.

It’s actually a pretty important decision, because Oracle don’t support removal of APEX from the CDB once it has PDBs, so you will be faced with a bunch of unplugs and administration if you change your mind later. Having to decide up front if you may want to do something later is a total fail in my book. I hope Oracle scrap this shared APEX setup. I would prefer to see people create a new PDB from the seed, install APEX into it and use that as a seed for new PDBs. Effectively building their own gold-image seed… That’s my little rant over. 🙂

Next thing I needed was a Tomcat installation. Despite the ORDS 3.0 documentation suggesting Tomcat 7, I started with Tomcat 8. Word to the wise, it doesn’t work, at least not by just following the ORDS install docs anyway.

Since I was having problems with the ORDS installation on Tomcat 8, I switched back to the recommended Tomcat 7. This wasn’t so much a case of RTFM as a case of BTFM. The “B” is for Believe. 🙂

Once I switched to Tomcat 7, the ORDS installation went just fine. Here is a note about that…

So now we are four articles in and I’m just about able to start the thing I wanted to actually test. 🙂 Like I said, a quick dabble spawned a bunch of different things… 🙂

Cheers

Tim…