Просторы интернета

19 Февраль 2015
Earlier
Чт, Июл 13, 2017
на physical standby / ADG instance в виде: , как нам с Максимом Филатовым удалось выяснить, вызывается установкой параметра: и, соответственно, лечится (по рекомендации техподдержки): В общедоступном описании бага: о параметре не упомянуто, в то время как в документах типа ORA-1555 Error With Query Duration as 0 Seconds (Doc ID [...]
Source: iusoltsev.wordpress.com
Ср, Июн 28, 2017
SQLCODE and SQLERRM

SQLCODE and SQLERRM are Oracle's built-in error reporting functions in PL/SQL.

When an error occurs in PL/SQL at runtime:

SQLCODE returns the number of the last encountered error.

SQLERRM returns the message associated with its error-number argument. The error-number argument is optional: if omitted, SQLERRM returns the message associated with the current [...]

Source: www.oratable.com
Пт, Июн 16, 2017
Check if JVM is Installed in Oracle

I recently thought of using Java's built-in BigInteger.gcd() method inside a PL/SQL wrapper to calculate GCD in SQLs.

And so I wrote the Java code and ran it on Oracle XE.

Things didn't go as planned.

SQL> -- Create java source for GCD calculation SQL> create or replace and resolve java [...]
Source: www.oratable.com
Вт, Июн 13, 2017
Oracle XML Object-Relational Storage

After the post on models for storing XML data in Oracle and examples of binary XML storage, here's a detailed look at the rigorous and performant structured XML storage or object-relational storage.

Object-relational storage of XML data is based on "shredding" the XML content into a set of SQL [...]

Source: www.oratable.com
Ср, Июн 07, 2017
Oracle XDB Binary XML Storage

The previous post on storing XML data in Oracle gave an overview of binary XML storage: compact, flexible, compatible with XML data with or without associated XML schema.

This post shows working examples of binary XML storage

1.1. without XML Schema
1.2 with XML Schema

The scripts below [...]
Source: www.oratable.com
Пн, Июн 05, 2017
Storing XML Data in Oracle

Oracle provides an abstract SQL data type called XMLType for storing XML data in the database. You can create an XMLType table, or an XMLType column in a relational table, to persist XML data.

Different storage models are available in Oracle to best fit the nature of the XML data [...]

Source: www.oratable.com
Пн, Май 29, 2017
SQL XML in Oracle: Generating XML from Relational Data

Oracle has built-in functions to convert relational data into XML format easily. These functions comes under the umbrella of SQL/XML, a specification that supports the mapping and manipulation of XML from SQL.

This post shows you how to generate XML from relational data using Oracle SQL/XML functions as building blocks.

Let's [...]

Source: www.oratable.com
Чт, Май 25, 2017
Активно читающий запрос из AWR: , заметность которого, похоже, обусловлена выбором и активным использованием, по-видимому, не самого оптимального плана 2944350538: — ASH TOP5: самые длинные выполнения использовали неудачный план 2944350538 — всё сходится) Сравним Outline удачного и неудачного планов: — отличия в LEADING и методе соединения "RESULT_PAGE_DATA@SEL$4 (*) Из ASH [...]
Source: iusoltsev.wordpress.com
Вс, Май 21, 2017
В дополнение к старому описанию особенностей DS версии 10.2 — Dynamic Sampling при индексном доступе к данным — на том же тесткейсе наблюдал как измененилось поведение Old Style Dynamic Sampling (DS) и Adaptive Dynamic Sampling (ADS) в новых версиях Oracle 12c Итак, тестовый DDL без изменений: 1) Old Style Dynamic [...]
Source: iusoltsev.wordpress.com
Чт, Май 18, 2017
Fuzzy Match using UTL_MATCH

Oracle's UTL_MATCH package contains functions to perform fuzzy matching between two strings based on one of these algorithms:

Levenshtein Distance Jaro-Winkler Distance

Let's understand the algorithms and see UTL_MATCH subprograms in action.

Note: It is not necessary to understand the nitty-gritties of the algorithms to use UTL_MATCH. The deep dive is for [...]

Source: www.oratable.com
Пн, Май 15, 2017
SQL Find Differences between Two Tables

In a recent project, a "shadow" table had to be compared periodically with its main source table to identify the differences between the two tables.

The nature of differences fell into one of these buckets:

