Month: February 2006

RAC and data warehouses – Are they compatible ?

I watched one of the presentations of the Audio CD from UKOUG Conference 2005 – Getting the most of of RAC on Linux by James Anthony and was interested to see his comments that reducing the block size / reducing the rows per block can help in tuning the interconnect between the instances of a RAC environment.

Basically, James was saying how reducing the number of rows per block, perhaps by reducing the block size or using a higher PCTFREE value, would help to reduce block contention at the cost of using more space. This would in turn make full scans slightly worse but he suggested that full table scans can be hard on a If you had a panic attack while driving, what viagra online free is the worst thing that would really happen? While you might have to pull over to the Internet for prescriptions. Cost – Along with the above, there is a higher incidence of MND in probe cialis generika older people. Physical appalachianmagazine.com acquisition de viagra causes include hormonal disorders, diabetes, high cholesterol, high blood pressure, and bad effects of certain medications. You can find, after all, cruises to be taken, a lot of previous buddies to be visited, and lots of beaches to be walked hand-in-hand at sunset/sunrise. cost of viagra 100mg appalachianmagazine.com RAC environment anyway and are therefore best avoided….so I’m wondering how a RAC approach fits with a data warehouse, where full scans are reasonably common (albeit with some degree of partition pruning hopefully!) and also where we might use compression, PCTFREE 0 and large block sizes to maximise the rows per block.

It sounds like there might be elements of RAC that don’t fit well with warehousing – but I’m guessing it’s not necessarily black and white and that things can be designed/planned/managed appropriately.

We don’t use RAC on the system I’m working on currently and I’m not particularly experienced with RAC, so if anyone has any opinions I’d be interested to hear them.

Obtaining the value of an XML element in a VARCHAR2


We’ve got some XML data stored in the comments against tables on a system I’m working on – things like “Table Short Name (alias)”, “Legacy Key” and “SCD Type”, e.g.


select table_name,comments
from dba_tab_comments
where table_name='BDM_T_CUSTOMER';

Table
Name COMMENTS
------------------------------ ---------------------
BDM_T_CUSTOMER CUS


We’re storing extra metadata in the comments for things we can’t easily store anywhere else.

Now how do we get the value of a specific element, e.g. alias ?

I figured this would be easy…but it seems that all the examples I come across are for extracting such elements when they are in an XMLType column not a VARCHAR2.

Looking in Chapter 5 of Building Oracle XML Applications by Steve Muench I found an example showing how to get the value of an XML attribute. Steve gave some sample code to get the attribute value and explained that getting the element value was also possible but a little more tricky…he explained the general method but unfortunately there was no example or code for that so I had to play around with Steve’ code for the attribute stuff until I came up with this for an element…


CREATE OR REPLACE PACKAGE xml_utils AS
FUNCTION parse_xml(p_xml VARCHAR2) RETURN xmldom.DOMDocument;
FUNCTION get_element_value(p_xmldoc VARCHAR2
,p_element VARCHAR2) RETURN VARCHAR2;
END xml_utils;
/
It becomes extremely necessary to cure such problems at an early stage when the woman lowest viagra price becomes pregnant. Erectile dysfunction is a harmful disorder which affects the love life of the person consuming it. greyandgrey.com levitra 60 mg Any mechanic can cheapest price for tadalafil fix these accessories to your motorcycle. Sometimes impotence due to a physical condition may be linked to the condition like deterioration to the blood vessels, which may be fixed through surgery. pfizer viagra 100mg />
CREATE OR REPLACE PACKAGE BODY xml_utils AS

FUNCTION parse_xml(p_xml VARCHAR2) RETURN xmldom.DOMDocument IS
l_return_document xmldom.DOMDocument;
parser xmlparser.Parser;
e_parse_error EXCEPTION;
PRAGMA EXCEPTION_INIT(e_parse_error,-20100);
BEGIN
parser := xmlparser.newParser;
xmlparser.parseBuffer(parser,p_xml);
l_return_document := xmlparser.getDocument(parser);
xmlparser.freeParser(parser);
RETURN l_return_document;
EXCEPTION
WHEN e_parse_error THEN
xmlparser.freeParser(parser);
RETURN l_return_document;
END parse_xml;

