Systems Engineering and RDBMS

Archive for January 28th, 2007

Troubleshoot Your Windows Event Viewer Entries with EventID.Net

Posted by decipherinfosys on January 28, 2007

As all of you are well aware, there are countless numbers of websites, freeware, shareware, as well as pay software designed to help you troubleshoot Windows server infrastructures. Some of these tools are more effective than others. However, there is one website in particular that has proven to be a very helpful partner:  

EventID.net http://www.eventid.net/  

The reasons for posting a blog regarding this website is not only because it is an effective source of information, but it is also rather surprising how many IT professionals are unaware of this site.  

The concept is quite simple. You can search for information on Windows Event Viewer messages, errors, or warnings by entering the event ID and/or the event source. The user is then presented with a wealth of information. First you will see a summary of search results. For example, if one searches on event ID only, the summary will list all sources which could generate that particular event ID number. Once the desired source has been selected the user is presented with a number of entries from various IT professionals describing their experiences with that particular event, and what actions they took to resolve the issue that triggered the event. In addition, each event ID result provides one or many direct links to related Microsoft knowledgebase and troubleshooting articles.  

There is a subscription fee for this service, ranging anywhere from $9.00 for three months to $24.00 for one year.  

Check it out EventID.Net for yourself – hopefully it will assist you in your troubleshooting efforts.

Posted in Windows | Leave a Comment »

Case insensitive behavior in Oracle

Posted by decipherinfosys on January 28, 2007

Oracle install is typically case insensitive i.e. a column that has a uniqueness constraint enforced on it can have “RAM”, “ram”, “Ram” or any different upper and lower case combinations in it.

Both SQL Server and Oracle can be made to behave differently (as compared to their default behaviors of CI and CS respectively) and there are multiple ways and multiple levels (instance, database, table, column and query) at which that change can be made in SQL Server. In Oracle 10g, these changes can be made at the session level or database level.

Till Oracle 9i, there was no other choice in Oracle to make it work like in SQL Server other than to ensure that your application handles it correctly (or two kludges which you don’t want to know :-) since those have performance implications since one has to use FBI (Function Based Indexes) for all such searches and depending upon how your application is written, it will require application changes as well…and there was one other kludge as well to play with NLS_xxx parameters to hack around it).

An Oracle customer is used to seeing “RAM” as well as “ram” in the same “user_name” column which has a uniqueness constraint enforced on it, where as in the default CI (case insensitive) install of SQL Server, a SQL server customer would expect only a single record.

In Oracle, the NLS change can be made at the database level but if you have multiple applications using different schemas on the same Oracle database and require a different behavior, then these changes should not be made at the database level. In 10g, the **elegant** way of handling this is by making changes at the session level but this will effect every search for that session. Let’s take a example to illustrate this behavior at the session level in Oracle:

create table TEST ( COL1 varchar2(100) );
insert into TEST values ( ‘RAM’ );
insert into TEST values ( ‘ram’ );
insert into TEST values ( ‘rAm’ );

alter session set nls_comp=linguistic ;
alter session set nls_sort=binary_ci;

variable a varchar2(25)
exec :a := 'RaM';

SQL> select * from TEST where COL1 like :a;

COL1
——————————————————–
RAM
ram
rAm

SQL> select * from TEST where COL1 like :a || ‘%’;

COL1
——————————————————–
RAM
ram
rAm

SQL> select * from TEST where COL1 = :a ;

COL1
——————————————————–
RAM
ram
rAm

Caveats ? :-)

Yes, there is one. You need to create your indexes using the same NLS_SORT..example: If you create only a normal index :

create index test_ind_1 on test (col1);

And then dump a bunch of records into this table to ensure that the filter criteria is meaningful and that the number of blocks are large enough to warrant an index search criteria…and of course collect the stats:

SQL> SELECT COUNT(1) FROM TEST;
COUNT(1)
———-
232674

SQL> alter session set nls_comp=linguistic ;
Session altered.

SQL> alter session set nls_sort=binary_ci;
Session altered.

SQL> SELECT COUNT(1) FROM TEST WHERE COL1 = ‘RaM’;
COUNT(1)
———-
3

SQL> set autotrace traceonly
SQL> /
Execution Plan
———————————————————-
0 SELECT STATEMENT Optimizer=FIRST_ROWS (Cost=109 Card=11 Bytes=242)
1 0 TABLE ACCESS (
FULL) OF ‘TEST’ (TABLE) (Cost=109 Card=11 Bytes=242)

Now, let’s drop and re-create the index using nls_sort:

drop index test_ind_1;
create index test_ind_1 on test ( nlssort( col1, ‘NLS_SORT=BINARY_CI’ ) );

Begin
Dbms_Stats.Gather_Table_Stats(User,’TEST’,
Method_Opt=>’For Table For All Indexes For All Indexed Columns’,
Cascade=>True);
End;
/

And now, re-try the execution plan:

SQL> /
Execution Plan
———————————————————-
0 SELECT STATEMENT Optimizer=FIRST_ROWS (Cost=3 Card=10 Bytes=230)
1 0 TABLE ACCESS (BY INDEX ROWID) OF ‘TEST’ (TABLE) (Cost=3 Card=10 Bytes=230)
2 1 INDEX (RANGE SCAN) OF ‘TEST_IND_1′ (INDEX) (Cost=1 Card=28)

As you can see from the change in the execution plan above, the plan now uses a range scan instead of a FTS. If at all you have a requirement to have case insensitive behavior in Oracle, you can use these techniques.

Posted in Oracle | 1 Comment »

Difference between UTF8 and AL32UTF8 character sets in Oracle

Posted by decipherinfosys on January 28, 2007

Recently, one of our clients had a question on the differences between these two character sets since they were in the process of making their application global.  In an upcoming whitepaper, we will discuss in detail what it takes (from a RDBMS perspective) to address localization and globalization issues.  As far as these two character sets go in Oracle,  the only difference between AL32UTF8 and UTF8 character sets is that AL32UTF8 stores characters beyond U+FFFF as four bytes (exactly as Unicode defines UTF-8). Oracle’s “UTF8” stores these characters as a sequence of two UTF-16 surrogate characters encoded using UTF-8 (or six bytes per character).  Besides this storage difference, another difference is better support for supplementary characters in AL32UTF8 character set.

 

Posted in Oracle | 1 Comment »

New “How-To” articles posted

Posted by decipherinfosys on January 28, 2007

Three new “How-To” articles have been posted on our site today:

  • How can I extract the day, month or year from a date field?
  • How can I return a record set from a stored procedure to the client application?
  • How can I see whether triggers are enabled or disabled in SQL Server?

You can access the complete list of existing “How-To” articles on this URL:

http://www.decipherinfosys.com/faq-home.htm

Posted in Decipher News | Leave a Comment »

Returning effected rows by DML statements in Oracle and SQL Server 2005

Posted by decipherinfosys on January 28, 2007

A new whitepaper has been posted our site. This one looks into the new functionality that has been delivered in SQL Server 2005 (the Output clause) and the Returning clause in Oracle (and the enhancements to it in 10g version) to return the effected rows by DML statements. This can help in many different ways – archiving as well auditing of the data as well as sending the data set back to the calling applications to take any further action. The whitepaper is available at:

http://www.decipherinfosys.com/Returning.pdf

For the complete list of existing whitepapers, you can go to:

http://www.decipherinfosys.com/PDFgallery.htm

Posted in Decipher News | Leave a Comment »