Wednesday 15 June 2011

Copy statistics from one Oracle schema to another

Sometimes statistics are needed to optimize an initial workflow or data load in an empty Oracle schema when large volumes of data are about to be processed. To accomplish this you can import statistics from another schema where said workflow has already run.

Assuming the schema where you will store the stats to be imported is called "TEMP_STATS_SCHEMA" and you have a source schema called "SOURCE_SCHEMA" and a target schema called "TARGET_SCHEMA", the command syntax is as follows:

exec dbms_stats.create_stat_table(ownname => 'TEMP_STATS_SCHEMA', stattab => 'TEMP_STATS_TABLE');
exec dbms_stats.export_schema_stats(statown=> 'TEMP_STATS_SCHEMA', stattab => 'TEMP_STATS_TABLE', ownname => 'SOURCE_SCHEMA');
update TEMP_STATS_SCHEMA.TEMP_STATS_TABLE set c5 = 'TARGET_SCHEMA' where c5 = 'SOURCE_SCHEMA';
commit;
exec dbms_stats.import_schema_stats(statown=> 'TEMP_STATS_SCHEMA', stattab => 'TEMP_STATS_TABLE', ownname => 'TARGET_SCHEMA');

Wednesday 19 January 2011

Why the Software Craftsmanship Manifesto is a load of crock!

I just read Martin Fowler's "Craftmanship and the Crevasse" & Dan North's "Programming is not a craft" and I've gotta say, I’m proud of having been aware of the SCM since its early days and having not signed it despite having some respect for those who wrote it. I’m a tradesman not a craftsman and I’m proud of writing software that works while delivering it on time and to budget. The manifesto and I agree on absolutely nothing. The priorities are the wrong way around. The complete opposite of my values.
SCM: Not only working software, but also well-crafted software
Me: Well-crafted software is nice. Working software is imperative.
A good looking bridge is no better at crossing rivers than an ugly one. And lets face it, the point of a bridge is getting from A to B reliably, not beautifully.
SCM: Not only responding to change, but also steadily adding value
Me: Steadily adding value is nice. Responding to change is imperative.
Inability to respond to change is like being a plumber who left his adjustable wrench at home whilst steadily adding value is like being the plumber who’s been under the damn bath polishing the copper pipes for the last 3 hours and still hasn’t replaced the washer seal.
Don't forget as well, that "Steadily adding value" means change to the code base. Changes need to be tested, testing takes time, time is money. Do you remember what your granddaddy said after "If it ain't broke..."? If you're constantly tinkering with working software and your change is creating work for testers and release people, are you really adding value or are you just creating work?
SCM: Not only individuals and interactions, but also a community of professionals
Me: A community of professionals is nice but you can’t have one without individuals and interactions.
The developer community has as much appeal to it’s business customers as a Vegas dentists convention has to the gamblers at the slot machines. Your community of professionals makes you feel  intelligent and big and clever amongst other big and clever people. It does not add value for your customers or help them sleep better at night.
SCM: Not only customer collaboration, but also productive partnerships.
Me: Productive partnerships are nice but businesses do not function without customers.
Saying partnerships are more valuable than collaboration is like saying marriage produces better babies than sex.
For the record, the Agile Manifesto and I, agree on absolutely everything. Also for the record, this post reflects my programming ethics which are biased by the fact that I am a contractor, freelancer and mercenary. There are a lot of software craftsmen out there making our industry a better place to work because of their very different ethics. I respect them, I just have different reasons for being a developer.