Skip to main content

Posts

But... we already have tools for explain plan

There are already ways to see execution plan This is very true. And for day to day use, they are more then sufficient.

But sometimes the tools don't show the functions/conditions correctly.
And some details are never present (e.g. in complex plans with multiple materialized subqueries, it's sometimes impossible to determine from which copy of a table/subquery a column comes).

(And out of scope of this series, you may want to see bind values, or to know which line in the plan you are on = which (copy of) table is oracle just reading.)

Examples in this blog are necessarily simple ones; and in such examples we see cases where the added value of such access to execution plan is not very high. But never forget that this can be extended to much more complex cases.
Existing tools EXPLAIN PLAN EXPLAIN PLAN is long time with us. The main problem is that it shows plan for a new parse - and this can be different than what a session is actually executing, as it depends on bind types and…
Recent posts

Reading data from PGA and SGA

Overview For our investigation of execution plan as it is stored in memory, we need in the first place to be able to read the memory.

We have the options of
x$ksmmem, reading SGA using SQL. Personally I don't like it, it's cumbersome and slow.direct SGA read: obviously reading SGA only; it's fast and easy to doread process memory: can read PGA, process stack - and since the processes do map the SGA, too, you can read it as well. Unfortunately ptrace sends signals to the processes and the process is paused when reading it, but so far all my reads were short and fast and the processes did not notice. Some OS configurations can prevent you from using ptrace (e.g. docker by default), google for CAP_SYS_PTRACE.gdb: using your favorite debugger, you can read memory as well. Useful when investigating. Direct SGA read I always considered direct SGA read of some dark magic, but the fundamentals are actually very easy. It still looks like sorcery when actually reading the Oracle in…

Reading execution plan from SGA and PGA - teaser

Some of you have seen my presentation about hidden parts of Oracle execution plans and how to access the plan in the memory directly and parse it. I presented it at OakTable World 2017  and it will be also presented in Wellington and Acukland this November.  You can download the presentation at http://vitspinka.com/files/ReadingPlanFromSGA-OTWatOOW-2017.pdf.


I realize that many people did not have the chance to attend... and that the slides need quite a lot of explaining, it's hard to understand this internals without more explanation.


Thus you can look forward to seeing a handful of blog posts, inspired by this presentation, and explain some of the aspects of this whole topic.

We will start with some basic tools; accessing SGA and PGA, which you may find useful for many other tasks, too. Then we will look at some details of the execution plan. This is not - and neither the presentation is - an exhaustive guide to the execution plan internals. It would be a multi-year project to t…

Oracle 12cR2 Multiteant book is out!

After all the waiting, the book is out! Available for example on Amazon, both as Kindle ebook and as a paperback.
You can see the actual table of contents in the Amazon preview; in short, it covers the whole range of multitenant related topics. Both multitenant-specific, as well as the old and proven features, that were updated to work with a multitenant database.

With a bit of luck, you'll get the book sooner than me - my copy is still somewhere in the mail :-)

Small updates: Oracle ACE Associate; and the upcoming book

A short update - I am now an ACE Associate, spreading the good word on Oracle technology:-)

Another update is the upcoming book: I am co-authoring book on the Multitenant option in Oracle 12cR2. The book is for pre-order on Amazon (unfortunately Amazon seems to have troubles with putting my name there, grrr...).

The original planned date was sometime around Open World 2016, but apparently nobody knows where 12cR2 will actually come out (and due to NDA, the book can be published only after 12cR2 is released to public), so there is now no estimated date at all. We just have to wait.
However, the book is really taking shape, all of the contents is written and we are now finishing reading the proofs, catching last typos and mistakes.

So stay tuned for 13 chapters or 400 pages or so, focusing all on Multitenant - and there is a lot of things to cover!

PDB saving state does not save its state on shutdown

When 12.1.0.1 came out, one of the gripes was that upon a CDB start, all the PDBs were in the mounted mode. The DBA had to open them manually, or use a database trigger to do that.

12.1.0.2 introduced SAVE STATE - according to the docs:
For example, if a PDB is in open read/write mode before the CDB is restarted, then the PDB is in open read/write mode after the CDB is restarted; if a PDB is in mounted mode before the CDB is restarted, then the PDB is in mounted mode after the CDB is restarted.
The trouble is that this is simply wrong, it does not work like this. Oracle has a table externalized as  DBA_PDB_SAVED_STATES and this stores the state. The table is updated only by the SAVE STATE command - and reflects the status when the SAVE STATE was issued, not when the database goes down.
It simply stores the open mode of the database and the CDB will open the database in this mode when the CDB opens. Lack of a row implies MOUNTED mode, i.e. the CDB won't do anything.
The row is dele…

Small addendum to the lying (Data Guard) broker

A friend of mine (Deiby Gómez) pointed me to an interesting article on MOS 1956103.1 - Warning: standby redo logs not configured for thread on db_unique_name/db_unique_name.

It essentially describes the same issue I described in
Don't trust the lying (Data Guard) broker - the newly created SRLs are not assigned to a particular thread and the VALIDATE command does not like it, although the standby is perfectly happy and will grab the SRLs as necessary, as it always did before 12c.

The Metalink note adds a solution - to assign the the SRLs to the threads manually during creation. The syntax is
alter database add standby logfile thread 1 group 1 'file spec' size .... This thus disables the auto-assign to the thread that needs it, but that should not matter. We usually size all the threads uniformly and assign enough SRLs to all of them, in other words we expect even distribution of SRLs to threads. Thus doing it manually is not a bad thing.