OpenShift: List all pods in cluster

I recently started working with OpenShift and needed to get a list of all pods on the cluster. I quickly glanced at the documentation but could not find what I wanted. My colleagues quickly pointed me in the right direction:

oc get pod --all-namespaces -o wide

Here is the command with some example output of what to expect:

# oc get pod --all-namespaces -o wide
NAMESPACE                                 NAME                                                       READY     STATUS               RESTARTS   AGE       IP               NODE
my-project                                my-pod-43-d9mo6                                            1/1       Running              0          1d        192.168.0.183    node3.krenger.local
yet-another-project                       another-pod-43-7g3r0                                       1/1       Running              0          2d        192.168.0.184    node4.krenger.local
[..]

If you just want to know which pods are on a certain node, use oc adm manage-node:

oc adm manage-node node3.krenger.local --list-pods

Java Service Wrapper 3.5.29 for Windows x64

After returning from my vacation, I was asked to provide the latest version of the Tanuki Service Wrapper. Unfortunately, I only have a Windows Server 2003 R2 and a Visual Studio 2008 license. This means I cannot provide newer Java Service Wrappers than 3.5.29, because Tanuki added new features only available with Windows Server 2008 SDK and beyond.

Update: Due to a generous donation of a VS2008 license, I will be able to provide newer versions. Thank you very much!

Read the rest of this entry

DBA_INDEXES and DBA_SEGMENTS mismatch

This is a fun one.

We developed a script to process certain indexes on a database somehow, it kept missing some of the indexes that clearly existed. We then found the problem: DBA_INDEXES had more entries than DBA_SEGMENTS. See the following example:

SQL> SELECT owner, index_name as i_name from dba_indexes WHERE owner = 'SIMON'
  2  MINUS
  3  SELECT owner, segment_name as i_name FROM dba_segments WHERE owner = 'SIMON';

OWNER                I_NAME
-------------------- --------------------------------------------------
SIMON                IDX_...
SIMON                IDX_...
SIMON                IDX_...
SIMON                PK_...
SIMON                PK_...
SIMON                UNQ_...
SIMON                UNQ_...

7 rows selected.

So here we see that there are clearly indexes for which there are no segments. We then looked at the tables where these indexes are located and noticed a particular thing: All the corresponding tables for these indexes were empty.

So the reason for this behaviour is called “Deferred Segment Creation“. This means that when a “CREATE TABLE” statement is issued and no rows are inserted, there are no segments that are created. This behaviour can be controlled by the DEFERRED_SEGMENT_CREATION parameter.

This makes sense in large schemas, where not all tables are populated. Instead of having segments created and extents allocated, only the definition of the table is saved. As soon as the table has at least one row, the segments are automatically created.

Find password for database link

Alright, so when we need to recreate a database link for some reason and we do not happen to have the password handy, we’re usually stuck. However, sometimes there is a way to recover passwords for database links.

The method described below only works for the “old” password versions (<= 11.2.0.2)!

Starting with Oracle 11.2.0.2, Oracle salts the password hashes, therefore you will need to crack the password and cannot just query it. However, if the database link was created pre-11.2.0.2, the password is saved in an “old” format without the salt. To check if there are any database links with this old format, query SYS.LINK$ like so:

Read the rest of this entry

RMAN “set until time” example

So here is another post I will keep just for my own reference.

Whenever I need to perform an incomplete recovery of the database, I usually use the SET UNTIL TIME to specify the time for an incomplete recovery. Sadly, when NLS_LANG is not set properly, the time format that needs to be used is not something I can remember.

So here is an example for using SET UNTIL TIME with a sane time format:

run {
set until time "to_date('22-APR-2015 13:30:00','DD-MON-YYYY HH24:MI:SS')";
restore database;
recover database;
alter database open resetlogs;
}

You can find more examples in the Oracle documentation.

csqlplus: New website

Last week, I launched a new website for my csqlplus project.

What is csqlplus, you might ask. The csqlplus script is a wrapper for SQL*Plus and will allow you to query multiple databases at once, so bascially a SQL*Plus for clusters:

Often, Oracle database administrators need to run commands on multiple databases at once. With csqlplus, a wrapper for the sqlplus command, a DBA can quickly query multiple databases simultaneously.

Basically, csqlplus is a simple wrapper script to call sqlplus for all databases specified in a file.

You can download the script from the website www.csqlplus.org.

Oracle 12c: RMAN Catalog must be Enterprise Edition

While upgrading an environment to Oracle 12c, one thing that needs to be done is to upgrade the RMAN catalog. One change introduced by Oracle is that there are new features used in the version 12 RMAN catalog. So if you try to upgrade an RMAN catalog running on Oracle Standard Edition, you will encounter the following error:

RMAN> upgrade catalog;

error creating create_deleted_object_seq
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06004: ORACLE error from recovery catalog database: ORA-00439: feature not enabled: Partitioning

Mike Dietrich from the Oracle Upgrade blog has written an excellent article concerning this issue. Most specifically, MOS Note 1927265.1 notes implicitly that Enterprise Edition is a requirement:

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