Feed aggregator
Question about sequence with lower nextval than column
Choosing a view based on result of view
The JSON query results does not return the full path
Partner Webcast – Oracle Cloud Observability & Management Platform Logging Services
We share our skills to maximize your revenue!
Announcement: Both Of My Oracle Webinars Scheduled For February 2021 !!
Supplemental Defect
Here’s an anomaly that appeared in a question on the ODC recently about tweaking the output of dbms_metadata.get_ddl(), As the title suggests, though, this posting isn’t about the dbms_metadata package it’s about supplemental logging and something that should not to be possible and may have unfortunate side effects.
We start with a little script that creates a table, inserts some data, adds a couple of constraints, and then introduces some supplemental logging requirements. As the script header indicates I’ve only tested this on 19.3.0.0:
rem rem Script: supplemental_defect.sql rem Author: Jonathan Lewis rem Dated: Jan 2021 rem rem Last tested rem 19.3.0.0 rem create table t1 ( n1 number, n2 number, n3 number, n4 number ); insert into t1 (n1, n2, n3, n4) values (1,2,3,4); commit; alter table t1 add constraint t1_pk primary key(n1, n2) / alter table t1 add constraint t1_uk unique(n3) using index ( create index t1_uk on t1(n3, n4) ) / alter table t1 add supplemental log data (primary key, unique) columns / alter table t1 add supplemental log group t1_g1 (n1, n2) always / alter table t1 add supplemental log group t1_g2 (n1, n2) always /
There’s nothing particularly special or complex about this code, and every statement runs successfully. You might notice that I’ve created two identical supplemental log groups, of course, and that’s clearly a mistake and I’d say that Oracle should have raised an error when I tried to create group t1_g2.
In fact my script is slightly worse than you might think at first sight because (n1, n2) is the primary key of the table, and I’ve added supplemental logging on the primary key already, so even supplemental log group t1_g1 really ought to raise an error as well.
Side note: you’ll notice that I’ve got a single-column unique constraint protected by non-unique multi-column index, and part of my supplemental log data specifies unique columns. If you check the syntax this option can be expressed as “unique” or “unique indexes” – which leaves me wondering whether Oracle my code would treat this as a command relating to n3 and n4, or just to n3.
So far all I’ve done is create a table in a way that’s left me with a couple of questions – let’s see what we get when we use dbms_metadata.get_ddl() to generate code to recreate the table:
begin dbms_metadata.set_transform_param(dbms_metadata.session_transform,'PRETTY',true); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SQLTERMINATOR',true); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'SEGMENT_ATTRIBUTES',false); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'STORAGE', false); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'TABLESPACE',false); dbms_metadata.set_transform_param(dbms_metadata.session_transform,'CONSTRAINTS',true); end; / set long 20000 set heading off select dbms_metadata.get_ddl('TABLE','T1') from dual; ================================================================ CREATE TABLE "TEST_USER"."T1" ( "N1" NUMBER, "N2" NUMBER, "N3" NUMBER, "N4" NUMBER, CONSTRAINT "T1_PK" PRIMARY KEY ("N1", "N2") USING INDEX ENABLE, CONSTRAINT "T1_UK" UNIQUE ("N3") USING INDEX ENABLE, SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS, SUPPLEMENTAL LOG DATA (UNIQUE INDEX) COLUMNS, SUPPLEMENTAL LOG GROUP "T1_G1" ("N1", "N2") ALWAYS, SUPPLEMENTAL LOG GROUP "T1_G2" ("N1", "N2") ALWAYS ) ;
The “create table” statement includes 4 supplemental log clauses – notice how my original “two-part” clause for the primary key and unique constraints has been split into two – with the key word index being added to the latter.
You might note that if you try to execute this statement to recreate the table you’re going to run into an immediate problem – Oracle will create a unique singe-column index to protect the unique constraint – it doesn’t know that the constraint should be protected by a two-column non-unique index.
But there’s another problem that will protect you from the indexing issue. Here’s what I get when I try to execute the statement:
SUPPLEMENTAL LOG GROUP "T1_G1" ("N1", "N2") ALWAYS, * ERROR at line 12: ORA-02261: such unique or primary key already exists in the table
The funniest thing about this error comes when you look at the error message file ($ORACLE_HOME/rdbms/mesg/oraus.msg in my case), where we can find the “Cause” and “Action” that Oracle supplies for the error:
02261, 00000, "such unique or primary key already exists in the table" // *Cause: Self-evident. // *Action: Remove the extra key.
It’s not too difficult to guess why the error has appeared but “Self-evident” seems a little optimistic. In fact your first guess about the error may be wrong. Obviously I could simply delete the lines that create the t1_g1 and t1_g2 logs since they appear to be redundant copies of the (primary key) supplemental log – but what if I just delete the line that creates the (primary key) supplemental log? Oracle still raises the ORA-02261 error. It’s only when I delete the declaration of the primary key (and I can leave the declaration of the (primary key) supplemental log in place) that the error stops appearing and I recreate the table … even if I’ve left the decarations of the two supplemental log groups on (n1, n2) in place.
On the plus side – although the export/import utilities expdp and impdp make use of the dbms_metadata package they don’t run into the same problem. After I’d exported, dropped and imported the t1 table with the sqlfile=xxx.sql option this is how impdp reported the code it had run to recreate the table (edited to remove the space management bits):
CREATE TABLE "TEST_USER"."T1" ( "N1" NUMBER, "N2" NUMBER, "N3" NUMBER, "N4" NUMBER ) ; ALTER TABLE "TEST_USER"."T1" ADD CONSTRAINT "T1_PK" PRIMARY KEY ("N1", "N2") ; ALTER TABLE "TEST_USER"."T1" ADD CONSTRAINT "T1_UK" UNIQUE ("N3") ; ALTER TABLE "TEST_USER"."T1" ADD SUPPLEMENTAL LOG DATA (UNIQUE INDEX) COLUMNS; ALTER TABLE "TEST_USER"."T1" ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS; ALTER TABLE "TEST_USER"."T1" ADD SUPPLEMENTAL LOG GROUP "T1_G1" ("N1", "N2") ALWAYS; ALTER TABLE "TEST_USER"."T1" ADD SUPPLEMENTAL LOG GROUP "T1_G2" ("N1", "N2") ALWAYS;
The underlying code for expdp/impdp generates constraints separately from the table and then adds the constraints to the tables – and it views supplemental logs as a variant on constraints (you can stop the supplemental log clauses appearing by using the dbms_metadata.transform_param() procedure to disable the generation of constraints) and adds them later.
You might notice in passing that the index created by impdp to support the unique constraint is NOT the index originally specified. This is a very old problem – though the nature of the problem has varied with time – so watch out if you move data from a production system to a test system using export/import.
SummaryThe internal code to handle supplemental logging allows you to create redundant supplemental log groups that will cause errors if you use dbms_metadata.get_ddl() in the most straightforward way to generate code to recreate the table.
The error message that appears if you haven’t allowed for the anomaly is a little counter-intuitive.
audit once per session (unified auditing)
How to allow in-progress client work survive database corruptions that don't require a database restart.
Advanced Queueing
[A NEW VERSION OF DP-200 & DP-201] Exam DP-203: Data Engineering on Microsoft Azure (beta)
Examination DP-201 & DP-200 Will be replaced with examination DP-203 ON FEBRUARY 23, 2021. you may still be capable of earn this certification with the aid of passing DP-200 and DP-201 until they retire on June 30, 2021. Azure Data Engineers are responsible for integrating, transforming, and consolidating data from distinct structured and unstructured data […]
The post [A NEW VERSION OF DP-200 & DP-201] Exam DP-203: Data Engineering on Microsoft Azure (beta) appeared first on Oracle Trainings for Apps & Fusion DBA.
Connect to Oracle Cloud DB from Python
Fantasy Software Development – Story Finding
As threatended promised, I’m going to look at the first phase of my Application – recording the results and outcomes of Soccer tournaments from the first days of the sport in 1871 through to the culmination of the first Football League Championship in 1889.
I’ll begin with a narrative description of the functional requirements of our application. OK, it’s more like a potted history of the early days of Association Football, but I’ve got to start somewhere.
I’ll use this to extrapolate some user stories, which I’ll then drop into Altassian Jira having taken advantage of a free Jira account.
If you’re an Oracle developer and reading this is your first experience of Scrum, then you may feel that it’s not an obvious fit for developing a data-centric application.
On the other hand, if you’re a Scrum officianado, you may be faintly horrified by the “free-form” way I’m approaching Scrum. So, something to annoy everyone then…
Those of you less than enamoured of “the Beautiful Game” will not be unduly surprised to learn that it all started with a bunch of blokes in a pub…
On 26th October 1863, at the Freemason’s Tavern in London, the Football Association (FA) first came into being.
Despite this, the rules observed by it’s member clubs when playing the game remained somewhat fragmented.
There were several versions to choose from and clubs would agree a set of rules to adhere to when playing each other.
In an attempt to promote the “Association” rules ( adopted by the FA), Charles Alcock, Secretary of the FA came up with the idea of a Cup competition between all of the clubs affiliated to the Association.
All matches in this new competition would be played under this single set of rules.
Thus it was that Association Football ( soccer) really came into being several years after it’s governing body was founded.
To give a flavour of how fundamental this change was, the Rules established such matters as the number of players per side (11), and the duration of a match ( 90 minutes), which had not been consistent across the various football codes then extant.
The first Tournament duly took place in the 1871/72 season.
The format can best be described as “sort of knock-out”.
Whilst the winners of a tie between two competing teams would advance to the next stage of the competition, this was not the only method of progression. There was, of course, the possibility of being awarded a bye, a free-pass to the next round if there were an odd number of teams in the current round.
Teams could also be awarded a Walkover, if their designated opponents withdrew.
Additionally, at the discretion of the competition’s organising committee, teams could advance if :
– they drew their fixture ( both teams could go through)
– they could not agree a date and venue with the opponents against whom they had been drawn.
Eventually, the 14 entrants were whittled down to Wanderers, who defeated Royal Engineers 1-0 in the Final, played on 16th March 1872 at the Kennington Oval in London.
Originally, the intention was for the cup holders to defend the trophy from challengers, hence the competition’s full name – The Football Association Challenge Cup.
For the 1872/73 tournament, Wanderers were given a bye all the way through to the final with the remaining matches being essentially and elimination event to find a challenger.
Wanderers were also given choice of venue and – perhaps unsurpisingly – managed to retain the trophy with a 2-0 win over Oxford University.
It’s only from 1873/74 that the competition settles down into a consistent knock-out format.
For the first 10 years of competition, the southern amateur teams dominated, and it was not until 1882 that a team from the north of England appeared in the final.
That year, Old Etonians saw off the challenge of Blackburn Rovers. It was to prove the end of an era.
In subsequent years the centre of power changed radically, Rovers’ local rivals Blackburn Olympic won the trophy the following season after which Rovers themselves, won three consecutive finals.
By 1888, football in England was dominated by professional clubs in the North and Midlands. 12 such clubs formed the Football League and participated in the first season.
The League format consisted of each team playing all of the others, once on their home ground and once on the opponents’ ground.
For each match won, 2 points were awarded.
For a draw, one point was awarded.
No points were awarded for a defeat.
Teams finishing level on points would be separated by Goal Average.
Goal Average was calculated by dividing the number of goals scored over the course of the season by the number of goals conceded.
International FootballThe first international took place on 30th November 1872 in Glasgow, when Scotland and England drew 0-0.
As the game spread to Wales and Ireland (which was then a single entity and part of the United Kingdom), matches between the four home nations became a regular occurrence. However, each association observed slightly different rules and this was the cause of some friction.
Eventually, the International Football Conference was convened in Manchester in December 1882. It was at this meeting where a common set of rules were agreed.
The first full season in which these rules were applied was 1883/84 and it’s subsequently been acknowledged that the matches played between the Home nations in that season comprised the inaugural British Home Championship – the first international soccer tournament.
The format was a round-robin with each nation playing the other once with home and away fixtures alternating between years.
The outcome of the tournament was decided using the same criteria as for the Football League, with the exception that Goal Average was not applied and teams finishing level on points were considered to be tied.
Given the influence of Scottish players on the development of the game, it’s little surprise that Scotland won the inaugural championship. Indeed, Scotland only failed to win one of the first six tournaments up to and including 1888/89.
I should point out that applying this format to the Home International Championship is slightly anachronistic.
Contemporary reports don’t include league tables and these seem to have been applied several years later, under the influence of the format adopted by the Football League.
For our purposes however, we’re going to proceed on the basis that this format was in place from the outset.
To start with, I’ve identified three distinct user roles :
- Football Administrator – generally runs the FA and sets up Competitions
- Tournament Organiser – manages tournaments
- Record Keeper – enters fixture data, including results and maintains league tables
The stories are written from the perspective of these users.
Football Administrator StoriesTitle : Create Competition As a : Football Administrator I would like to : create a competition so that : I can provide a structured environment for teams to participate
Title : Administer Teams As a : Football Administrator I would like to : Maintain details of teams So that : I know which teams are eligible to enter competitions
Title : Administer Venues As a : Football Administrator I would like to : Maintain details of venues where matches can be played So that : I know where teams can fulfil fixtures.Tournament Organiser Stories
Title : Create Tournament As a : Tournament Orgainiser I would like to : create a tournament so that : teams can compete against each other
Title : Specify a format for a tournament As a : Tournament Organiser I would like to : specify the format for a tournament so that : I can anticipate what fixtures may be played
Title : Define Tournament Rules As a : Tournament Organiser I would like to : Define the rules for the tournament So that : I know how to determine the outcome of the tournament
Title : Enter Teams As a : Tournament Organiser I would like to : Accept the entry of teams into a tournament So that : I know which teams are competing in a tournament
Title : Assign Tournament Venues As a : Tournament Organiser I would like to : Assign venues to a tournament So that : I know where tournament fixtures may be played
Title : Assign Players to Tournament Teams As a : Tournament Organiser I would like to : assign players to a team So that : I know which players are playing for which team in a tournament
Title : Override Tournament Fixture Results As a : Tournament Organiser I would like to : override results of fixtures So that : I can account for exceptional circumstances
Title : Teams remaining in a tournament As a : Tournament Organiser I would like to : identify the teams still in a knock-out tournament so that : I know which teams will be in the draw for the next round
Title : Future fixtures As a : Tournament Organiser I would like to : add tournament fixtures even when the teams are not known So that : I can anticipate which future fixtures are required for the tournament to be completed.Record keeper stories
As a : Record Keeper I would like to : record details of a fixture so that : I can see what happened during a match
As a : Record Keeper I would like to : view a league table based on results so far So that : I know how teams are performing relative to each other in a League or round-robin tournament
As a : Record Keeper I would like to : record which team won and which teams were placed in a competition so that : I can maintain a Roll of Honour
Whilst this is all a bit rough-and-ready, it does give us a backlog to start working from.
Project Management SoftwareNow, how best to track our progress ? At this point, I did start to wonder whether I could throw together a quick application as installing Jira was likely to take time and incur cost that I didn’t really have on this project.
Fortunately, Altassian saved me the bother as they provide a free Jira cloud account.
Consequently, my backlog is now just waiting for Sprint 1 to start, which will be the subject of my next post on this topic.

Introduction To Google Cloud Platform
Google Cloud is a suite of Cloud Computing services offered by Google that provides various services like compute, storage, networking, and many more that run on the same infrastructure that Google uses internally for end-users like Gmail, Google Photos, and YouTube. There are many services and tools offered by Google Cloud like Storage, Big Data, […]
The post Introduction To Google Cloud Platform appeared first on Oracle Trainings for Apps & Fusion DBA.
AWS Database Migration Service
Are you looking for a way to migrate your on-premise database to the cloud? AWS Database Migration Service (DMS) is a managed service that provides a quick and secure way to migrate your on-premise databases to the cloud. Check out this blog at k21academy.com/awssa34 to know more about AWS Database Migration Service: • What is […]
The post AWS Database Migration Service appeared first on Oracle Trainings for Apps & Fusion DBA.
Partner Webcast – Integration Insight in Oracle Integration
We share our skills to maximize your revenue!
DIFFERENCE BETWEEN ANALYZE AND DBMS_STATS
Is there a view that a DBA can query to find out if "ORA-02393: exceeded call limit on CPU usage"
MATERIALIZED VIEW Performance Issue!
blob to clob on ORDS Handler Definition
How to pass a parameter to a GET Handler in APEX?
Pages
