jump to navigation

And so the evenings start drawing out (honest!) December 13, 2011

Posted by mwidlake in Uncategorized.
1 comment so far

I know I’ve blogged about this before, but it was early on when very few people read my ramblings, so I am mentioning it again…

For those of us in the Northern Hemisphere, today is the day when the evenings start drawing out, which personally I find a relief as going home in the dark depresses me. Sunset tomorrow will be later than today – by all of a few seconds but, heck, later is later. {If I am out by a day, please don’t tell me – don’t shatter my good mood!}

However, as many of you are probably thinking, shortest day in the Northern hemisphere is not until the 22nd December (it’s the 21st or 22nd, depending on how long ago the last leap year was). Mornings continue to get later until around the 3rd January. It is because the earth is not “standing totally upright” in it’s orbit. If you think of the plane in which the earth circles around the sun as a flat surface, the north pole is at the top of the planet and that there is a pole sticking though the earth that it spins around every day, that pole is leaning back away from the sun today and slightly to one side, like a staggering drunk.

For the timing of sunrise and sunset for the city nearest you, check out this nice website here. This link will show London but you can change that.

The original post is here. It does not say any more but there are a couple of pretty sunset pictures on it.

Of course, if you are in the Southern Hemisphere {say Perth, Australia} then your sunrises have just started getting later by today. But time for the Barby in the evening is still drawing out for a week or two. We can all be happy :-)

Will the Single Box System make a Comeback? December 8, 2011

Posted by mwidlake in Architecture, future, Hardware.
Tags: , ,
15 comments

For about 12 months now I’ve been saying to people(*) that I think the single box server is going to make a comeback and nearly all businesses won’t need the awful complexity that comes with the current clustered/exadata/RAC/SAN solutions.

Now, this blog post is more a line-in-the-sand and not a well researched or even thought out white paper – so forgive me the obvious mistakes that everyone makes when they make a first draft of their argument and before they check their basic facts, it’s the principle that I want to lay down.

I think we should be able to build incredible powerful machines based on PC-type components, machines capable of satisfying the database server requirements of anything but the most demanding or unusual business systems. And possibly even them. Heck, I’ve helped build a few pretty serious systems where the CPU, memory and inter-box communication is PC-like already. If you take the storage component out of needing to be centralise (and this shared), I think that is a major change is just over the horizon.

At one of his talks at the UKOUG conference this year, Julian Dyke showed a few tables of CPU performance, based on a very simple PL/SQL loop test he has been using for a couple of years now. The current winner is 8 seconds by a… Core i7 2600K. ie a PC chip and one that is popular with gamers. It has 4 cores and runs two threads per core, at 3.4GHz and can boost a single core to 3.8 GHz. These modern chips are very powerful. However, chips are no longer getting faster so much as wider – more cores. More ability to do lots of the same thing at the same speed.

Memory prices continue to tumble, especially with smart devices and SSD demands pushing up the production of memory of all types. Memory has fairly low energy demands so you can shove a lot of it in one box.

Another bit of key hardware for gamers is the graphics card – if you buy a top-of-the-range graphics card for a PC that is a couple of years old, the graphics card probably has more pure compute grunt than your CPU and a massive amount of data is pushed too and fro across the PCIe interface. I was saying something about this to some friends a couple of days ago but James Morle brought it back to mind when he tweeted about this attempt at a standard about using PCI-e for SSD. A PCI-e 16X interface has a theoretical throughput of 4000MB per second – each way. This compares to 600MB for SATA III, which is enough for a modern SSD. A single modern SSD. {what I am not aware of is the latency for PCI-e but I’d be surprised if it was not pretty low}. I think you can see where I am going here.

Gamers and image editors have probably been most responsible for pushing along this increase in performance and intra-system communication.

SSD storage is being produced in packages with a form factor and interface to enable an easy swap into the place of spinning rust, with for example a SATA3 interface and 3.5inch hard disk chassis shape. There is no reason that SSD (or other memory-based) storage cannot be manufactured in all sorts of different form factors, there is no physical constraint of having to house a spinning disc. Density per dollar of course keeps heading towards the basement. TB units will soon be here but maybe we need cheap 256GB units more than anything. So, storage is going to be compact and able to be in form factors like long, thin slabs or even odd shapes.

