Showing posts with label gotcha. Show all posts
Showing posts with label gotcha. Show all posts

Wednesday, October 6, 2010

OBIEE 11G: Connection Gotchas

Doing a quick PoC, I've had to spin up 11g on very short notice. While anarchy is fun, I typically prefer a more guided approach.

Despite not reading documentation ahead of time (much), there is a method to my madness. I learn best by breaking stuff...multiple times.

So, there I am, fresh from exporting from Discoverer then migrating that RPD from 10g to 11g...configuring the Connection Pools. I select a random table and then hit View Data.



Awesome. Very descriptive.

I tried using the BI ODBC Client tool to test the connection.



Awesomer.

Using the Google Machine, I found this reference to Visual Basic (is that really still used?).

Let's try looking something else up (like the documentation you say?). Actually, I didn't find it, a colleague did.

Over on the Siebel Essentials blog, tip #4 for OBIEE 11g, Connections.

To sum it up, you can either use the tns entry as the Data Source Name or you must put a tnsnames.ora file in the <ORACLE_HOME>\OracleBI1\network\admin folder.

Awesomest.

Wednesday, July 7, 2010

OBIEE: Gotcha #5

Or the CHAR edition.

A report writer asked me why this report isn't returning any rows. So I brought up the report, ran it, then grabbed the SQL, when I saw this:
AND concat( concat( T364349.DEV_CD, ' - ' ), T359839.DEV_DESC ) = 'DLC        -Developer conflict'
Yeah, that's a bunch of spaces between "DLC" and the "-". Most likely the cause of the problem.

Took a look at the database and sure enough, it was defined as a CHAR(10).

This was already a "view" in that it was a stored SQL statement or Table Type of "Select".

I then added the TRIM function to both the code and the description. I didn't bother to test it because surely, this would work.

Later in the evening I went to the report to see if I could help with a different problem. No data was coming up. I opened it up to all time ranges and all lines of business...nothing.

I asked the dev if he had changed anything today. Nope.

Hmm...

I can "View Data" on the table (with the TRIM). I went ahead and removed it anyway. Now the report works. WTF?

Repeated this process a couple of times just to make sure and that was it. The TRIM function in the SELECT statement was causing issues. No warnings or errors though.

I guess the good news is I learned how the TrimTrailing function in OBIEE works now. It's not just:
TRIMTRAILING( column_name )
like I would have thought, it acts more like a substring:
TRIM( ' ' FROM column_name )
I just love these little things that can drive you nuts.

Thursday, June 24, 2010

OBIEE: Gotcha #4

Database Features

This may have been self inflicted, there is really no way to know. This is somewhat related to Gotcha #1.

The Problem

We kept tipping over the development database with only 10 or so people on it. The DBAs said we weren't including the date predicate on any of our tables. How could that be? (Quick aside, this problem is compounded; in that we have no summary tables and close to 2 billion records in the fact table). So instead of pulling back say, 100K records, we were pulling back 23 million. Yikes.

I started to pour through the query logs and confirmed that none of the physical SQL statements had any date predicates. Ouch.

But wait, reviewing the BI Server execution plan, the date filter was there...the catch was that the BI Server was filtering. Not good. The BI Server is not built to filter on some 23 million records. Most of us know that we should filter as much as possible, with Exadata pushing that concept down to storage.

Being responsible for the metadata, I naturally assumed this was somehow my doing.

So my colleague, Frank Davis, fired up a GoToMeeting session and we poured over the logs and anything we could find. We spent a few hours last night to no avail.

With a partial nights sleep, I began to use one of Frank's methods to further eliminate the offending table (possibly). Since it was the date predicate, I started with Time.

First, I pulled in Fiscal Year and created a filter for 2010. Ran the report, checked the log and the filter was in the physical SQL.

Next, Fiscal Week. Followed the same process, added the column, the filter and checked the log. It was there.

Finally, I brought over Calendar Day, created the filter, ran the report and checked the log. It wasn't there. WTF? I could see it in the execution plan, but not in the physical SQL.

Then Frank and I got back on a shared session and Frank had an idea...

The Solution

Frank wondered aloud about the database features, specifically, which were turned on.

If you aren't familiar with that, in the property section of the physical database, under the Features tab, you'll see the list of values, like this:

database features

See the ones I am pointing to? DATE_LITERAL_SUPPORTED? Yeah, that was turned off. Quite a few were turned off in fact. Frank found the guide for setting up the features on our particular database (Neoview) and we went through and turned everything on that was recommended.

I reran my small test and voila! The date predicates were being pushed to the database. Ran some of the other offending reports and verified that they too were passing the date predicates.

I don't know if I somehow reset the database features or if someone else did. I'll never know in fact (yes, bigger problem). Thankfully it was only in a development environment so the impact was minimal.

Thursday, June 3, 2010

OBIEE: Gotcha #3

I received this wonderfully informative error this evening:

Promotion of checkout lock on Value to exclusive failed.

Value[nQSError: 36006] Promotion of checkout lock on Value to exclusive failed.

Lacking an Oracle Support login...I ventured to Google. Just like the error, it was wonderfully uninformative.

Log files?

Nothing.

This halted all development for me. Not all, I could make one change, check it in (save) and then I would get that error again. Wonderful.

From what I could piece together, and this is the purest form of speculation, it had something to do with naming.

