Friday 21 May 2010

Spandrels

If your interests include data warehousing, travel and architecture then you need to start following Dai Clegg's new blog.  Dai was until recently my boss at Oracle, and this blog is part of his legacy, as he encouraged me to start blogging about the database features in JDev so that they could reach a wider audience.

Dai has a great way of linking together concepts from different fields, which often came out in our discussions, and which I'll miss a lot.  For example, I don't quite remember how Brunelleschi's dome related to the architecture of the Database API, but somehow it did, and we had a very entertaining conversation about it!

Thursday 13 May 2010

Copying, Comparing and Reconciling Database Models

Before I talk some more about version control with Subversion, I wanted to demonstrate how JDeveloper can be used to create a copy of an offline database model, as well as compare and reconcile models.

As you might remember from previous posts, the Copy Database Objects to a Project wizard can be used to copy or import database objects from a database to an offline database.  This tool can also be used to copy objects from one offline database to another to create a copy of model.

The ROOTS schema lives in an offline database called DATABASE1.  I'm going to use the wizard to create a complete copy of that offline database.  First I create a new offline database called DATABASE2 by right-clicking on the Offline Database Sources node in the Application Navigator and selecting "New Offline Database...":


Now I right-click on DATABASE2 and select "Copy to Project...".  The first thing I need to tell the wizard is where I'm copying objects from (i.e. the source).  When I used this wizard before, I picked a database source, but this time I'm going to choose a project and offline database (DATABASE1):


In the next page of the wizard, I choose the target, which is the newly created offline database, DATABASE2:


In the next page, I select the objects I want to copy (let's have all of them):


Finally, I choose to CREATE these objects in the new offline database, since I know it's completely empty:


I press the "Finish" buttton, and a few moments later, the Application Navigator shows that DATABASE2 contains a copy of the ROOTS schema:


To show how model compare and reconcile works, I'm going to work on the copy of the offline database, DATABASE2, removing the ACTIVE column on the ROOTS_USERS table, along with its associated constraint.  Once I've done this, I can run the Copy Database Objects to a Project wizard again, choosing the offline database DATABASE1 as my source, and DATABASE2 as my target, and again selecting all the objects.  This time, when I get to the "Choose Operation" page of the wizard, I'm going to choose ALTER with Manual Reconcile.  Going to the next page shows the reconcile UI:


The DATABASE1 model is on the left hand side, and DATABASE2 is on the right.  As you can see, the ACTIVE column and it's associated constraint are missing from DATABASE2.  If I wanted to reconcile the models, I could shuttle the ACTIVE column and the constraint over to the right hand side.  Unlike the Generate SQL from Database Objects wizard, this wizard will not generate DDL, but will action those changes directly against the target DATABASE2 model.

Tuesday 4 May 2010

Marginal Boundaries

A friend of mine has been working hard to launch Marginal Boundaries, a quarterly e-zine which specializes in speculative fiction.  If you enjoy this kind of writing, check out the first issue, which is now available.  There are some excerpts on the site to give you a taste of what's included.