So when will we start to see cheap machines something like this: Four sockets for 8/16/32 core CPUs, 128GB main memory (which will soon be pretty standard for servers), memory-based storage units that clip to the external housing (to provide all the heat loss they require) that combine many chips to give 1Gb IO rates, interfaced via the PCIe 16X or 32X interface. You don’t need a HBA, your storage is internal. You will have multipath 10GbE going in and out of the box to allow for normal network connectivity and backup, plus remote access of local files if need be.

That should be enough CPU, memory and IO capacity for most business systems {though some quote from the 1960′s about how many companies could possible need a computer spring to mind}. You don’t need shared storage for this, in fact I am of the opinion that shared storage is a royal pain in the behind as you are constantly having to deal with the complexity of shared access and maximising contention on the flimsy excuse of “sweating your assets”. And paying for the benefit of that overly complex, shared, contended solution.

You don’t need a cluster as you have all the cpu, working memory and storage you need in a 1U server. “What about resilience, what if you have a failure?”. Well, I am swapping back my opinion on RAC to where I was in 2002 – it is so damned complex it causes way more outage than it saves. Especially when it comes to upgrades. Talking to my fellow DBA-types, the pain of migration and the number of bugs that come and go from version to version, mix of CRS, RDBMS and ASM versions, that is taking up massive amounts of their time. Dataguard is way simpler and I am willing to bet that for 99.9% of businesses other IT factors cause costly system outages an order of magnitude more times than the difference between what a good MAA dataguard solution can provide you compared to a good stretched RAC one can.

I think we are already almost at the point where most “big” systems that use SAN or similar storage don’t need to be big. If you need hundreds of systems, you can virtualize them onto a small number of “everything local”
boxes.

A reason I can see it not happening is cost. The solution would just be too cheap, hardware suppliers will resist it because, hell, how can you charge hundreds of thousands of USD for what is in effect a PC on steroids? But desktop games machines will soon have everything 99% of business systems need except component redundancy and, if your backups are on fast SSD and you a way simpler Active/Passive/MAA dataguard type configuration (or the equivalent for your RDBMS technology) rather than RAC and clustering, you don’t need that total redundancy. Dual power supply and a spare chunk of solid-state you can swap in for a failed raid 10 element is enough.

Was the Oracle UK logo Blue back in 1991? December 6, 2011

Posted by mwidlake in history, Uncategorized.
2 comments

I think I might be going mad. I was sure that when I joined Oracle UK back in 1991 that the massive “Oracle” sign above the main office on “The Ring” in Bracknell was blue. It was the building that looked like a load of cubes balanced on each other.

As I remember it, the office stationary had “Oracle UK” on it in blue and my business cards were similarly coloured. I can’t find any 20 year old stationary to prove it and I owe Bryn Llewellyn a bottle of wine if I turn out to be wrong.

I’m sure I also remember fellow consultants joking in around 1993, when the annual bonus was particularly poor, that it was due to all the money spent going from blue to red stationary and signs when our UK identity was absorbed into the parent beast…

I’ve Been Made an Oracle Ace. December 5, 2011

Posted by mwidlake in Private Life, UKOUG.
Tags: ,
14 comments

I tried to come up with a witty title but after only first day at the UKOUG conference, OakTable Sunday, my brain is already a little fried…

So yes, last Friday evening I received an email from Oracle Corp informing me I had been nominated for and been accepted as an Oracle Ace. I’d just accidentally blown away some of my slides for a presentation I’m giving this week and I was a bit weary of the whole community thing, so it gave me a real lift. It would have given me a lift anyway, but the timing seemed very nice – it re-invigorated me and it also meant that I could now mention my Ace-dom at conference. Endlessly. I never won prizes at school so this sort of thing goes to my head. Sorry.

Of course, my wife keeps my feet on the ground. I wandered over to the kitchen to tell her…
“Hey, Sue, I’ve just been made an Oracle Ace!”
“That’s nice dear – empty the cat’s litter tray while you are there, it stinks”.
*sigh*

