Oracle Primary Key Sequence Performance

With Oracle 12c, Oracle introduced a new way to insert primary keys into tables: The GENERATED BY DEFAULT and DEFAULT keywords.

In this post, I want to compare the performance of different methods to insert a primary key into a table in Oracle. The comparison will also include older methods, such as using a trigger or specifying the primary key in the INSERT statement. These methods can also be used in Oracle versions earlier than 12c.

First of all, let’s look at the possible ways to insert the value of a sequence into a table:

Read the rest of this entry

Parameters of Pluggable Databases

When working with the new multitenant architecture of Oracle 12c, one is often confronted with questions like “Ok, is this or that possible in the pluggable database? And where is that value stored?”. In this article, I want to show you where the parameters of the pluggable databases are stored. Hint: there is no SPFILE for a pluggable database!

Consider the following container database (CDB), named “cdb2”, with the following pluggable databases (PDBs). Using SQL*Plus, connected to the CDB, we can issue show pdbs to get a list of the PDBs and their status:

Read the rest of this entry

ORA-01722 during upgrade 10.2 to 11.2

As we are migrating the last databases from Oracle 10gR2 to the latest 11.2.0.4 release, there are some errors that we stumbled upon along our way. For example, when we tried to upgrade one particular database, during the upgrade the following error was thrown:

SQL> SELECT TO_NUMBER('DATA_VAULT_OPTION_ON') FROM v$option
  2   WHERE
  3    value = 'TRUE' and parameter = 'Oracle Database Vault';
SELECT TO_NUMBER('DATA_VAULT_OPTION_ON') FROM v$option
                 *
ERROR at line 1:
ORA-01722: invalid number

Ouch. That is something that you do not want to see during an upgrade! Needless to say, the upgrade won’t continue here, so how to fix this?

Well, basically this is a well-known error, and there is MOS note 1409844.1 that describes how to fix the problem: Catupgrd Returns : Ora-01722 Select To_number(‘DATA_VAULT_OPTION_ON’) From V$option

Read the rest of this entry

Connect to a PDB using SID

To connect to a PDB, you have to use the service name of the pluggable database. But what when there is an older legacy application that can only use an SID to connect to a database? And what if we just migrated an older legacy database to a PDB? When starting the application, you might see something like:

ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

There is a parameter called USE_SID_AS_SERVICE_listener that can be used to tell the listener to handle SIDs like service names. So the listener will interpret the SID given in the connection as a service name and will then connect you to the database.

Read the rest of this entry

Oracle 12c: AFTER STARTUP trigger to open PDBs

Update: Starting with Oracle 12.1.0.2, it is possible to save a PDB state so this workaround is no longer necessary.

When starting up an Oracle 12c database with pluggable databases, the pluggable databases in a container database are not automatically opened, just placed in MOUNT mode. This can be a problem in some cases.

To automatically open the pluggable databases on startup, you’ll have to create an AFTER STARTUP trigger in the CDB. For my own reference, I will post such a trigger here:

CREATE TRIGGER open_all_pdbs
AFTER STARTUP ON DATABASE
BEGIN
     EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
END open_all_pdbs;
/

libsqlplus.so: cannot open shared object file: No such file or directory

Recently I had to install SQL*Plus on a Linux host. In order to do so, I downloaded the appropriate Oracle Instant Client packages from the Oracle site. For my installation, I chose the ZIP files. After I unzipped the client and tried to run sqlplus, I go the following error:

simon@pandora instantclient_11_2$ ./sqlplus
./sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

Hmm. When I checked the directory with the sqlplus binary, the file libsqlplus.so was clearly there.

Read the rest of this entry

Oracle Database 11g Administrator Certified Professional

I am happy to report that I finished my Oracle Certified Professional certification this Monday by taking the “1Z0-053 Oracle Database 11g: Administration II” exam. So officially, I am now a “Oracle Database 11g Administrator Certified Professional”.

Oracle Database 11g Administrator Certified Professional

While this certificate is certainly nice to have, I still think that there are many topics of Oracle Database that I still have to explore. So stay tuned for more insights in this blog :).

ASM: Device “/dev/xvdc1” is already labeled for ASM disk “”

In preparation for my OCP examination, I am currently playing around with ASM. For this purpose I am using an AWS instance to install and configure my database. So I added my disks, partitioned them using fdisk and installed ASMLib to manage them. But when I wanted to issue the createdisk command, this happened:

[root@ip-10-234-66-103 ~]# oracleasm createdisk DATA0 /dev/xvdc1
Device "/dev/xvdc1" is already labeled for ASM disk ""

So what is the problem here? Before deciding to use ASMLib, I tried to add the disks using only ASM commands from within the ASM instance, which failed for some reason. This is why I then switched to ASMLib.

Read the rest of this entry

Oracle 12c response file example

So all my Oracle software installations are done by using response files. I already wrote a blog post about the response file format for Oracle 11gR2 and put my Oracle installation scripts on GitHub.

In this article, I want to show a few response file examples for Oracle 12c (specifically, 12.1). These files were copied and modified from an Oracle Database 12.1 installation archive. You can find more information on response files in the Oracle documentation.

Read the rest of this entry

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Elsewhere

  1. GitHub
  2. LinkedIn
  3. GitLab