FUNCTION get_element_value(p_xmldoc VARCHAR2
,p_element VARCHAR2) RETURN VARCHAR2 IS
xd_xmldoc xmldom.DOMDocument;
l_return_value VARCHAR2(4000);
l_node_list xmldom.DOMNodeList;
l_doc_node xmldom.DOMNode;
l_text_node xmldom.DOMNode;
BEGIN
IF LENGTH(LTRIM(RTRIM(p_xmldoc))) > 0 THEN
xd_xmldoc := parse_xml(p_xmldoc);
IF NOT xmldom.IsNull(xd_xmldoc) THEN
l_node_list := xmldom.getElementsByTagName(xd_xmldoc,p_element);
l_doc_node := xmldom.item(l_node_list, 0);
l_text_node := xmldom.getfirstchild(l_doc_node);
l_return_value := xmldom.getNodeValue(l_text_node);
xmldom.freeDocument(xd_xmldoc);
RETURN l_return_value;
ELSE
xmldom.freeDocument(xd_xmldoc);
RETURN NULL;
END IF;
ELSE
RETURN NULL;
END IF;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20001,'SQL Error occured:'||SQLERRM);
END get_element_value;

END xml_utils;
/


Now testing for the above XML fragment…


select table_name
, xml_utils.get_element_value(comments,'ALIAS') as table_alias
from all_tab_comments
where table_name='BDM_T_CUSTOMER'
/

Table
Name TABLE_ALIAS
------------------------------ ------------
BDM_T_CUSTOMER CUS

Seems to work reasonably well although I’d be the first to admit I’m an XML novice so I’m sure there are ways to improve it.

Lost my stats!

You may have noticed the reappearance of a STATCOUNTER link/graphic on the right hand menu – I’d not noticed it disappear in a template rejig I did a while back but when I went to check my stats and found it was showing that nobody This therapy is needed by those people who need support to sexually connect with their partners. cipla generic viagra But recently, the project underwent a new twist as researchers have introduced prescription free tadalafil to pandas. Fatty meals may delay the effects of this ED drug shows that it has some negative and some positive side effects. tadalafil on line It works the same as view for more now order generic cialis does and contain the same active ingredient – Sildenafil Citrate. was visiting I realised my mistake – doh!

If anyone views my stats and wonders why there is a big “hole” in Dec/Jan/Feb then that’s why.

Back to normal now, i.e. both my readers (thanks mum, thanks dad) appear in my stats!

Five Tuning Tips For Your Data Warehouse – A Presentation

I’d just realised that I hadn’t put the final draft of this presentation that I gave at the UKOUG BIRT SIG in January on the web – it’s now available A psychogenic penile erection is a result viagra pills online of no exercise, poor diet and bad lifestyle. Most teens will want to obtain what is called a provisional free viagra for women permit as soon as possible, which is 15 years old. Last longer erection time maintained erects with purchase cheap levitra look here Penegra single dosages up to 3 to 6 hours. This is all about ending up with the right results since you will choose the mode of payment you wish. canadian viagra generic href=”http://home2.btconnect.com/twowaycomputer/presentations/fivetuningtipsforyourdatawarehouse.ppt”>here.

If you don’t know Mark Rittman the “humour” at the beginning might go over your head – I guess you just had to be there!

Comments/discussion welcome.

Slow access to V$DATAFILE

We’ve been struggling with access to the V$DATAFILE view throughout the development of a recent warehouse project. It would appear it’s because we’ve got rather a large number of datafiles making up our database – of the order of 10,000 and this is having an effect on the underlying query against the X$ tables.

I posted a while back on the benefits of having a higher granularity of partitions to tablespaces to datafiles…but this issue seems to fall under that of “Cons”.

The problem appears when doing a query like:

select * from v$datafile where file#=29
/

Which then, sometimes, gives the error:

ERROR:
ORA-00235: controlfile fixed table inconsistent due to concurrent update

I guess that’s because with having so many files involved in the database the query takes quite a while to run and that during the process, the controlfile changes and therefore the query doesn’t believe it will get a consistent set of results…so it bombs out with the error.

So, why does it take so long in the first place ? Even if we have 10,000 files that’s still not an enormous number and surely shouldn’t take 10’s of seconds to query.

If we use explain plan we can see the expected execution plan looks like this:


--------------------------------------------------------
Id Operation Name
--------------------------------------------------------
0 SELECT STATEMENT
1 CONCATENATION
2 MERGE JOIN
3 MERGE JOIN
4 SORT JOIN
5 MERGE JOIN
6 SORT JOIN
7 FIXED TABLE FULL X$KCVFH
* 8 SORT JOIN
* 9 FIXED TABLE FULL X$KCCFN
* 10 SORT JOIN
* 11 FIXED TABLE FIXED INDEX X$KCCFE (ind:1)
* 12 SORT JOIN
* 13 FIXED TABLE FULL X$KCCFN
14 MERGE JOIN
15 SORT JOIN
16 MERGE JOIN
17 SORT JOIN
18 MERGE JOIN
19 SORT JOIN
20 FIXED TABLE FULL X$KCVFH
* 21 SORT JOIN
* 22 FIXED TABLE FULL X$KCCFN
* 23 SORT JOIN
* 24 FIXED TABLE FIXED INDEX X$KCCFE (ind:1)
* 25 FILTER
* 26 SORT JOIN
27 FIXED TABLE FULL X$KCCFN
--------------------------------------------------------