It means a lot to me to be an Oracle Ace. I’m not going to pretend to be all unconcerned over it or say “oh no, not me, I am not worthy of that” like I did {and still do} over being a member of the OakTable. In the last 10 or 12 years I’ve done a lot for Oracle Corp (some of which is public, some of which was working with Oracle on testing things and talking to other Oracle customers about getting the most out of the technology) and also with the UK oracle community so I kind of feel the Acedom is an earned reward for that. But I am also very grateful for it, it is still a relatively rare accolade and Oracle have to feel that you are benefiting the wider community to bestow the award on you.

Being an Ace has already had some impact on me. I met my friend Neil Chandler at the conference, he is the person who nominated me (Oracle tell you who nominated you). “Hey, Neil, due to you I’ve been made an Oracle Ace! Thank you very much!”. “Great Martin, well deserved – so let’s have beers tonight and you can thank me properly”. “Errrr, I’ve been invited to an Ace meal this evening….”. “Well get you! Only just an Ace and too good for us commoners huh? You’ve changed, You’ve really changed….”

The Ace meal was good and much appreciated but I ate too much spicy stuff and boy I’ve got bad indigestion {and more unpleasant symptoms} now.

So it seems, based on evidence so far, Being an Ace loses you friends and makes you feel unwell. This is not what I was expecting….

:-)

{It’s OK, Neil and I had beers before the meal and he forgave me in the end – on the condition I provide him with more beer soon}

Friday Philosophy – The Worst Thing About Contracting December 2, 2011

Posted by mwidlake in contracting, Friday Philosophy, humour, rant.
Tags: , , ,
14 comments

A while back I was asked by a friend to blog about being a contractor. In the pub last week my friend reminded me of this and that I had not obliged him. I will – think of this as instalment one Jason…

I’ve been a contractor on and off for 18 years. For anyone not familiar with the concept, it is where you are self-employed and you simply hire yourself out to a company for a period of time or to do a specific job. You generally have less job security than an employee and less rights and benefits – No holiday pay, no paid sick leave, no annual pay increase {OK, so that one is rare for employees too these days}, no training and generally the first out the door when the money gets tight. In return you get more money when working and a lot, lot less to do with office politics, HR, annual reviews and the like.

It is not for everyone but I like being a contractor. It gives me a broader degree of experience.

I like it apart from one main thing.

Recruitment Consultants. For every good one there are 3 bad ones. And for each bad one there are 5 absolutely terrible ones.

There are good recruitment consultants out there, some absolutely fantastic ones who do things like actually read CV’s, understand the business they are hiring into and can be bothered responding to emails and telephone calls. You might even find one who has a mental list of their clients and their requirements and will actively look to place a good candidate in front of those clients. Claire Green at GT-Consulting is one. There are others of course.

However, most do little more than scan the database of candidate CVs for keywords and send the first three found off to the client for them to do the actual work of seeing if they actually have the skills and experience required. It would seem most have no ability or interest in trying to work out who would be a good or bad candidate themselves, like it being the service they are supposed to supply. If you try and get in touch directly to discuss a role, to maybe ask some questions to save both you and the consultant’s client a wasted interview, many will not take your call {“Can I ask who’s calling?” Brief pause whilst they realise you are a candidate not a client company “Ahh, sorry they are out of the office today, they’ll call you back. Who were you again?”}. Only the good ones call you back. You will hardly ever be called back.

If you do speak to them, some will be your best mate – but can’t quite fake sincerity… Sadly, it is often obvious that they have no idea about the business. I had a chap a week or two back telling me I needed PL or SQL to do the role and when I queried if they meant PL/SQL they got tetchy with me. Another a while back was insisting I was not suitable as I did not have 10 years of Oracle 10. As I beta tested Oracle 10 for over a year and thus, with around 8 years’ experience at that time, was well ahead of the pack I suggested that maybe they needed to alter that requirement – or find someone who helped develop it at Oracle Corp…Again, some kindly advice was poorly received. OK, I was not kindly, I was tetchy too. He had stared off being my insincere best mate.

I could just be having a self-centred moan of course, in that the recruitment consultants don’t realise how great I am ( :-) ) and find me lucrative jobs – but I’ve also been the client and had to wade through dozens of utterly unsuitable CVs sent in from them. The last time was particularly awful as we were not able to offer a great wage (but we were happy to take people with experience of prior versions and train them up to the latest-greatest). Most CVs sent in had the words Oracle, database and administration on them but not together. Several lacked any Oracle at all. Every recruitment consultant I dealt with that time gave me the same spiel about having the best candidates on their books, how they vetted everyone and sent only the ones with the best match of skills. They must have been telling a miss-truth about at least one of those claims as there was little match with our requirements for an Oracle DBA.

