Select Page

Converting Hexadecimal Oracle SCNs to Decimal

Jeremiah Wilton | | November 19, 2009

Oracle serializes transactions and manages concurrency and recovery using an ever-increasing number called a system change number, or SCN. Usually, we see these numbers expressed in decimal, in places like the v$ views and the alert log. Occasionally, however, Oracle’s code expresses SCNs in hexadecimal. Unfortunately, you can’t just perform a straght conversion from hex to dec to express these hex SCNs in dec. Here is the same Oracle SCNs expressed in hex and dec:

0x952.f5e60bda
10251917462490

Thanks to Tanel Poder’s generous assistance, I learned how to convert this kind of SCN to decimal.

The first portion of the hex scn is the number of times the second portion has reached the maximum value (ffffffff), and started back at 00000001. We’ll call it “wrap.”

The second portion of the hex scn is the base SCN value that increments one with each new change. We’ll call it “base.”

The formula for converting the hex SCN to dec would therefore be:

decimal = wrap * 232 +  base

I write a Unix shell on-liner to do the conversion:

$ a=0x952.f5e60bda;echo $((${a%%.*}*4294967296+0x${a##*.}))

Just replace the hex SCN I used in the example with your own.

Subscribe to Our Blog

Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.

Art of BI: BI Publisher (BIP) Quick Guide and Tips

Read our blog post on how to take over production support of BI Publisher reports.

Sherry Milad | January 15, 2018

Art of BI: How to Add Comments in Oracle BI (OBIEE)

Ultimately the goal of commentary in OBIEE is to have a system for persisting feedback, creating a call to action, and recognizing the prolific users.

Christian Screen | December 29, 2013

Art of BI: Uninstalling WebLogic Not Working on Windows OS

It isn’t often that one has to go about uninstalling WebLogic, the main application server for Oracle Fusion Middleware, when implementing Oracle BI or the EPM suite.

Christian Screen | September 10, 2013

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.

CONTACT US

Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.

EXPLORE JOBS