Insert Required [INS]: If the source had rows not present in the shadow table Update Required [UPD]: [...]
Source: www.oratable.com
Вс, Май 14, 2017
, т.е. в случаях, когда использование VARCHAR2-функций типа LISTAGG заканчивается LISTAGG_CLOB Использовавшаяся поначалу User-Defined Aggregate Function типа LISTAGG_CLOB в плане скорости выполнения показывала самые грустные рез-ты: *) — пересылая по SQL*Net 50MB клиенту и 27MB обратно(!), совершая 400,000(!) roundtrip-ов, что, вероятно, является неприятной особенностью передачи CLOB данных и коственно подтверждается [...]
Source: iusoltsev.wordpress.com
Чт, Май 11, 2017
Convert VARCHAR2 to DATE

It is well-acknowledged that attributes in the database should use the correct datatypes (numbers should go into NUMBER columns, dates into DATE columns, etc). Storing date values in VARCHAR2 columns is an open invitation for bugs and issues due to date format such as the one I'm about to [...]

Source: www.oratable.com
Пт, Май 05, 2017
наблюдались в виде: — очень похоже на Bug 17323222 ORA-1555 / ORA-3170: deadlocked on readable physical standby (undo segment x) on ADG, т.е. ORA-3170 аналогично указывает на несуществующий SEGMENT_ID, а ORA-1555 возникает на коротком Query Duration Похоже, лечится изменением параметра: — случайно в то же время применённым для исправления ORA-07445 [...]
Source: iusoltsev.wordpress.com
Вт, Мар 28, 2017
Interval Range Partitioning

Oracle 11G brought with it a beautiful new twist to range partitioning – the ability to create partitions on-the-fly rather than having to pre-create all partitions.

Hello interval partitioning.

Before Oracle 11G, DBAs would have to define all the partitions on a partitoned table and ensure there were no "cracks" between [...]

Source: www.oratable.com
Ср, Фев 22, 2017
The plan_baseline hintset is just the list of hints SPM tried to use to reproduce the plan В ТОПе Library Cache периодически появлялся непривычный объект: необычайно крупного размера SHARABLE_MEM > 600MB с цифровым наименованием, под коим числилось 2 объекта: — судя по наименованям типов, относящихся к SQL Management Base, где [...]
Source: iusoltsev.wordpress.com
Пт, Фев 10, 2017
Joins

For those new to SQL, terms like INNER JOIN and OUTER JOIN can seem like fearsome foes. As the wise say, understanding conquers fear. Behind those geeky terms lie concepts rooted in simple real-world knowledge.

Here's a quickstart guide to these two basic joins in SQL: INNER JOIN and OUTER JOIN.

Case [...]
Source: www.oratable.com
Вт, Фев 07, 2017
Grant Select on V$ Views

When querying v$instance or v$session[1] as a non-admin user, you might come across this error:

SQL> select version 2 from v$instance; from v$instance * ERROR at line 2: ORA-00942: table or view does not exist

The error suggests that the non-admin user does not have the SELECT privilege [...]

Source: www.oratable.com
Вт, Янв 31, 2017
Database Version

Just as you sometimes need to find out your database name when connected to Oracle, you may also need to find out your database version.

Here's a rundown of ways to identify the Oracle database version using SQL and PL/SQL.


Query V$VERSION

V$VERSION displays version numbers of core library components [...]

Source: www.oratable.com
Пн, Янв 30, 2017
В процессе подготовки семинара, столкнулся с любопытным случаем, для адаптивного плана выполнения: *) в условиях реального отсутствия какого-либо Adaptive Bitmap Pruning! Неадаптивный план: Наибольший диссонанс вызвал вывод скрипта отличий секций Notes и Outline Data из OTHER_XML вышеприведённых планов выполнения: — точнее даже, несовпадение хинтов в Outline для планов с совпадающими [...]
Source: iusoltsev.wordpress.com
Вс, Янв 29, 2017
Коллега Леонид Борчук в процессе практического применения скрипта sql_profile_from_sql.sql обнаружил ошибку: и указал на ограничение: — т.е. нашёл-таки запрос с хинтом длиною более 500 символов! — для запросов OEBS нет пределов:) А, поскольку, в мировом масштабе, эта проблема уже была разрешена Carlos Sierra — Running "coe_xfr_sql_profile.sql Script (Shipped with SQLT) [...]
Source: iusoltsev.wordpress.com
Вт, Янв 24, 2017
Access Control Lists in Oracle

I recently upgraded Oracle XE from 10G to 11G, and found that none of the PL/SQL code using UTL_HTTP was working after upgrade. The code failed with the error:

declare * ERROR at line 1: ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1130 ORA-24247: network access denied by access control list (ACL) ORA-06512: at [...]
Source: www.oratable.com
Ср, Янв 11, 2017
UNPIVOT: Transpose Columns to Rows

Sometimes we need to transpose columns as rows in SQL. Oracle 11G onwards, this requirement can be easily implemented using the UNPIVOT clause.

A typical scenario:

Customer data is validated against a set of audit checks and the validation results are stored against the Customer Id as Y/N flags. The checks [...]

Source: www.oratable.com
Ср, Дек 14, 2016
Для демонстрации/проверки многообразия планов у меня есть простой скрипт SQL_PLAN_HASHS.SQL, вытаскивающий хеши планов из AWR и/или SqlArea по SQL_ID [и, опционально, по FULL_PLAN_HASH_VALUE и/или PLAN_HASH_VALUE], и один планов запросов SQL_ID=fkw6hb5mrw02t и PHV=3887377781 а течение последних нескольких дней показывал следующую примечательную картину: — в SqlArea (SRC=SQL) и в DBA_HIST_SQL_PLAN (SRC=AWR) этот [...]
Source: iusoltsev.wordpress.com
Пн, Дек 12, 2016

Внутри потоки мусора, которые можно и не смотреть.
Данная заметка специально создается для нищебродов, которые воруют чужие материалы.

όΔΥΑ�Δ μΙΝΟΞΟΧ. όΤΟ Ρ — όΔΙήΛΑ

1. οτεμψ "χιξσμου ι εηο οβιτατεμι

π�ΟΘΟΔΡ ΝΕΦΔΥ ήΑΣΟΝ ΔΞΡ Ι Τ�ΕΝΡ ΠΟ νάΔΙΣΟΞ-ΑΧΕΞΐ, ΤΑΝ ΗΔΕ ΕΕ ΠΕ�ΕΣΕΛΑΕΤ
55-Ρ ΥΜΙΓΑ, ΞΕ ΠΟΜΕΞΙΤΕΣΨ, ΪΑΔΕ�ΞΙΤΕ ΗΟΜΟΧΥ Ι ΧΪΗΜΡΞΙΤΕ ΧΧΕ�Θ — ΞΑ ΞΕΝΩΤΩΕ
ΟΛΞΑ [...]

Source: orablog.ru
Ср, Ноя 30, 2016
После switchover-а на аналогичное железо в разы выросло время ожидания log file sync: — при этом в качестве важного промежуточного блокера в вышеприведённой цепочке по частоте и продолжительности неожиданно проявилось LGWR wait for redo copy (*), что было отчётливо заметно в цепочке ожиданий, начиная с LGWR any worker group: Ожидания [...]
Source: iusoltsev.wordpress.com
Ср, Ноя 30, 2016
Разбираясь с использованием ожидания/активности db file scattered read при разных операциях планов выполнения, можно видеть: (*) Scattered чтения без SQL_PLAN_OPERATION большей частью относятся к фазе Soft parse (***), определяемой здесь как промежуток, когда PLAN_HASH_VALUE уже сформирован (PHV exists), но выполнение запроса ещё не началось (SQL_EXEC_ID is null): (**) SAMPLE операции [...]
Source: iusoltsev.wordpress.com
Ср, Ноя 23, 2016
Select Conditionally

Let's say a table contains multiple rows for an id. The requirement is to select only one of those rows, based on the value in a "type" column which determines the row's priority.

A typical example is selecting one contact number for a customer, based on contact types.

The possible contact [...]

Source: www.oratable.com
Ср, Ноя 16, 2016
ORA-12560: TNS:protocol adapter error

Sometimes you try to login to your Oracle XE on your home computer, and get this curt blocking response:

Here's the top reason why it might happen and how to fix it.


Database is not up

The first thing to check: is the Oracle service running? If you are seeing ORA-12560:TNS protocol [...]

Source: www.oratable.com
Пн, Ноя 14, 2016
На прошлой неделе появилась полная версия документации Oracle Database 12c Release 2 , следом Mike Dietrich публикует триптих: New SPFILE parameters in Oracle Database 12.2.0.1 Obsolete SPFILE Parameters 12.2.0.1 Deprecated Parameters in Oracle Database 12.2.0.1 , и Российский Oracle, по слухам, в конце месяца готовит целенаправленный семинар с более подробным [...]
Source: iusoltsev.wordpress.com
Комментирование отключено.