So, I really like contracting but not the dealing-with-agents bit. Oddly enough, any discussion with other contractors or managers who hire nearly always shows that my feelings are widely shared…

I’ve been thinking about doing this post ever since I started blogging but I didn’t – because many jobs are only available via recruitment consultants. Insulting them is not going to help me get put forward for jobs. However, last time I was mouthing off about Satan’s little Imps in the pub and how I had never done a Friday Philosophy on the topic, due to the fear of the consequences, one of the guys pointed out I was an idiot. Most recruitment consultants can’t even be bothered reading your CV so they are not going to go check out someone’s technical blog! {and Neil has just beaten me to posting about it and how they always ask for mostly irrelevant industry experience}. Any who do are going to be firmly in that rare Good category. I’d go as far as to say that any recruitment consultant who is reading this is in the top 5% of their field. Nice to talk to you again, Claire…

Headlong rush to Conference – Preparing the Presentations November 29, 2011

Posted by mwidlake in Meeting notes, UKOUG.
Tags: , , , ,
6 comments

With only a few days to go before the UKOUG conference this year I’m preparing my presentations. I know pretty much what I want to say and, for the IOT talk at least, it is not as if I do not have enough material already prepared – some of which has been on the blog posts and some of which has not. (though it did strike me that I could just fire up the blog and walk through the thread, taking questions).

My big problem is not what to say – it is what not to say.

I’ve always had this problem when I want to impart knowledge, I have this desire to grab the audience by the throat, take what I know about the subject and somehow just cram the information into the heads of the people in front of me. All of it. I want them to know everything about it that I know, the core knowledge, the oddities, the gotchas, how it meshes with other topics. It’s ridiculous of course, if I’ve spent many hours (days, weeks, 20 years) acquiring experience, reading articles and learning, I can’t expect to pass that all on in a one hour presentation – especially as I like to provide proof and examples for what I say. But I think the desire to do so is part of what makes me a good presenter and tutor. I bounce around in front of the audience, lobbing information at them and constantly trying to judge if I need to backup and give more time to anything or if I can plough on, skipping the basics. Hint, if you are in the audience and I’m going too fast or garbling my topic, then I am always happy to be asked questions or told to reverse up a little. I’ve never been asked to speed up though :-)

It gets even worse. If I am putting myself up there to talk about a topic then I don’t want to be found wanting. I want to be able to handle any question and have a slide or example up my sleeve to demonstrate it. It’s exhausting and, again, pointless. At somewhere like the UKOUG there is bound to be someone who knows something I don’t know about any topic.

For me the trick is to pare it down, to keep reminding myself that if the audience leaves with more knowledge than they came in with, that is a win. If they actually enjoyed the experience I’m even more happier. Maybe I should forget the topic and just take drinks and nibbles…

So, I’m currently doing what I always do, which is trying to force myself to remove stuff that is not directly relevant whilst still leaving a few little oddities and interesting items. Plus getting the 200 slides down to something more reasonable – like say 120 :-)

If I can get it down to one slide per minute (some of which I skip on the day as they are there for anyone downloading the talk) then I’m OK.

Of course, having done this, the day before the course I’ll do one last “final review” – and add a couple of dozen slides to just clarify a few points…

Lack of Index and Constraint Comments November 24, 2011

Posted by mwidlake in Architecture, database design, development.
Tags: , , , ,
10 comments

Something I’ve just reminded myself of is that under Oracle you cannot add a comment on an index or a constraint. You can only add comments on tables, views, materialized views, columns of those object types and a couple of esoteric things like Operators, Editions and Indextypes.

Here is an example of adding comments to tables and columns:

set pause off feed off
drop table mdw purge;
create table mdw(id number,vc1 varchar2(10));
comment on table mdw is 'Martin Widlake''s simple test table';
comment on column mdw.id is 'simple numeric PK sourced from sequence mdw_seq';
comment on column mdw.vc1 is'allow some random text up to 10 characters';
--
desc user_tab_comments

 Name                                                  Null?    Type
 ----------------------------------------------------- -------- ------------------------------------
 TABLE_NAME                                            NOT NULL VARCHAR2(30)
 TABLE_TYPE                                                     VARCHAR2(11)
 COMMENTS                                                       VARCHAR2(4000)

