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

19 Февраль 2015
Earlier
Пн, Фев 19, 2018
DML Error Logging DBMS_ERRLOG

When you have an enormous load of data to copy/merge from one table to another, you are probably concerned about:

Performance: How fast can the program copy/merge all the data? Exception handling: How well does the program deal with [...]
Source: www.oratable.com
Сб, Фев 17, 2018
На нескольких запросах столкнулись со ситуацией, когда при по умолчанию включенными optimizer_adaptive_features=true план запроса может не применять преобразование OR-Expansion, что значительно увеличивает формальную стоимость/Cost и реальное время выполнения: Судя по трейсу 10053 оптимизатор выполняет попытки: , не фиксируя невозможности/недопустимости операции в виде: или по какой-то другой причине, но не доходит [...]
Source: iusoltsev.wordpress.com
Вт, Фев 06, 2018
FORALL INSERT Bulk DML

Oracle PL/SQL gives you the ability to perform DML operations in bulk instead of via the regular row-by-row FOR loop. This article shows you how to use bulk DML and handle exceptions along the way.

Why Bulk DML at all?

You [...]

Source: www.oratable.com
Вт, Фев 06, 2018
FORALL INSERT Bulk DML

Oracle PL/SQL gives you the ability to perform DML operations in bulk instead of via the regular row-by-row FOR loop. This article shows you how to use bulk DML and handle exceptions along the way.

Why Bulk DML at all?

You [...]

Source: www.oratable.com
Вт, Янв 30, 2018
JSON_TABLE Options

In the article on SQL/JSON query functions we saw how JSON_TABLE converts JSON data to relational form. This article further explores various JSON_TABLE options for parsing and handling errors in JSON data.

Sample JSON Structure

For this demo consider JSON data [...]

Source: www.oratable.com
Вт, Янв 30, 2018
JSON_TABLE Options

In the article on SQL/JSON query functions we saw how JSON_TABLE converts JSON data to relational form. This article further explores various JSON_TABLE options for parsing and handling errors in JSON data.

Sample JSON Structure

For this demo consider JSON data [...]

Source: www.oratable.com
Пн, Янв 15, 2018
Предварительно усилив параллельность выполнения — как несложный и действенный метод ускорения FULL SCAN-ов, HASH JOIN-ов, сокращения direct path temp read / write- операций и потребления TEMP пространства, соответственно: , получаем: — стартовый рез-т, SQL MONITOR которого показывает много direct path read на MAT_VIEW ACCESS FULL (*) + всё ещё заметное, [...]
Source: iusoltsev.wordpress.com
Вт, Янв 09, 2018
Unique Constraint vs Unique Index

A unique constraint and a unique index in Oracle, on the face of it, look very alike. Both enforce uniqueness, and the unique index seems to piggyback on the constraint when the constraint is created or dropped.

You might [...]

Source: www.oratable.com
Вт, Янв 09, 2018
Unique Constraint vs Unique Index

A unique constraint and a unique index in Oracle, on the face of it, look very alike. Both enforce uniqueness, and the unique index seems to piggyback on the constraint when the constraint is created or dropped.

You might [...]

Source: www.oratable.com
Ср, Янв 03, 2018
How To Lock A Row In Oracle

Before updating a row in a database table, you might want to check for concurrency conflict – another transaction should not be updating the same row simultaneously.

This can be achieved by locking the row in Oracle before [...]

Source: www.oratable.com
Ср, Янв 03, 2018
How To Lock A Row In Oracle

Before updating a row in a database table, you might want to check for concurrency conflict – another transaction should not be updating the same row simultaneously.

This can be achieved by locking the row in Oracle before [...]