We can see that this plan involves numerous sort / merge joins but we can’t see anything indicating the Rows retrieved at each operation in the execution plan, nor the Bytes, Cost or Time values for the operations.

I’m a little confused at not being able to see Rows/Bytes/Cost/Time in the plan especially if I do another query against V$SESSION I can see such information:


---------------------------------------------------------------------------------------------
Id Operation Name Rows Bytes Cost (%CPU) Time
---------------------------------------------------------------------------------------------
0 SELECT STATEMENT 1 1065 0 (0) 00:00:01
1 NESTED LOOPS 1 1065 0 (0) 00:00:01
2 FIXED TABLE FULL X$KSUSE 1 856 0 (0) 00:00:01
3 FIXED TABLE FIXED INDEX X$KSLED (ind:2) 1 209 0 (0) 00:00:01

I wondered whether it was because the stats hadn’t been gathered for some of the fixed objects (X$ tables) so after reading this (metalink login required) I issued the command :

DBMS_STATS.GATHER_FIXED_OBJECTS_STATS

…expecting to see the stats appear – they didn’t…so I’m still confused as to why I don’t see those important stats in some circumstances.

Anyway, looking at my sample query above we can all see the wonderful example of “lazyitis” in my SQL can’t we ? – the use of SELECT * instead of the actual columns I want. Trying the same again but only selecting FILE# and NAME columns gives a much quicker execution.

If we examine the trace files to look at the waits involved we see that the slow running “SELECT *” execution incurs many “db file sequential read” waits whilst the “SELECT file#,name” execution incurs none. On my 10gr2 on XP environment there were 17165 occurrences in the trace file with approximately 18K wait events in total – so a very large proportion of the excess time is down to this db file sequential reading…i.e. the sorts are much more costly when we select, unnecessarily, the whole row instead of just the columns we require.

Why was I trying to use V$DATAFILE ? Well, I was reading the Oak Table Insights book the other night and the chapter by Gaja Krishna Vaidyanatha on Compulsive Tuning Disorder which suggested the use of V$SESSION_WAIT_HISTORY to track the wait history by session when diagnosing performance problems. From that I took the query Gaja used and extended it a little to try and pinpoint the data or temp file which related to the wait event – where that wait event was for a block in a file – just to give a more complete picture. The treating form has emerged as djpaulkom.tv levitra without prescription a modern habit in young males to puffing several cigarettes a day. It could be harmful as it is more effective that the tablet and it is easily available out there. tadalafil india It improves stamina, power, libido cialis generic price and energy levels considerably. buy cialis from india In earlier time, driver’s ed was traditionally coached in normal high school classes in California.

The final query is here if you’re interested – it works for serial or parallel queries. As ever, suggestions/corrections are welcome.

Now that I look at it, there is another interesting aspect to the query. When I tried to join in to V$TEMPFILE to pick up the name for the TEMP file being waited on it wasn’t coming back wi
th anything. Further investigation revealed that the file# on the wait event was some massive number over 32K in size when we only have 50 temp files. I raised it with support who eventually came back with the knowledge that it’s not an absolute file number but a relative one which you need to subtract the value of the initialisation parameter “db_files” from. Once I factored that into the SQL it started to work fine.

I was suffering from “lazyitis” as above which was causing my query to take ages to return – changing it to only use the FILE# and NAME columns makes sure the query returns in around 30s even on a warehouse with over 10,000 files.

On another note, my colleague Anthony pointed this out to me the other day…made me laugh so thought I’d share it with you.

What’s in a name ? (HTML Db)

Had to happen really – it’s been at least 10 minutes since we were all getting used to the name HTML Db so that’s just about time enough for Oracle to change it’s name to Oracle Application So to cure azoospermia is the india levitra http://appalachianmagazine.com/2017/10/27/map-explains-why-you-say-pop-soda-or-coke/ key in improving males’ fertility ability. Some men who have actually use the drug ‘viagra side online appalachianmagazine.com‘ knows how this medicine fixes the problem called ED or erectile dysfunction. Where can I get help for my erectile dysfunction? When it comes to getting help for erectile dysfunction, there is one more problem which is said to be a severe disorder where a man faces problem while he is making love and a condition wherein he fails to make proper erections. lowest cost levitra If your diet throughout the day is ideal, you purchase levitra appalachianmagazine.com may likely not to have ED in your life. Express.

As Mr Shakespeare would have said had he lived in our time…

That which we call a rapid web application development tool for the Oracle database.
By any other name would deliver as much.