--
select * from dba_tab_comments where table_name='MDW'
/
OWNER                          TABLE_NAME                     TABLE_TYPE
------------------------------ ------------------------------ -----------
COMMENTS
----------------------------------------------------------------------------------------------------
MDW                            MDW                            TABLE
Martin Widlake's simple test table

select * from dba_col_comments where table_name='MDW'
order by column_name
/
OWNER                          TABLE_NAME                     COLUMN_NAME
------------------------------ ------------------------------ --------------
COMMENTS
----------------------------------------------------------------------------------------------------
MDW                            MDW                            ID
simple numeric PK sourced from sequence mdw_seq
MDW                            MDW                            VC1
allow some random text up to 10 characters
-- now to add a big comment so need to use the '-' line continuation character in sqlplus
--
comment on table mdw is 'this is my standard test table.-
 As you can see it is a simple table and has only two columns.-
 It will be populated with 42 rows as that is the solution to everything.'
/
select * from dba_tab_comments where table_name='MDW'
OWNER                          TABLE_NAME                     TABLE_TYPE
------------------------------ ------------------------------ -----------
COMMENTS
----------------------------------------------------------------------------------------------------
MDW                            MDW                            TABLE
this is my standard test table.  As you can see it is a simple table and has only two columns.  It w
ill be populated with 42 rows as that is the solution to everything.
--
/

Adding comments on tables, views and columns seems to have dropped out of fashion over the years but I think it is still a very useful feature of oracle and I still do add them (though I am getting a little slack about it myself over the last 3 or 4 years, which I must stop).

Comments are great, you can put 4000 characters of information into the database about each table, view and column. This can be a brief description of the object, a full explanation of what a column is to hold or even a list of typical entries for a column or table.

But you can’t add a comment on indexes or constraints. Why would I want to? Well, constraints and indexes should only be there for a reason and the reason is not always obvious from either the names of the columns or the name of the constraint or index, especially where you have a naming standard that forces you to name indexes and constraints after the columns they reference.

When you design a database, do a schema diagram or an ERD, you label your relationships between entities/tables. It tells you exactly what the relationship is. You might create an index to support a specific method of access or particular business function. You might alter the index in a way not immediately obvious to the casual observer, such as to allow queries that use the index to avoid having to visit the table. All of those things will, of course, be fully documented in the maintained project documentation in the central repository, available and used by all…

If I was able to add comments to constraints and indexes within the database then they would there. You move the system from one platform to the other, they are there. If for any wildly unlikely reason the central documentation lets you down, the information is always there in the database and easy to check. You may not be able to track down the original design documents but you have the database in front of you, so comments in that will persist and be very easy to find.

Lacking the ability to add comments on indexes and constraints, I have to put them at the table level, which I always feel is a kludge. I might actually raise an enhancement request for this, but as Oracle 12 is already nailed down, it will have to wait until Oracle 14. (A little bird told me Larry said there would be no Oracle 13…).

How deep to dig – Another Opinion and Another Good Blog November 22, 2011

Posted by mwidlake in Blogging, UKOUG.
Tags: , ,
1 comment so far

I think I’ve posted before about how deep a good DBA should dig into solving issues, as opposed to fixing them as soon as possible and moving on to the next urgent task.

Well, a friend of mine, Neil Chandler, has just posted on this topic, giving his reasons why you don’t run a 10046 trace on production. Neil raises some good points about how difficult it can be to get permission to do something as intrusive as a 10046 trace on a production system as well as the fact that most problems can be solved way before you get down to the level of tracing. Especially if it is not your job to go around solving the problems that have stumped the in-house team, which is the lot of many people who are recognised as being very good with Oracle.