Source: www.oratable.com
Сб, Дек 16, 2017
with seg as ( select owner,segment_name ,segment_type ,tablespace_name ,sum(blocks) blocks ,sum(bytes) bytes [...]
Source: orasql.org
Чт, Дек 14, 2017
DBMS_LOB.FRAGMENT_DELETE

One way to get a smaller CLOB from another CLOB is to follow the extract CLOB from JSON example: use DBMS_LOB INSTR/SUBSTR functions to obtain the CLOB fragment of interest. We could look at the same problem from another angle: [...]

Source: www.oratable.com
Ср, Дек 13, 2017

Alex R recently discovered interesting thing: in SQL pipelined functions work much faster than simple non-pipelined table functions, so if you already have simple non-pipelined table function and want to get its results in sql (select * from table(fff)), it's much better to create another pipelined function [...]

Source: orasql.org
Вт, Дек 12, 2017
Extract long string or CLOB from JSON

"Wheels within wheels", as Monty Bodkin would say. Extracting a very long string or CLOB from a JSON CLOB (very long => larger than max_string_size of 32767), in a pre-12.2 Oracle database, turned out to be more complex than it appeared at first sight.

This case study shows how to [...]

Source: www.oratable.com
Вс, Дек 10, 2017

When “serveroutput” is enabled, SQL*Plus executes “BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;” after each command.
That's why I don't like when it is always enabled: it adds extra calls and round-trips and it is inconvenient when I want to get a plan of the last executed query:

SQL> set serverout on; SQL> select * from [...]
Source: orasql.org
Сб, Дек 09, 2017

This interesting question was posted on our russian forum yesterday:

We have a huge PL/SQL package and this simple function returns wrong result when it's located at the end of package body:

create or replace package body PKGXXX as ... function ffff return number is nRes [...]
Source: orasql.org
Ср, Дек 06, 2017
Convert Relational Data to JSON

In the JSON series so far, we've talked about how to store JSON data in Oracle and apply JSON conditional checks, and how to query JSON data and convert it to relational form. What if you want the opposite i.e. to convert relational data to JSON form? [...]
Source: www.oratable.com
Ср, Ноя 22, 2017
JSON Conditional Logic JSON_EXISTS JSON_TEXTCONTAINS

In the last two articles, we saw the means and reasons for storing JSON data in Oracle and ways of retrieving JSON data from Oracle. In this article, we will explore ways of implementing true/false tests on JSON data using conditionals: JSON_EXISTS, JSON_TEXTCONTAINS.

JSON conditionals check for the existence [...]

Source: www.oratable.com
Вт, Ноя 21, 2017
Querying JSON Data in Oracle

The last article talked about how to store JSON in the database. This article shows you how to retrieve it meaningfully using various query approaches in Oracle 12c.

For the demo, we'll use the same old CUSTOMER table with JSON metadata.

The table:

-- Customer table DDL with JSON metadata CREATE [...]
Source: www.oratable.com
Чт, Ноя 16, 2017
JSON in the database

JSON is a simple data interchange format, an alternative to XML that's gaining wider favor by the day especially for big data storage and REST web services. With release 12c, Oracle has introduced JSON support too – handy new features for storage and retrieval of JSON data.

Here's a [...]

Source: www.oratable.com
Сб, Ноя 11, 2017
Полное атомарное обновление матвью / Complete Atomic MV Refresh: большую часть времени тратит на непараллельное выполнение запроса на вставку: , который в свою очередь, в основном ожидает db file scattered read: — что нормально и непротиворечиво Однако, отдельное выполнение того же запроса из SQL*Plus происходит почти в 5 раз быстрее: [...]
Source: iusoltsev.wordpress.com
Пт, Ноя 10, 2017
DBMS_REDEFINITION

Oracle 12.2 has introduced a number of new features that ease partitioning, the most-awaited perhaps is the ALTER TABLE MODIFY syntax to convert a non-partitioned table to partitioned.

What do you do if your database version is pre-12.2? Partitioning a non-partitioned table in pre-12.2 databases is trickier, not [...]

Source: www.oratable.com
Вс, Окт 22, 2017
При установленном параметре: параллельное построение индекса легко распеределяется между нодами RAC: , несмотря на исправленный Bug 16458105 — PARALLEL_FORCE_LOCAL=true not honoured for ALTER INDEX — superseded (Doc ID 16458105.8): — что отражено/соответствует документу 12.1.0.2 Patch Set — List of Bug Fixes by Problem Type (Doc ID 1683802.1) Реклама Filed under: [...]
Source: iusoltsev.wordpress.com
Пн, Сен 25, 2017
Stored Procedures in Packages

Typical scenario: in a project's design phase, procedureA is meant to be placed in packageX. During implementation, packages are refactored: packageX gets split into packageY and packageZ. All goes well – the application gets deployed and is running merrily – till a change request comes in.

A new developer refers [...]

Source: www.oratable.com
Пт, Сен 01, 2017
Proxy User Authentication in Oracle

Proxy user authentication is a powerful feature in Oracle that lets one database user (proxy user) connect to the database "on behalf of" another user (client user).

With proxy login, the proxy user can act as if it is the client user with all of the client user's access rights, without [...]

Source: www.oratable.com
Ср, Авг 16, 2017
XMLTABLE to Convert XML To Relational Data

Here's a prototype for using the SQL/XML function XMLTABLE to map XML data into relational rows and columns.

This solution uses the standard EMP table – the same can be extended to work with any XMLTYPE-relational mapping.

Problem Statement: Receive XML Payload, Parse and Store in Relational Table

An application receives employee data [...]

Source: www.oratable.com
Пт, Авг 11, 2017
Dynamic SQL

A comparison between static SQL vs dynamic SQL shows us pretty clearly that, if there exists a choice, we are better off choosing static SQL.

So, when should we use dynamic SQL?

Oracle documentation tells us that we need dynamic SQL to run:

SQL whose text is unknown at compile [...]
Source: www.oratable.com
Ср, Июл 26, 2017

Some questions do not have definitive answers. "Is a full table scan bad? Should this design be denormalized? Will partitioning this table help?" The answers vary widely depending on the specifics on the problem.

Fortunately, "Should I use static SQL or dynamic SQL?" is not one of those questions.

You can come [...]

Source: www.oratable.com
Пт, Июл 14, 2017
В PDB snapshot copy окружении версии 12.1.0.2: Артём Горбик показал странно отображаемую сессию-блокер: — формально работающую в CDB$ROOT: , и в то же время выполняющую Scheduler Job в контейнере-клоне: Модифицировал под это дело скрипт (с суффиксом _CDB), добавив к инстансу/сессии (INST#/SID#4) номер контейнера — CON#: — и в выводе скрипта [...]
Source: iusoltsev.wordpress.com
Комментирование отключено.