Close

Strange (erroneous) query from Oracle Audit Vault

Today I was asked about a query from an Audit Vault job that was failing. Unfortunately, the job didn’t report any useful error messages to explain the failure. After some digging the problem was narrowed down to a query pulling user account information. In particular, a calculated column was proving both erroneous as well as…

How to use DBMS_LDAP (part 5: Timeouts)

Table of Contents Introduction Establishing a Connection Searching Hierarchical Data Browsing Attributes Timeouts (this page) Modifying Data Timeouts LDAP servers are designed to be fast; but it is still possible for an action to take a long time. A deep sub-tree search with an open search criteria could require from seconds to even minutes to…

How to use DBMS_LDAP (part 4: Attributes)

Table of Contents Introduction Establishing a Connection Searching Hierarchical Data Browsing Attributes (this page) Timeouts Modifying Data Searching Hierarchical Data with Attributes Returning attributes with search results The examples in the prior chapter use the “1.1” code to return no attributes. In this example we’ll return two of the attributes associated with an entry. Instead…

Unplug PDB from 12.2 CDB and Plug into 18c CDB

Last week the 18c Linux on-premises software was released for download. So this weekend I installed it on my test server and gave it a whirl. The software installs themselves went smoothly and then it was time to do an upgrade. Below I’ve capture the steps and output of an upgrade by unplug/plug from older…

BACKUP_TYPE changes with 12c RMAN

I was working on a report from our RMAN catalog and found I was having trouble reconciling the data I found in RC_BACKUP_SET with what I was expecting to see. Furthermore I couldn’t find anything in the Reference Guide to adequately explain what I was seeing. In particular I’ll reference the descriptions of the BACKUP_TYPE…

LTRIM, RTRIM, and TRIM

The trimming functions in Oracle frequently are used by many developers; but not all know the full set of options available and how they compare to each other. Sometimes I need to remind myself so this post is as much for me as for others. I hope you find it helpful. The LTRIM and RTRIM…

How to use DBMS_LDAP (part 2: Connecting)

Table of Contents Introduction Establishing a Connection (this page) Searching Hierarchical Data Browsing Attributes Timeouts Modifying Data Establishing a Connection The DBMS_LDAP.INIT function is used to connect to an LDAP server. On success, the function returns a session handle of DBMS_LDAP.SESSION type. FUNCTION init (hostname IN VARCHAR2, portnum IN PLS_INTEGER ) RETURN SESSION; DBMS_LDAP.PORT is…

How to Use DBMS_LDAP (part 1: Introduction)

Introduction In 9iR1 (9.0.1) Oracle released the first version of DBMS_LDAP. Between then and 18c the package has received a few enhancements including support for BLOBs, Basic Encoding Rules (BER,) and NLS character set conversions. The documentation for the package has alwasy been somewhat terse, especially if you’re unfamiliar with LDAP structures and usage. I’ve…

My KScope2018 slides

Finally getting around to posting these, sorry about the delay. My powerpoint slides can be downloaded here. Some of the slides included simplified queries so the text would fit on a single screen and remain legible. To find who is using temp, a more functionally robust query can be found here: /2018/03/08/who-is-using-temp-and-what-are-they-doing/ Similarly, the who…

18c JSON TO_UTC_TIMESTAMP_TZ bug

I tried the following query on 18c via Oracle’s LiveSQL site and the results don’t correspond to the documented functionality; or, at least, not my reading of the functionality. select to_utc_timestamp_tz(‘2018-04-27’) t from dual union all select to_utc_timestamp_tz(‘2018-04-27T17:40:25+00:00’) from dual union all select to_utc_timestamp_tz(‘2018-04-27T17:40:25Z’) from dual union all select to_utc_timestamp_tz(‘20180427T174025Z’) from dual union all select…

How big is a table?

I’ve been asked this question in various forms and forums over the years and the askers are often surprised when I tell them there is more than one way to answer that question. Furthermore, each method yields a different but not necessarily wrong answer! First, let’s take a simple, maybe even obvious method: SELECT avg_row_len…

Who is using TEMP and what are they doing?

TEMP can be a difficult resource to manage in mixed workload environments. You might have sufficient space to run a few big sorts or aggregates; or maybe you have enough space to run lots of concurrent sessions each of which consumes a little bit. But then you get the occasional overlap and there just isn’t…

Who is blocking whom and what are they doing?

A fairly common question I get as a DBA is tracking down which sessions are blocking others. Fortunately the v$session view has the blocking session (as of 10.1) and instance of that session (as of 10.2) included. Since a blocker could itself be blocked by yet another session, I use a hierarchical query to determine…

Oracle 18c Documentation is now available on OTN!

https://docs.oracle.com/en/database/oracle/oracle-database/18/index.html Definitely interested in looking into the json functionality https://docs.oracle.com/en/database/oracle/oracle-database/18/adjsn/changes.html#GUID-8C9B00DD-45D8-499B-919C-8632E034B664 and digging in more with analytic views https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/Changes-in-This-Release-for-Oracle-Database-SQL-Language-Reference.html#GUID-9D1C204A-91C3-4B8D-A882-374F78118862

Using Object Types: constructors

When an object type is instantiated (i.e. assigned a non-null value) it will execute initialization code. This initialization code is called a CONSTRUCTOR function. Every object type includes an implicit constructor which simply assigns values to the object attributes according to the values provided in the object assignment. For example: CREATE OR REPLACE TYPE simpleobject…

Using Object Types: consolidating multiple values

A lot of developers see Object Types as confusing, esoteric, or simply unrelated to their SQL work.  To be fair, some objects can be quite complex and some of the data cartridge (ODCI) features will never find a home in some developer’s applications. But, that still shouldn’t preclude an examination of some of the fundamentals…

MERGE, Triggers, and Statement Restart

The MERGE command in Oracle is a great tool for modifying data in a table; efficiently solving the old problem of insert collisions and updates of non-existent rows. Most of the time we use it becaue it “just works.” But, what really goes on when you issue a merge? In particular, which triggers fire? How…

PBKDF2 in Oracle 12c

When I wrote my article on Oracle passwords I included a small, limited implementation of the PBKDF2 algorithm in order to illustrate the 12c hashing methodology.    Here I’m publishing a fuller implementation with parameters for determining the derived key length, number of hashing iterations, and a choice of hashing methods (SH1, SH256, SH384, or SH512.) …

Missing peaks in ASH results

The ASH charts in OEM are great utilities for getting a quick summary of your system’s activity. However, these results can be misleading because of how the data is represented on screen. First, ASH is data is collected by sampling so it’s not a complete picture of everything that runs. Another thing to consider is…

Finding the name of an Oracle database

Oracle offers several methods for finding the name of a database. More significantly, 12c introduces new functionality which may change the expected value from some of the old methods due to the multi-tenant feature. Here are 11 methods for finding the name of a database. SELECT ‘ora_database_name’ method, ora_database_name VALUE FROM DUAL UNION ALL SELECT…

How Oracle Stores Passwords

Several years ago I wrote a small summary of the Oracle password hashing and storage for versions up to 11g. Today I’ve completed my update of that article up to 12.1.0.2, including code to mimic generation of passwords given the appropriate salts. The initial publication is in PDF format, I may convert and reformat it…