That leads me onto a slightly different topic. For every one of those technicians who’s names you know there are at least a dozen who are just as good but not as visible. Some of us choose to make more “noise” {blogging, presenting, writing articles} so we become visible. Others also support the user community but in a less noticeable way, some even positively choosing to keep a lower profile. Neil is one of those. He’s a very good Oracle and SQL*Server DBA and also very knowledgeable about Unix OS’s and SANs/storage {though he would maybe argue he is not – don’t believe him}. When he comes along to the pub his is an opinion worth listening to {once he’s finished demeaning me that is, and I’m sure he will give me a hard time about this article about him next time we meet} and when I’ve asked his opinion he has never failed to help. Neil also supports the UKOUG, he’s been deputy chair of one of the SIGs since it’s inception – but he refuses to be chair, has kept away from presenting and he keeps in the background.

So, I was very happy when Neil started blogging. It is a mixture of technical stuff and observations on the IT world, all written in a very comfortable style – Look back at his previous post on timestamps not being impacted by FIXED_DATE. A nice piece of information to tuck into your bag of “things to be aware of”.

So, a belated welcome to the world of blogging Neil. I think it is a blog worth watching.

Friday Philosophy – OK, so I am on Twitter Now November 18, 2011

Posted by mwidlake in Friday Philosophy, Private Life, Twitter.
Tags: , ,
2 comments

Not a very exciting Friday Philosophy this week I’m afraid, just a self-publicising announcement that I am now on Twitter. I’ve put the wordpress widget on the blog for a while (days or weeks, I don’t know), my twitter name is MDWidlake. {I was a little surprised mwidlake had gone already but that says more about how rare I consider my surname to be than naivety, I hope}. It seems you can click on a part of the widget to follow me, which is a pretty safe thing to do as I am not very verbal as yet.

As I said, I’m not very active at the moment, I’m more following just a few friends and seeing what people use Twitter for. So far it mostly seems to be about:

  • Random stuff posted when bored
  • Complaining about work or, more specifically, tasks that are proving trickier than hoped
  • Drinking
  • Random stuff posted when bored
  • Articles that have caught someone’s eye
  • …or more often, about tweets about articles that have caught someone’s eye
  • Chatty stuff that only makes sense between social peers (and isn’t that one of the main points of something like Twitter?)
  • Random stuff posted when bored
  • Cuddly toys. I think that is a result of low sample size and that Doug Burns is away at a conference. I worry about his sanity sometimes.

Niall Litchfield, Neil Chandler and Doug Burns were right {thanks again for your advice, gents}, there is some nice stuff on there and I’ve already seen some articles and web pages I found interesting via it – but I have also failed to get on with proper work-like stuff I should have been doing as a result.

I also like the chatty extension to real social engagement that Twitter gives but I hold out on my final decision as to whether this makes up for the negative impact it seems to have on real, meeting-in-person socialising.

The interface to Twitter seems a bit, well, rubbish to me. I know, I’ve been on there for all of a week and I am probably missing the Bleedin’ Obvious  but it seems the stuff I see in Timeline, the default view, is just a subset of what people I follow say. I suspect that it’s got something to do with whether the person the tweet is replying to is on my follow list. To understand half the social stuff you have to go clicking around on people’s full tweet history and follow the thread back. Surely there is an easier way than this, maybe some connect-by tree-walk SQL could be invoked…

I’ve already dropped one person off my “following” list. I only followed one celebrity and I decided I could live without the random musings of Simon Pegg. I can imagine people get addicted to following several dozen b to z level celebs, maybe it’s like constantly living in some sort of poor quality reality tv show {Personally I tend to avoid all reality TV, I prefer reality. Except that I am forced to watch that dancing thing on BBC by my wife. And like most men who make that sort of defence, I can’t quite explain away why I still watch it if she is away…}.

So, don’t expect too much in the way of interesting, witty, insightful or even existing tweets from me as yet, but if you want to follow, heck you can always drop me like a sack of manure any time you like :-) .

Skipped Initial Sequence Value on Oracle 11.2 November 17, 2011

Posted by mwidlake in bug, Testing.
Tags: , ,
4 comments

I’m seeing an oddity with newly created sequences skipping the initial value. ie I create the sequence and the first use of it returns the value 2, not 1.

{update, see the post comments and this post by Niall – this is a side effect of delayed segment creation – the first insert silently fails, but gets the sequence, and is repeated behind the scenes once the segment is there. It is fixed in 11.2.0.3, my db is at 11.2.0.1 as I got sick of the download of the latest version failing on my poor broadband connection and got it off a mate – turns out it is not the latest version.
Thanks for the enlightenment Niall.}

