Putting Data Guard traffic on dedicated network interface

I recently had an interesting challenge to direct data guard network traffic over a dedicated network interface and not go though the main network routes. The reason was that in order to reach the remote datacenter, the dataguard traffic should be sent via WAN optimizer network, that will automatically compress and dedup all traffic (hard to believe, that there are still some places left in Europe, where internet bandwidth is extremely expensive). I know that (more...)

Setting up SQL Developer with Instant Client on MacOSX

Since I started a new job I also wanted to try out MacBook as my new laptop. I've never been a Mac user, but there seems to be a large group of people who think Macs are the best, so I needed to find out the goodness of Macs myself :) A quick tip: Don't upgrade to Yosemite if you laptop is bound to Active Directory.

One part of setting up my new laptop was (more...)

Script to delete multipathed ASMLIB storage devices from Linux

Before storage device can be removed (or unassigned) from server, it must first be removed from Linux. This is even more necessary if the server is running Oracle ASMLib, because if there are any removed or read-only storage devices present when running service oracleasm scandisks, the command will just hang and server load will start to increase (maximum I've seen was 3500).

Here you find RedHat instructions on how to cleanly remove storage devices (more...)

Sample code: Using the Oracle ZFS Storage Appliance REST API from Python

Most (all?) of the Oracle ZFS Storage Appliance (ZS3-4 in my case) management functions are also exposed through REST API so it is possible to script and automate the storage management tasks. No proprietary clients or GUI needed, just need to write a simple script that can send some REST commands over HTTPS to the appliance and parse the JSON output.

I had a task of automating test database refresh from production and part (more...)

12c metadata only default values for NULL columns part 2

Yesterday I attended #cluboracle event in London (I highly recommend this event! ... but I don't recommend Thameslink train service :) ). In this event one interesting discussion popped up regarding 12c. I've already written about this feature, so in this post I'll clarify some points as I understand them and test out a few more things.

Here is a quote from my last post summing up my findings so far:

This new column seems (more...)

Slides from OUGE Meetup #3

I gave a talk about my highlights from Oracle Open World 2014 and how to use CloneDB in Oracle User Group Estonia Meetup #3. It was a really good meetup and thanks to everybody who attended.

Here you can find the slides

Structured XML output from Oracle SQL query

Got an interesting question today: There are tables TABLE1, TABLE2 and a junction table that joins them called JUNCTABLE. Need the following output as XML



I know the output could be aggregated using XMLAGG, but I have never looked into how to format the tag names and attributed in the output like requested.

Data in my very simplified sample tables:

SQL> select * from table1;


SQL> select * from table2;


OUGE Meetup #3

If you are in Estonia, then join our Oracle User Group Estonia Meetup #3. I'll talk there about my latest trip to Oracle Open World, what I heard there and also I'll present how to use CLONEDB feature.

Register here:
Facebook or Meetup.com.

ORA-01511, ORA-01141, ORA-01110, ORA-17503, ORA-17515 and ORA-06512 when executing dbms_dnfs.clonedb_renamefile

This post is for those who google the errors and maybe it will help to save some time. I've been playing around with clonedb for some time now and every time I hit these errors it takes me some time to figure out what actually the problem is :) The error messages are not really helpful at all. Maybe I'll remember it now.

When creating a new clone database using clonedb then after creating the (more...)

DBMS_UTILITY.EXPAND_SQL_TEXT and temporal validity in 12c

12c gave us two new features among others: DBMS_UTILITY.EXPAND_SQL_TEXT and temporal validity. DBMS_UTILITY.EXPAND_SQL_TEXT is advertised as a means to expand SQL text that is using views, but it is also very useful to see how Oracle internally rewrites some SQL queries. Here I'm going to use it to see how temporal validity queries are actually executed. All tests are done using Enterprise Edition.

First I'll create a table for (more...)

12c metadata only default values for NULL columns

Before 11g if you added a new column to a table then Oracle had to lock and physically update all rows in the table. Possibly a painful process :) 11g helped with that a little, giving metadata only default values for NOT NULL columns, so the change was done only in data dictionary, not in the table data.

SQL> create table default_values (
  2    id number primary key
  3  );

Table created.

SQL> insert into  (more...)

Cloning pluggable database with custom snapshot

