<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Ji Village News &#187; Oracle</title>
	<atom:link href="http://www.haidongji.com/category/technology/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.haidongji.com</link>
	<description>季庄新闻--Haidong Ji's Blog</description>
	<lastBuildDate>Sun, 05 Sep 2010 22:43:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SQL code for SQL and Relational Theory</title>
		<link>http://www.haidongji.com/2009/06/04/sql-code-for-sql-and-relational-theory/</link>
		<comments>http://www.haidongji.com/2009/06/04/sql-code-for-sql-and-relational-theory/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 22:17:51 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[DatabaseInteroperability]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SqlServer]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/?p=658</guid>
		<description><![CDATA[I am reading SQL and Relational Theory by C. J. Date. Baron Schwartz wrote a nice review for it. I am reading the online version, about half way through, so am not sure if it has an accompanying CD with source code. In any case, if you want to play with some SQL code listed [...]]]></description>
			<content:encoded><![CDATA[<p>I am reading <i>SQL and Relational Theory</i> by C. J. Date. <a href="http://www.xaprb.com/blog/2009/03/29/a-review-of-sql-and-relational-theory-by-c-j-date/">Baron Schwartz wrote a nice review for it</a>. I am reading the online version, about half way through, so am not sure if it has an accompanying CD with source code. In any case, if you want to play with some SQL code listed in the book, here is the script to generate the tables and rows (or should I say relations at a certain point in time with tuples?)</p>
<pre class="brush: sql">
CREATE TABLE S
   ( SNO    VARCHAR(5)   NOT NULL ,
     SNAME  VARCHAR(25)  NOT NULL ,
     STATUS INTEGER      NOT NULL ,
     CITY   VARCHAR(20)  NOT NULL ,
     UNIQUE ( SNO ) ) ;

 CREATE TABLE P
   ( PNO    VARCHAR(6)   NOT NULL ,
     PNAME  VARCHAR(25)  NOT NULL ,
     COLOR  CHAR(10)     NOT NULL ,
     WEIGHT NUMERIC(5,1) NOT NULL ,
     CITY   VARCHAR(20)  NOT NULL ,
     UNIQUE ( PNO ) ) ;

 CREATE TABLE SP
   ( SNO    VARCHAR(5)   NOT NULL ,
     PNO    VARCHAR(6)   NOT NULL ,
     QTY    INTEGER      NOT NULL ,
     UNIQUE ( SNO , PNO ) ,
     FOREIGN KEY ( SNO )
        REFERENCES S ( SNO ) ,
     FOREIGN KEY ( PNO )
        REFERENCES P ( PNO ) ) ;

INSERT INTO S (SNO, SNAME, STATUS, CITY) VALUES (&#039;S1&#039;, &#039;Smith&#039;, 20, &#039;London&#039;);
INSERT INTO S (SNO, SNAME, STATUS, CITY) VALUES (&#039;S2&#039;, &#039;Jones&#039;, 10, &#039;Paris&#039;);
INSERT INTO S (SNO, SNAME, STATUS, CITY) VALUES (&#039;S3&#039;, &#039;Blake&#039;, 30, &#039;Paris&#039;);
INSERT INTO S (SNO, SNAME, STATUS, CITY) VALUES (&#039;S4&#039;, &#039;Clark&#039;, 20, &#039;London&#039;);
INSERT INTO S (SNO, SNAME, STATUS, CITY) VALUES (&#039;S5&#039;, &#039;Adams&#039;, 30, &#039;Athens&#039;);

INSERT INTO P (PNO, PNAME, COLOR, WEIGHT, CITY) VALUES (&#039;P1&#039;, &#039;Nut&#039;, &#039;Red&#039;, 12.0, &#039;London&#039;);
INSERT INTO P (PNO, PNAME, COLOR, WEIGHT, CITY) VALUES (&#039;P2&#039;, &#039;Bolt&#039;, &#039;Green&#039;, 17.0, &#039;Paris&#039;);
INSERT INTO P (PNO, PNAME, COLOR, WEIGHT, CITY) VALUES (&#039;P3&#039;, &#039;Screw&#039;, &#039;Blue&#039;, 17.0, &#039;Oslo&#039;);
INSERT INTO P (PNO, PNAME, COLOR, WEIGHT, CITY) VALUES (&#039;P4&#039;, &#039;Screw&#039;, &#039;Red&#039;, 14.0, &#039;London&#039;);
INSERT INTO P (PNO, PNAME, COLOR, WEIGHT, CITY) VALUES (&#039;P5&#039;, &#039;Cam&#039;, &#039;Blue&#039;, 12.0, &#039;Paris&#039;);
INSERT INTO P (PNO, PNAME, COLOR, WEIGHT, CITY) VALUES (&#039;P6&#039;, &#039;Cog&#039;, &#039;Red&#039;, 19.0, &#039;London&#039;);

INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S1&#039;, &#039;P1&#039;, 300);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S1&#039;, &#039;P2&#039;, 200);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S1&#039;, &#039;P3&#039;, 400);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S1&#039;, &#039;P4&#039;, 200);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S1&#039;, &#039;P5&#039;, 100);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S1&#039;, &#039;P6&#039;, 100);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S2&#039;, &#039;P1&#039;, 300);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S2&#039;, &#039;P2&#039;, 400);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S3&#039;, &#039;P2&#039;, 200);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S4&#039;, &#039;P2&#039;, 200);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S4&#039;, &#039;P4&#039;, 300);
INSERT INTO SP (SNO, PNO, QTY) VALUES (&#039;S4&#039;, &#039;P5&#039;, 400);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2009/06/04/sql-code-for-sql-and-relational-theory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thoughts on Data Masking</title>
		<link>http://www.haidongji.com/2008/12/11/thoughts-on-data-masking/</link>
		<comments>http://www.haidongji.com/2008/12/11/thoughts-on-data-masking/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 02:26:33 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SqlServer]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/?p=463</guid>
		<description><![CDATA[Often times, production data needs to be moved to different environments for testing/developing purposes. However, some of that data can be people&#8217;s name, birthday, address, account number, etc., that we don&#8217;t want  testers and/or developers to see, due to privacy and regulatory concerns. Hence the need to mask those data. I can certainly see [...]]]></description>
			<content:encoded><![CDATA[<p>Often times, production data needs to be moved to different environments for testing/developing purposes. However, some of that data can be people&#8217;s name, birthday, address, account number, etc., that we don&#8217;t want  testers and/or developers to see, due to privacy and regulatory concerns. Hence the need to mask those data. I can certainly see this needs grow over time for all database platforms. There are software out there that does this sort of task, or similar tasks, such as data generation tool. Oracle actually has a Data Masking Pack since 10g for this purpose. Here are some of my thoughts on this topic.</p>
<p>One method of masking data is through reshuffling, which shuffles the value in target column(s) that you want to protect randomly across different rows.</p>
<p>Another way of doing it is through data generation. For instance, for target column(s), we just replace its value with something else.</p>
<p>For reshuffling, obviously the data element is still meaningful. In other words, a reshuffled account number is still a valid account number, only now its original owner has been changed. Depending on how stringent the requirements are, this may or may not be enough.</p>
<p>For data generation, we have this question to consider: is the format of the generated data important to us? If yes, then obviously some intelligence needs to be built in so that the generated data follows the format we define. For instance, a valid credit card number is 16 digits long, has certain prefix and/or suffix, the nth digit has a certain meaning, so on and so forth.</p>
<p>Another example is people&#8217;s name. Do we replace the name with some random letters we concoct together, or do we want the name to be realistic? If we want realistic names, then we may have to supply a dictionary for the masking software to pull that data from.</p>
<p>In either case, we also have the unique and foreign key constraints to deal with, if there are any. In certain instances where more than one schema/database is involved, the complexity increases exponentially.</p>
<p>Regardless of the method being used, performance of data masking process is important to consider. If the volume of data to be masked is small, then it may not be a big deal. But, as is often the case, you may have a huge transaction table that has millions and millions of rows to mask, then performance is a definite concern.</p>
<p>One idea I am toying around with for data masking performance issue is through low-level data manipulation. For instance, in MySQL, maybe play with rowid. And for Sql Server, play around with fileid, pageid, and such.</p>
<p>Another way to get around that is to do masking through batches. In other words, divide a big task into smaller tasks and tackle them one at a time.</p>
<p>Personally, I like the idea of data reshuffling. On one hand, the data element is meaningful. I know I don&#8217;t want to work with randomly generated gibberish that does not make sense to me. On the other hand, if one wants to do performance testing in test or development environment, one would like to have the data distribution as close to production as possible. And data reshuffling can probably keep the data distribution pretty close to that of production.</p>
<p>In my next entry, I will share a simple C# program I wrote to reshuffle data inside a CSV file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2008/12/11/thoughts-on-data-masking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Analyzing low performance SQL code</title>
		<link>http://www.haidongji.com/2008/03/17/analyzing-low-performance-sql-code/</link>
		<comments>http://www.haidongji.com/2008/03/17/analyzing-low-performance-sql-code/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 21:37:45 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[DatabaseInteroperability]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SqlServer]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/2008/03/17/analyzing-low-performance-sql-code/</guid>
		<description><![CDATA[As an independent consultant and trainer , I found myself doing a lot of existing code analysis and enhancement, mostly for stored procedures and ad-hoc SQL statements. I suspect a lot of people do the same thing as well, so I am really interested in learning how you do it. That&#8217;s the main purpose of [...]]]></description>
			<content:encoded><![CDATA[<p>As an independent consultant and trainer , I found myself doing a lot of existing code analysis and enhancement, mostly for stored procedures and ad-hoc SQL statements. I suspect a lot of people do the same thing as well, so I am really interested in learning how you do it. That&#8217;s the main purpose of this post. This post is tagged with Oracle, Sql Server, and MySQL, as the principals should be the same for all platforms.</p>
<p>Let me share with you how I do it. Notice that I look at table/column statistics and indexes in almost all the steps below. Therefore I purposely left them out in the discussion.</p>
<p>1. I always talk to the original author or the current owner of the code, asking him/her to walk me through it. I listen mostly, trying to understand why s/he writes code this way. I may ask a few questions, just to help me understand. I almost never do any lecturing at this stage. If the code is a stored procedure, I ask the author or stakeholder to give me sample execution statements, with parameters filled with typical values for production load. Sometime it is not possible to talk to the original author, because s/he may have left the company;</p>
<p>2. After that, I will get the database in question and restore it on my own workstation, with the data as close to production as possible. I will start running the code, and gather IO statistics and execution plan, and save the results for benchmark comparison later on;</p>
<p>3. Here is the raw code analysis stage, where code is put into an editor for analysis. In my case, it is VI or VIM. I find myself using the * command on all variable names and tables (make sure you are doing case insensitive search for Sql Server code), to see where they are used. This is also where I weed out the historical garbage code that is there but never being used anymore, such as unused variables, tables, etc. In the case of Sql Server, I mostly look for cursors, temp tables, and user defined functions;</p>
<p>4. Code simplification stage. I found a lot of bad performing code is unwieldy and unnecessarily complex. At this stage, I look for redundant WHERE clauses, convoluted AND and/or OR operators. This can be a tedious and time-consuming process. At this point, it is important to talk to the author or owner of the code, as a good understanding of data and entity relationship is crucial. Also, since I have gained some understanding from the steps above, it is easier to have an intelligent conversation with the code owner, with fresh perspective and momentum. Usually something good will come out of the conversation, and we will have something concrete to work on next;</p>
<p>5. I will make the changes discussed in step 4, once again, collect statistics and execution plan for comparison;</p>
<p>6. Repeat Step 4 and 5 a few times, when necessary. I usually start talking about better database design, code/design refactoring, set based operations, etc., as hopefully I have some credibility and gained the customer&#8217;s trust.</p>
<p>So what do you do to break down complex, low performance SQL code? What methodology, tools, tips, tricks you can share with me?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2008/03/17/analyzing-low-performance-sql-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Migrating from one RDBMS to another</title>
		<link>http://www.haidongji.com/2008/03/03/migrating-from-one-rdbms-to-another/</link>
		<comments>http://www.haidongji.com/2008/03/03/migrating-from-one-rdbms-to-another/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 04:17:34 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[DatabaseInteroperability]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SqlServer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ThoughtsOnTechnology]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/2008/03/03/migrating-from-one-rdbms-to-another/</guid>
		<description><![CDATA[Here is some of my thoughts on migrating MySQL to Sql Server. It came out of an email discussion. I&#8217;d love to hear your thoughts on migrating to a different database platform, not just MySQL to Sql Server.
I actually thought about writing a white paper or even a course on migrating from MySQL to Sql [...]]]></description>
			<content:encoded><![CDATA[<p><i>Here is some of my thoughts on migrating MySQL to Sql Server. It came out of an email discussion. I&#8217;d love to hear your thoughts on migrating to a different database platform, not just MySQL to Sql Server.</i></p>
<p>I actually thought about writing a white paper or even a course on migrating from MySQL to Sql Server, but never got the time to do it. Sometimes a project doing similar things can serve as a launchpad for this endeavour, but that never came along, at least not yet. I am very interested in database interoperability field though. I&#8217;ve done MySQL and Oracle admin in the past and have published some MySQL and Oracle stuff in blogs. I have much better technical skills on Sql Server than any other RDBMS platforms, primarily because I&#8217;ve worked on it longer.</p>
<p>Here are some of my thoughts. I think most of it applies equally on migration from Oracle, DB2, Sybase, Postgresql, etc., to Sql Server, or the other way around. It might be slightly easier to migrate from Sybase to Sql Server, considering their common root.</p>
<p>1. It is not easy to migrate existing app, unless the app is a simple one. Even for that, there are enough quirks that can throw people off and cause enough frustration to derail the whole projects. I&#8217;ve seen that happening twice, <a href="http://www.haidongji.com/2007/06/27/problems-with-oracle-migration-workbench/">having engaged in moving 2 apps from Sql Server to Oracle</a>;</p>
<p>2. Therefore, the best way to migrating to a new database RDBMS, in my opinion, is to start from a new initiative, probably not big initially. When you start things from a clean slate, you don&#8217;t have the historical garbage to worry about. Furthermore, you will give the team enough time to learn the new platform, and prepare the team for future migration, if you choose to do so;</p>
<p>3. Having open-minded team members is crucial to a migration project&#8217;s success. Too often people have emotional attachments to the platform they are familiar with, possibly out of job security concerns and lack of general curiosity toward new things. </p>
<p>I generally adopt a platform agnostic attitude, and don&#8217;t get religious and too carried away on the platform I work on. Having said that, I think these are points that marketing people can spin for persuasion purposes:</p>
<p>1. MySQL has too many storage platforms: MyISAM, InnoDB, MaxDb, and the newly introduced Maria. This can be viewed as a plus, as it provides choice. The downside of it is that it causes confusion for end users;</p>
<p>2. MySQL&#8217;s support for relational model is fairly recent. For example, for a long time, MySQL didn&#8217;t support Stored Procedures, Views, Triggers, Foreign Keys, etc. One could argue that MySQL is not mature in this area since it is new for them, but I think it is difficult to find evidence to substantiate that claim. Also, running the risk of offending some people, I think the importance of relational model got overblown a bit;</p>
<p>3. Sql Server offers the CLR integration. This can be a great selling point;</p>
<p>4. Sql Server offers tight integration with Visual Studio, Windows network, and all other things Microsoft. This is a huge advantage.</p>
<p>5. Too many people find *nix environment intimidating. Although MySQL works on Windows, but the perception in the marketplace is MySQL works better on *nix.</p>
<p>As far as migrating MySQL to Sql Server in a hosting web environment, my honest opinion is Sql Server will be fighting an uphill battle, because MySQL excels in this arena, especially for small and medium-sized, or departmental organizations, with the proliferation of such LAMP app like blogs, wikies, discussion boards, etc. I believe Microsoft&#8217;s weapon of choice in this arena should be SharePoint. Given Microsoft&#8217;s clout, it is certainly a battle worth fighting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2008/03/03/migrating-from-one-rdbms-to-another/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Oracle 10g Express Install Part 2</title>
		<link>http://www.haidongji.com/2007/07/06/oracle-10g-express-install-part-2/</link>
		<comments>http://www.haidongji.com/2007/07/06/oracle-10g-express-install-part-2/#comments</comments>
		<pubDate>Fri, 06 Jul 2007 21:42:07 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/2007/07/06/oracle-10g-express-install-part-2/</guid>
		<description><![CDATA[After my last failed Oracle 10g Express install due to insufficient memory, I purchased some memory from eBay, and started it over.
This time, the first thing the installer noticed was that the swap file is not big enough. I fixed that by doing a total re-install of Fedora Core 2. Yeah, I know that was [...]]]></description>
			<content:encoded><![CDATA[<p>After my last <a href="http://www.haidongji.com/2007/06/13/failed-oracle-10g-r2-express-linux-installation-notes/">failed Oracle 10g Express install due to insufficient memory</a>, I purchased some memory from eBay, and started it over.</p>
<p>This time, the first thing the installer noticed was that the swap file is not big enough. I fixed that by doing a total re-install of Fedora Core 2. Yeah, I know that was kind of lame, but I got a few machines with me, so I didn&#8217;t waste time waiting for it.</p>
<p>Started again, this time the install went through, but I got some error messages at the end. The message was &#8220;groupadd: unable to lock group file&#8221;. The problem was that there were passwd.lock and gshadow.lock files under /etc. I then removed those files.</p>
<p>I tried to reinstall the RPM package. The message I got back was that it was already setup. I then ran:</p>
<pre>
rpm -e oracle-xe-10.2.0.1-1.0.i386.rpm
</pre>
<p>to remove it.</p>
<p>Finally, I was able to install it correctly.</p>
<p>It was a good exercise. I&#8217;ve done some Oracle database administration stuff, but never installation and setup stuff. I would like to bring my Oracle skill to the next level, so this is a good way to get started. 11g will come out within a week or so, but hopefully the skills I learned here can be transferred. I will give 11g a run when it comes out.</p>
<p>A few things learned:</p>
<p>1. yum is worth looking into. It is probably a better way to install or update dependencies than compiling binary or doing manual rpm install;<br />
2. Got to be careful when typing. During profile setup, when I tried to put . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh into /etc/profile, I missed the blank between the dot and forward slash. This shell script sets up $ORACLE_HOME and $ORACLE_SID for you;<br />
3. Here is a good site for <a href="http://valery.bgit.net/blog-en/2006/07/09/oracle-database-10g-express-edition-in-linux/">10g Express setup on Linux</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2007/07/06/oracle-10g-express-install-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems with Oracle Migration Workbench</title>
		<link>http://www.haidongji.com/2007/06/27/problems-with-oracle-migration-workbench/</link>
		<comments>http://www.haidongji.com/2007/06/27/problems-with-oracle-migration-workbench/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 20:43:02 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[DatabaseInteroperability]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SqlServer]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/2007/06/27/problems-with-oracle-migration-workbench/</guid>
		<description><![CDATA[Database vendors like to bash each other, sponsoring dubious &#8220;objective industry studies&#8221; to &#8220;prove&#8221; they are better than others. All of them do it. In my opinion, Oracle is particularly bad in this regard, compared against IBM DB2 or Microsoft Sql Server. Talking about &#8220;unbreakable Oracle&#8221; and software full of bugs, and in many cases [...]]]></description>
			<content:encoded><![CDATA[<p>Database vendors like to bash each other, sponsoring dubious &#8220;objective industry studies&#8221; to &#8220;prove&#8221; they are better than others. All of them do it. In my opinion, Oracle is particularly bad in this regard, compared against IBM DB2 or Microsoft Sql Server. Talking about &#8220;unbreakable Oracle&#8221; and software full of bugs, and in many cases you need to pay the Metalink membership to simply get to know that the issue you are dealing with is a bug. That is not to say Sql Server and DB2 don&#8217;t have bugs in their software, though.</p>
<p>Each of them wants you to convert your database to their platform. To that end, they provide some program to help you along. Oracle has a thing called <a href="http://www.oracle.com/technology/tech/migration/workbench/index.html">Oracle Migration Workbench</a>. Sql Server has something similar called <a href="http://www.microsoft.com/sql/solutions/migration/oracle/default.mspx">Sql Server Migration Assistant</a>.</p>
<p>More often than not, marketing people from those companies will tell you how great their migration program is. That it is easy to migrate, you will see performance improvement, etc. Don&#8217;t believe them.</p>
<p>A couple of months ago, I worked on a project to migrate a database from Sql Server to Oracle. This database has a lot of stored procedures, user defined functions, and linked server stuff. I talked to Oracle people, and they recommended their own Migration Workbench, with Sql Server plug-in. I downloaded them and started working.</p>
<p>Basically, the Migration Workbench tries to go through database code in T-Sql. For code that uses built-in T-Sql functions, the Migration Workbench creates functions with the same name in Oracle, and try to writes something similar in PL/Sql that makes an attempt to do what T-Sql function does. I didn&#8217;t look too deep into this, but I am suspicious at all of them. The reason I didn&#8217;t look too deep into them was that the whole effort was derailed by a bigger problem. Let me explain.</p>
<p>In T-Sql, all variable names start with @ symbol. In fact, in many places, variable names are simply column names prefixed with the @ symbol. This can be pretty easy to read. And it actually works very well.</p>
<p>However, PL/Sql variable names don&#8217;t follow that convention. So, as Migration Workbench goes through T-Sql stored procedures, it simply strips off the @ symbol from the variable names. This basically renders all the code useless.</p>
<p>This is just very, very dumb. Oracle is a multi-billion dollar company, and you would think they should know this. Instead of stripping off the @ symbol, it could replace it with some kind of prefix. But it does not do that.</p>
<p>Another problem is with the identity field. Once again, one would expect that the Migration Workbench converts it to Oracle sequence, but it doesn&#8217;t. It changes that to NUMBER.</p>
<p>Eventually, the project was canceled. The moral of the story: migration from one RDBMS to another is not as easy as it sounds. It is doable. Sometimes it is probably easier to just write everything from scratch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2007/06/27/problems-with-oracle-migration-workbench/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Failed Oracle 10g R2 Express Linux Installation Notes</title>
		<link>http://www.haidongji.com/2007/06/13/failed-oracle-10g-r2-express-linux-installation-notes/</link>
		<comments>http://www.haidongji.com/2007/06/13/failed-oracle-10g-r2-express-linux-installation-notes/#comments</comments>
		<pubDate>Thu, 14 Jun 2007 03:30:24 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/2007/06/13/failed-oracle-10g-r2-express-linux-installation-notes/</guid>
		<description><![CDATA[My first ever computer, the 10-year old HP Pavilion 4455 desktop, purchased after I finished my master degree in Economics, has seen very limited action in the last few years. My better half had suggested that I donate it away, since we really don&#8217;t have enough space to put it, but I refused, because I [...]]]></description>
			<content:encoded><![CDATA[<p>My first ever computer, the 10-year old HP Pavilion 4455 desktop, purchased after I finished my master degree in Economics, has seen very limited action in the last few years. My better half had suggested that I donate it away, since we really don&#8217;t have enough space to put it, but I refused, because I always thought I would use it in the future. Now I am working on my own, so I will need some spare machines to mess around with as my sandboxes. I finally got some time in the last two days to show it some love.</p>
<p>I decided to load Linux on it. Neither Ubuntu 7.04 nor Ubuntu 6.01 worked. (They might work better for newer desktops, I just don&#8217;t know) I have Fedora Core 2, so I installed that. I know the latest Fedora Core is version 6. I am kinda old school in this regard. Anyway, Fedora Core 2 worked on this computer.</p>
<p>I then decided to load Oracle 10g R2 on it. Here is a brief note of my process. It failed, because this machine has 160 MB of memory, not reaching the 256 MB required. I think I will purchase some memory tomorrow and try again.</p>
<p>1. Verify dependencies</p>
<pre>
[root@localhost haidong]# rpm -i oracle-xe-10.2.0.1-1.0.i386.rpm  --test
error: Failed dependencies:
        libaio >= 0.3.96 is needed by oracle-xe-10.2.0.1-1.0
</pre>
<p>2. Downloaded libaio source. libaio is Oracle&#8217;s library for asynchronous IO.  configure failed, therefore I couldn&#8217;t compile and install it. Below is the last output on the screen.</p>
<pre>
ecking for libaio >= 0.3... no
checking for libaio 0.1... no
configure: error:
*** libaio is required.
</pre>
<p>3. I didn&#8217;t bother to look through the configure log file. Instead, I searched for &#8220;rpm libaio fedora core 2&#8243; and got <a href="http://download.fedora.redhat.com/pub/fedora/linux/core/2/i386/os/Fedora/RPMS/">this link</a>:</p>
<p>http://download.fedora.redhat.com/pub/fedora/linux/core/2/i386/os/Fedora/RPMS/</p>
<p>Downloaded the package for libaio.</p>
<pre>
[root@localhost haidong]# rpm -ivh libaio-0.3.99-2.i386.rpm
warning: libaio-0.3.99-2.i386.rpm: V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...                ########################################### [100%]
   1:libaio                 ########################################### [100%]
</pre>
<p>4. Install. It failed. I will try again, if/when I get more memory for this old machine.</p>
<pre>
[root@localhost haidong]# rpm -ivh oracle-xe-10.2.0.1-1.0.i386.rpm
Preparing...                ########################################### [100%]
Oracle Database 10g Express Edition requires a minimum of 256 MB of physical
memory (RAM).  This system has 155 MB of RAM and does not meet minimum
requirements.
error: %pre(oracle-xe-10.2.0.1-1.0) scriptlet failed, exit status 1
error:   install: %pre scriptlet failed (2), skipping oracle-xe-10.2.0.1-1.0
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2007/06/13/failed-oracle-10g-r2-express-linux-installation-notes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monitoring error logs in Oracle and Sql Server</title>
		<link>http://www.haidongji.com/2007/03/06/monitoring-error-logs-in-oracle-and-sql-server/</link>
		<comments>http://www.haidongji.com/2007/03/06/monitoring-error-logs-in-oracle-and-sql-server/#comments</comments>
		<pubDate>Wed, 07 Mar 2007 04:38:57 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[DatabaseInteroperability]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SqlServer]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/2007/03/06/monitoring-error-logs-in-oracle-and-sql-server/</guid>
		<description><![CDATA[In Oracle, there are 3 places that I know of that are important for monitoring: the bdump, where background process error is stored; udump, where user trace error is dumped; and cdump, the core dump, where Oracle internal error is dumped. cdump is in the binary format, you can use &#8220;strings -a&#8221; to look at [...]]]></description>
			<content:encoded><![CDATA[<p>In Oracle, there are 3 places that I know of that are important for monitoring: the bdump, where background process error is stored; udump, where user trace error is dumped; and cdump, the core dump, where Oracle internal error is dumped. cdump is in the binary format, you can use &#8220;strings -a&#8221; to look at things inside. All other trace and log files are text files that you can open up and read for yourself.</p>
<p>On Unix/Linux/Solaris based systems, these folders are located under:</p>
<p>$ORACLE_BASE/admin/$ORACLE_SID/bdump, udump, and cdump</p>
<p>To find out your $ORACLE_BASE and $ORACLE_SID, you can do:</p>
<p>echo $ORACLE_BASE and echo $ORACLE_SID</p>
<p>There is also the alert log, usually in the format of alert_$ORACLE_SID.log format, under the bdump folder.</p>
<p>There can be numerous trace and log files in these folders. To troubleshoot and correlate events with some problems, you can do:</p>
<p>ls -ltr</p>
<p>to sort files in ascending order according to date and time, and open up the file that is closest to the time when problem occurred. Those trace and log files may hold telltale signs of what you need to examine further.</p>
<p>For Sql Server, by default, the error log file is at C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG. And that is the only place you need to worry about. If you turn on certain trace, the trace info will also be logged into error log.</p>
<p>Don&#8217;t confuse Oracle&#8217;s .trc file with Sql Server&#8217;s .trc file. Oracle&#8217;s trace file is in text format, generated when certain trace flags are turned on. Sql Server&#8217;s trace file are in binary format, and can be read using Sql Server Profiler.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2007/03/06/monitoring-error-logs-in-oracle-and-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Assign SELECT results into variables</title>
		<link>http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/</link>
		<comments>http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/#comments</comments>
		<pubDate>Thu, 08 Feb 2007 04:39:43 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[DatabaseInteroperability]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SqlServer]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/</guid>
		<description><![CDATA[I mentioned here that SELECT INTO in Sql Server is functionally similar to CREATE TABLE AS in Oracle. Oracle also has SELECT INTO, but it is used for assigning query results to a variable.
Here is a PL/SQL code snippet:

declare MyVariable varchar2(20);

Begin

select ColumnName into MyVariable from MyTable where MyID = SomeInteger;
dbms_output.put_line('Hello ' &#124;&#124; MyVariable);

End

In the above [...]]]></description>
			<content:encoded><![CDATA[<p>I mentioned here that <a href="http://www.haidongji.com/2007/01/22/ctas-and-select-into/">SELECT INTO in Sql Server is functionally similar to CREATE TABLE AS in Oracle</a>. Oracle also has SELECT INTO, but it is used for assigning query results to a variable.</p>
<p>Here is a PL/SQL code snippet:</p>
<pre>
declare MyVariable varchar2(20);

Begin

select ColumnName into MyVariable from MyTable where MyID = SomeInteger;
dbms_output.put_line('Hello ' || MyVariable);

End
</pre>
<p>In the above example, a column value for a particular record is assigned to MyVariable and printed out.</p>
<p>How do you assign select results into T-Sql variables in Sql Server then? Here is a code sample that does the same thing above:</p>
<pre>
declare @MyVariable varchar(20)

select @MyVariable = ColumnName from MyTable where MyId = SomeInteger

print 'Hello ' + @MyVariable
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2007/02/07/assign-select-results-into-variables/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CTAS and Select Into</title>
		<link>http://www.haidongji.com/2007/01/22/ctas-and-select-into/</link>
		<comments>http://www.haidongji.com/2007/01/22/ctas-and-select-into/#comments</comments>
		<pubDate>Tue, 23 Jan 2007 03:27:13 +0000</pubDate>
		<dc:creator>Haidong Ji</dc:creator>
				<category><![CDATA[DatabaseInteroperability]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SqlServer]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.haidongji.com/2007/01/22/ctas-and-select-into/</guid>
		<description><![CDATA[In both Oracle and MySQL, you can do:
create table T1 as select * from T1
This CREATE TABLE AS statement basically clones table T1 with its structure and data in T2. This can be pretty handy at times.
The equivalent of that in Sql Server is SELECT INTO. For example, you can do:
select * into T2 from [...]]]></description>
			<content:encoded><![CDATA[<p>In both Oracle and MySQL, you can do:</p>
<p>create table T1 as select * from T1</p>
<p>This CREATE TABLE AS statement basically clones table T1 with its structure and data in T2. This can be pretty handy at times.</p>
<p>The equivalent of that in Sql Server is SELECT INTO. For example, you can do:</p>
<p>select * into T2 from T1</p>
<p>to achieve similar results.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.haidongji.com/2007/01/22/ctas-and-select-into/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