This is on Oracle 11.2.0.1 on Windows (XP, Vista and now Windows 7 64 bit). I am sure I did not see this on Oracle 10.1 and 10.2 on linux, Tru64 and windows.

I create a set of test tables for when I run courses or just want to test some things, a few tables holding people, names, addresses, phone calls and monthly call summaries. I do this with a bunch of pretty crude scripts that create the data in steps. Only on Oracle 11.2 it all stopped working. I tracked down the problem to the skipping of the first value for the first sequence I create and use. I’ve just confirmed this on a new server I have created.

I’ve boiled it down to the following test case. I ensure my test table and two sequences are not there, create them and then insert 10 records for men and 10 for women. For the women the records are numbered 1 to 10. For the men they are numbered 2 to 11!!!

My code:

-- seq_oddity.sql
-- BUG ON 11.2.0.1 ??
-- though I create both sequences afresh, the first use of seq_m is getting 2, yes two!
-- cannot work out why, so fixed by setting the row with forn_id of 130 to 1.
set timi off
spool seq_oddity.lst
--
drop table test_fn purge;
drop sequence seq_m;
drop sequence seq_f;
create table test_fn
(forn_id number(5) not null
,forname varchar2(30) not null
,sex_ind char(1) not null)
tablespace users
/
create sequence seq_m;
create sequence seq_f;
insert into test_fn values (seq_m.nextval,'ALAN','M');
exec dbms_output.put_line ('I have just created male name number '||seq_m.currval);
insert into test_fn values (seq_m.nextval,'BARRY','M');
insert into test_fn values (seq_m.nextval,'CHRIS','M');
insert into test_fn values (seq_m.nextval,'DAVID','M');
insert into test_fn values (seq_m.nextval,'EDWARD','M');
insert into test_fn values (seq_m.nextval,'JANG','M');
insert into test_fn values (seq_m.nextval,'GARY','M');
insert into test_fn values (seq_m.nextval,'HARRY','M');
insert into test_fn values (seq_m.nextval,'IAN','M');
insert into test_fn values (seq_m.nextval,'JAMES','M');
exec dbms_output.put_line ('I created 10 men and last value was '||seq_m.currval);
--
--
--
insert into test_fn values (seq_f.nextval,'ALISON','F');
exec dbms_output.put_line ('I have just created female name number '||seq_f.currval);
insert into test_fn values (seq_f.nextval,'BARBARA','F');
insert into test_fn values (seq_f.nextval,'CHERYL','F');
insert into test_fn values (seq_f.nextval,'DAWN','F');
insert into test_fn values (seq_f.nextval,'ELAINE','F');
insert into test_fn values (seq_f.nextval,'FRANCIS','F');
insert into test_fn values (seq_f.nextval,'GILLIAN','F');
insert into test_fn values (seq_f.nextval,'CHERRY','F');
insert into test_fn values (seq_f.nextval,'INGRID','F');
insert into test_fn values (seq_f.nextval,'JANET','F');
exec dbms_output.put_line ('I created 10 women and last value was '||seq_f.currval);
--
select sex_ind,min(forn_id),max(forn_id)
from test_fn
group by sex_ind/
--
spool off

The results are:

mdw11> @seq_oddity
drop table test_fn purge
           *
ERROR at line 1:
ORA-00942: table or view does not exist

drop sequence seq_m
              *
ERROR at line 1:
ORA-02289: sequence does not exist

drop sequence seq_f
              *
ERROR at line 1:
ORA-02289: sequence does not exist

Table created.

Sequence created.

Sequence created.

1 row created.

I have just created male name number 2

1 row created.
1 row created.
...
1 row created.

I created 10 men and last value was 11


1 row created.

I have just created female name number 1

1 row created.
1 row created.
...
1 row created.
I created 10 women and last value was 10


S MIN(FORN_ID) MAX(FORN_ID)
- ------------ ------------
M            2           11
F            1           10
2 rows selected.

mdw11>

I suppose I should trace this and check for known oracle bugs but I wondered if anyone else had seen it.

Follow

Get every new post delivered to your Inbox.

Join 116 other followers