When cloning pluggable databases Oracle gives you also SNAPSHOT COPY clause to utilize storage system snapshot capabilities to save on storage space. But it works only when datafiles are placed on ACFS, ZFS Appliance over DNFS or Netapp (Oracle Multitenant Pluggable Database Snapshot Cloning: Use Cases and Supported Platforms Doc ID 1597027.1) and you also cannot unplug/drop the source PDB and you also cannot unplug the clone PDB.

Recently I've started to like BTRFS (more...)

Database upgrade using pluggable databases and how catctl.pl fails if you have custom login.sql

I started to write this blog post on how 12c gave us new multitenant architecture (pluggable databases) and with that also a new possibility to do database upgrades. But during writing I discovered how catctl.pl can fail the upgrade if you have modified the SQL plus prompt with custom login.sql.

I'm starting with these already created databases:

cdb1/u01/app/oracle/product/ initial container with version 12.1.0. (more...)

Free seminar in Tallinn, Estonia: “Developing modern applications using MySQL” with Ronald Bradford

Fre MySQL seminar on 27. august 2014 @ 13:00. Announcement by Oracle User Group Estonia:

Developing modern applications using MySQL.

In this seminar series learn how to best use MySQL for your existing and new development requirements with leading MySQL expert and Oracle Ace Director Ronald Bradford.

These presentations provide a detailed review of the essential lifecycle components for developing a successful software application and offer a checklist for your company to review the (more...)

Oracle User Group Estonia meetup and other speaking arrangements

I know it is a little late announcement, but Oracle User Group Estonia is having its first meetup after many years tonight. I'm presenting there "Making MySQL highly available with Oracle Grid Infrastructure".
More info and registration here: http://www.meetup.com/Oracle-User-Group-Estonia/events/165539962/.

So if anyone is in Tallinn today, then join us!

I'm also speaking at Oracle User Group Norway 2014 Spring conference (3-5 April 2014), topic "Making MySQL highly available with Oracle Grid Infrastructure". It (more...)

Sample code: Using Datapump API for metadata and data filtering

I was looking for PL/SQL examples to use metadata and data filtering in datapump API, but I didn't find any. So here is one example. It uses table reload_dev_tables to specify what schemas/tables should be exported using data pump and what where clause should be set.

Structure for reload_dev_tables:

 Name                                       (more...)

Exploring DBVisit Replicate

There are a few Oracle database replication solutions on the market:

  • Oracle Streams (powerful, included with RDBMS license (Oracle SE has trigger-based capture, EE mines redo logs and log buffer), but deprecated - no longer developed, complex to manage)
  • Oracle GoldenGate (powerful, but very expensive)
  • Tungsten (heterogeneous, but from Oracle (more...)

Binding IN-lists as comma-separated values

One link that I have to send to developers quite frequently is how to use XMLTABLE in SQL queries to bind comma separated list of values instead of generating large IN list directly to the query (and this way avoid new sqlid/cursor/wasted memory for each different value combination provided). The link that I usually send is this, but in this post I'd like to expand it a little, so it would work even when the string contains special XML characters.

For numbers, the usage is simple:

> var num_list varchar2(100)
> exec :num_list := '2668,2669,2670'

PL/SQL procedure successfully completed.


Using SSL client certificates for authentication in UTL_HTTP

Starting from 11.2 its possible to use SSL client certificates to authenticate yourself to a remote web service using SSL client certificates. I did not find much information on it using Google or documentation, that is why I'm writing this post.

Please refer to this post by Tim Hall to get started on connecting to HTTPS service using UTL_HTTP, all of this is needed before continuing with SSL client certificate authentication.

The first thing you need is to generate user certificate request inside Oracle Wallet, sign it by CA and load the returned certificate back to Wallet. I'm not (more...)

A little “side-effect” of having autocommit off in MySQL

Back-story: A developer came to me and wanted explanation for a weird behavior in MySQL. They inserted a record (to InnoDB table), committed, and after receiving a message (on another application) tried to read that inserted record immediately, but the newly inserted record was not found. Problem only happened in production, but not always (quite frequently).

After comparing the MySQL parameter files between production and development environments I discovered that in production autocommit was disabled to make MySQL behave more like Oracle. This setting was removed from development after we rebuilt the environment (to use multiple MySQL instances with Oracle (more...)