I had a Physical database named "LOV"
I had a couple of columns (different tables) in another database with the same name.
These were all combined into one subject area.
Therefore that had to be the issue.

Or not. Who knows?

How did I fix it?

Shutdown the BI Server, opened up the RPD in read-only mode, did what I had to do and saved it...no error. Sweet.

Fired up the BI Server, opened up the RPD...you can only open this in read-only mode. WTF?

Let's try this again.

Shutdown.

Start.

Login. Success!

I almost followed the universal Windows rule of rebooting 3 times...almost.

Thursday, May 20, 2010

OBIEE: Gotcha #2

This one bit me hard today and it shouldn't have. I should have followed my instincts...instead I trusted the tool. ID10T.

So here we go.

We use the Filters in the Security tool which can apply predicates based on the Group.

First, open up the Security Manager

security

You should see this
security

Then click on Permissions
security

I then, like an ID10T used the Expression Builder to build my predicate. This was a BETWEEN, so I went to Operators and found the BETWEEN and double clicked on it. Can you see what it did?
security

How about now?
security

That's right, it says "Upper Bound" first followed by "Lower Bound"

I knew that wasn't right...but I went with it anyway.

After the "mistake", I verified in SQL.
SQL>EXEC :C := 20;

PL/SQL procedure successfully completed.


C
----------
20

SQL>SELECT * FROM DUAL WHERE :C BETWEEN 40 AND 10;

no rows selected

Elapsed: 00:00:00.18
SQL>SELECT * FROM DUAL WHERE :C BETWEEN 10 AND 40;

D
-
X

1 row selected.
Live and learn I guess. I'll never trust that thing again. One more reason to dislike GUIs.

Tuesday, May 11, 2010

OBIEE: Gotcha #1.1

Another, funny in hindsight, continuation on Gotcha #1.

Sadly I can't speak to the specifics of what I was doing but it did involve the coolest thing ever, Exadata.

We ran into some problems when are reports weren't returning the correct results. Specifically, year over year data (last year's).

I suspected one thing, someone else suspected another and a third person got it right.

Turns out, we had added a "blank" logical column to the RPD. Not sure of the exact reason why or what was trying to be accomplished, but there it was.

As I dug through the physical SQL, I noticed a bunch of '' (that's back-to-back single quotes), essentially an empty string. I have read on how Oracle handles empty strings and how many vendors deal with NULL values differently, so I suspected this was the cause. My first thought wasn't correct though.

First a sample of how Oracle handles both empty strings and NULL values in a WHERE clause.
CJUSTICE@TESTING>SELECT * FROM dual WHERE '' = '';

no rows selected
So comparing an empty string to itself evaluates to false.
CJUSTICE@TESTING>SELECT * FROM dual WHERE NULL = NULL;

no rows selected
Of course everyone knows that NULL is the absence of value, so comparing it to itself evaluates to false.

My original thought was that somehow the '' (empty string) was being used in the GROUP BY clause...but that didn't make much sense as even if it was used, it would be the same "value" as in the SELECT.

Then I saw it...after digging through 500 lines of OBIEE generated SQL, there it was.

In the first Gotcha, I had been capturing physical SQL not tuned specifically for Oracle...it was just using a generic ODBC connection. I'm glad I made that mistake though, because I had all that SQL.

For this specific report using the generic ODBC connection, 4 queries were sent to the database and stitched in OBIEE to display the reports.

When the driver was switched to an Oracle specific one, it create one giant WITH statement. Actually, it was about 8 different WITH statements...which made it hard to analyze because of the dependencies on previous WITH statements in the same SQL.

I found it be running the first 2 SELECT statements individually. I got the results from this year and the results from last year. Perfect. But it added to the Why? of what was going on.

Further down in this massive SQL statement, I found 2 FULL OUTER JOINs. Could it be? Could it really be joining on that '' column?

Yes it could and it would explain exactly why incorrect results were being returned.

Per the example above, when comparing an empty string against itself, the expression evaluates to false...so the table being joined to would never return results.

We decided to add a character to it, a dot (.) and sure enough, the correct results returned.

Another realization after the fact (made by my colleague), was that using an Oracle database would decrease the number of queries being sent to the database thus allowing for more connections and less work by the BI Server. Super win!

Tuesday, April 27, 2010

OBIEE: Gotcha #1

When generating SQL for testing, make sure you set the database to the database you will be running against.

I found this out the fun way, of course, by going through, grabbing the SQL from the logs, and then modifying said SQL to run against Oracle. I should have paid attention to that "Check Consistency" warning.



I spent an hour or so "fixing" the SQL, removing stuff like the following:
fn ifnull
{ curly brackets }
d '2004-04-10'
ts '2004-04-10 13:44:39'
mostly small stuff, but annoying none-the-less. Strangely (to me anyway), this was the SQL submitted to an Oracle database...without errors. I'm guessing that somewhere, either in OBI or in the driver itself, the SQL is rewritten.

After I realized what had happened, I went back into the RPD and updated the database properties.



It was ODBC basic



I changed it to Oracle 10R2/11g



I tried the Consistency Check again and still received the warning. Opened up the database properties again and selected the Features tab



Then selected "Revert to Defaults"



Run the Consistency Checker again and voila!



So don't waste your time like I did. Make sure you use the Consistency Check Manager and make sure your database defaults match.