<?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>Notes On Siebel &#187; SQL</title>
	<atom:link href="http://blog.notesonsiebel.com/category/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.notesonsiebel.com</link>
	<description>Technical advice, help and instruction with Siebel Systems</description>
	<lastBuildDate>Wed, 13 Aug 2008 23:24:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Why there may be a place for Direct SQL</title>
		<link>http://blog.notesonsiebel.com/2007/10/17/why-there-may-be-a-place-for-direct-sql/</link>
		<comments>http://blog.notesonsiebel.com/2007/10/17/why-there-may-be-a-place-for-direct-sql/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 01:26:37 +0000</pubDate>
		<dc:creator>stuandgravy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Siebel]]></category>

		<guid isPermaLink="false">http://blog.notesonsiebel.com/2007/10/17/why-there-may-be-a-place-for-direct-sql/</guid>
		<description><![CDATA[Over at Service Oriented Shenanigans Graham&#8217;s written a good, provocative piece titled Why Direct SQL is a very stupid thing to do. I&#8217;m happy to be baited&#8230;   I started to respond there, but it turned into something worth a full post. Hopefully trackback pulls the whole conversation together like it&#8217;s supposed to&#8230;
Graham argues [...]]]></description>
			<content:encoded><![CDATA[<p>Over at Service Oriented Shenanigans Graham&#8217;s written a good, provocative piece titled <a href="http://www.digitalteddy.com/techblog/2007/10/why_direct_sql_is_a_very_stupi.html" title="Service Oriented Shenanigans">Why Direct SQL is a very stupid thing to do</a>. I&#8217;m happy to be baited&#8230; <img src='http://blog.notesonsiebel.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I started to respond there, but it turned into something worth a full post. Hopefully trackback pulls the whole conversation together like it&#8217;s supposed to&#8230;</p>
<p>Graham argues that because Siebel implements referential integrity through the repository rather than through database rules, it&#8217;s idiotic bypass all these rules and run SQL directly against the database. I&#8217;d make a few points:</p>
<ul>
<li>If you&#8217;re using Siebel Remote, then direct SQL could be additionally stupid. Any changes made directly to the database are not be propagated to the transaction log, so won&#8217;t be routed to the local databases, so your server will be out of sync with your remote clients&#8230;  Nasty!</li>
</ul>
<ul>
<li>If, however, you&#8217;re NOT using Siebel Remote, or you&#8217;re re-extracting all your local databases anyway, then I&#8217;d argue that there <strong>is a place for direct SQL</strong>. A limited place, sure, requiring utmost care, diligence etc etc, but at the end of the day it&#8217;s just another tool to only be used when appropriate. Siebel Expert Services will happily run direct SQL when the alternatives are  ridiculously cumbersome. The alternatives (e.g. EIM, EAI) are also quite capable of significantly damaging your database and also require an appropriate level diligence: developers shouldn&#8217;t lapse into thinking that just because things are being done with the &#8216;proper&#8217; methods they can&#8217;t do harm (EIM Delete in the wrong mode, anyone?).</li>
</ul>
<ul>
<li>If you use direct SQL to insert a record, then you won&#8217;t get a Siebel Row Id. The procedures to generate a Row Id are in the database and <em>could</em> be called directly, but this really <em>is </em>idiotic. (I actually worked on an implementation where Siebel Expert Services had done this &#8211; hmmm&#8230;)</li>
</ul>
<p>So don&#8217;t use direct SQL to insert records, and don&#8217;t break your referential integrity, but do remember that SQL is just another tool, with pros and cons to be weighed against the alternatives. And don&#8217;t come crying to me if you break your database and your architect justifiably calls you an idiot.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.notesonsiebel.com/2007/10/17/why-there-may-be-a-place-for-direct-sql/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Debugging SQL with Oracle Cost Based Optimizer</title>
		<link>http://blog.notesonsiebel.com/2007/10/16/debugging-sql-with-oracle-cost-based-optimizer/</link>
		<comments>http://blog.notesonsiebel.com/2007/10/16/debugging-sql-with-oracle-cost-based-optimizer/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 23:38:17 +0000</pubDate>
		<dc:creator>stuandgravy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Siebel]]></category>

		<guid isPermaLink="false">http://blog.notesonsiebel.com/2007/10/16/debugging-sql-with-oracle-cost-based-optimizer/</guid>
		<description><![CDATA[I recently had a performance issue in Siebel 7.8 that on brief inspection looked like a SQL issue: the application was taking forever to build a list applet, re-query was just as slow, there weren&#8217;t any obvious calculated fields, no dodgy MVGs etc etc&#8230; it all pointed at the database.
So I did the obvious thing [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a performance issue in Siebel 7.8 that on brief inspection looked like a SQL issue: the application was taking forever to build a list applet, re-query was just as slow, there weren&#8217;t any obvious calculated fields, no dodgy MVGs etc etc&#8230; it all pointed at the database.</p>
<p>So I did the obvious thing and spooled the SQL. Sure enough, the applet query was taking nearly 30 seconds to complete.  Next step, fire up <a href="http://www.toadsoft.com/" title="ToadSoft">Toad</a> to get an explain plan and start picking apart the SQL. Except when I pasted my query into Toad, it completed in half-a-second. The explain plan showed perfect use of the expected unique index scans, with no full table scans or other anomalies. Why the discrepancy?</p>
<p>After a bit of digging around, the answer came from our often-invaluable TAM: <a href="https://metalink3.oracle.com/od/faces/secure/km/DocumentDisplay.jspx?id=478028.1&amp;h=Y" target="_blank" title="MetaLink login required">SupportWeb TechNote 582</a>. The technote has all the background to the Cost Based Optimizer, and the key is the explanation of Siebel&#8217;s Oracle session variables. In summary, to make your SQL client behave like a Siebel session, you need to set the following session variables:</p>
<pre>ALTER SESSION SET optimizer_mode = FIRST_ROWS_10
/
ALTER SESSION SET "_HASH_JOIN_ENABLED" = FALSE
/
ALTER SESSION SET "_OPTIMIZER_SORTMERGE_JOIN_ENABLED" = FALSE
/
ALTER SESSION SET "_OPTIMIZER_JOIN_SEL_SANITY_CHECK" = TRUE
/</pre>
<p>In Toad, you add these statements and choose to &#8216;Execute as script&#8217;. The really significant variable here is that first one: optimizer_mode = FIRST_ROWS_10. This tells Oracle to optimize for the first page, rather than the whole query, which can dramatically change the way indexes are evaluated.</p>
<p>In my case, the session variables allowed me to replicate the slow performance of the query in Toad, the explain plan of which showed Oracle using the wrong index, which identified the incorrect evaluation of costs, which (eventually) pointed to a root cause of stats being generated on empty tables. Obviously!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.notesonsiebel.com/2007/10/16/debugging-sql-with-oracle-cost-based-optimizer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Changing the Local Database Password</title>
		<link>http://blog.notesonsiebel.com/2007/03/29/changing-the-local-database-password/</link>
		<comments>http://blog.notesonsiebel.com/2007/03/29/changing-the-local-database-password/#comments</comments>
		<pubDate>Thu, 29 Mar 2007 09:13:17 +0000</pubDate>
		<dc:creator>stuandgravy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Siebel]]></category>

		<guid isPermaLink="false">http://blog.notesonsiebel.com/2007/03/29/changing-the-local-database-password/</guid>
		<description><![CDATA[Users forget their passwords &#8211; that&#8217;s just the way it is. Without picking on anybody, certain users (cough sales guys cough) are particularly prone to this.  And more often than not, they&#8217;re remote users who&#8217;ve not synchronised their local database for a week and desperately need their updates.
As with the server database, there&#8217;s no [...]]]></description>
			<content:encoded><![CDATA[<p>Users forget their passwords &#8211; that&#8217;s just the way it is. Without picking on anybody, certain users (<i>cough </i>sales guys <i>cough</i>) are particularly prone to this.  And more often than not, they&#8217;re remote users who&#8217;ve not synchronised their local database for a week and desperately need their updates.</p>
<p>As with the server database, there&#8217;s no way to retrieve the current local database password. Password hashing algorithms are repeatable, but not reversible &#8211; sensibly enough. It is possible to change the password to something new though.</p>
<p><a href="http://blog.stuandgravy.com/2007/03/15/connecting-to-a-local-database/" title="Connect to the local database">Connect to the local database</a>, then run these SQL commands:</p>
<p><code>grant connect to USERNAME identified by PASSWORD</code><br />
<code>grant connect to SIEBEL identified by PASSWORD</code></p>
<p>Where <code>USERNAME</code> is the login for this database and <code>PASSWORD</code> is the new password (both in upper case). If for some reason you don&#8217;t know who the local database belongs to, the login can be retrieved with this command:</p>
<p><code>select name from SYSUSERAUTH<br />
where name not in ('SYS','DBA','PUBLIC','SIEBEL','DBO','dbo','SSE_ROLE')</code></p>
<p>More often than not, you&#8217;ll also want to reset the server database password to match, so that you can sync up those outstanding changes.  On Oracle, this is your usual:</p>
<p><code>alter user USERNAME identified by PASSWORD</code></p>
<p>There&#8217;s more info in SupportWeb <a href="https://metalink3.oracle.com/od/faces/secure/km/DocumentDisplay.jspx?id=475579.1&amp;h=Y" target="_blank" title="MetaLink Login required">TechNote 25</a>, including scripts for different versions of SQL Anywhere to automate the process.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.notesonsiebel.com/2007/03/29/changing-the-local-database-password/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Locally unlocking a locked Project</title>
		<link>http://blog.notesonsiebel.com/2007/03/22/locally-unlocking-a-locked-project/</link>
		<comments>http://blog.notesonsiebel.com/2007/03/22/locally-unlocking-a-locked-project/#comments</comments>
		<pubDate>Thu, 22 Mar 2007 09:47:12 +0000</pubDate>
		<dc:creator>stuandgravy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Siebel]]></category>

		<guid isPermaLink="false">http://blog.notesonsiebel.com/2007/03/22/locally-unlocking-a-locked-project/</guid>
		<description><![CDATA[With multiple developers building one application it&#8217;s inevitable that multiple developers will need to change the same project at the same time. There&#8217;s pros and cons and object-locking and change-control and build-control etc etc, but sometimes deadlines are too tight and you just have to fork.
In Siebel Tools, once one developer&#8217;s got a project locked [...]]]></description>
			<content:encoded><![CDATA[<p>With multiple developers building one application it&#8217;s inevitable that multiple developers will need to change the same project at the same time. There&#8217;s pros and cons and object-locking and change-control and build-control etc etc, but sometimes deadlines are too tight and you just have to fork.</p>
<p>In Siebel Tools, once one developer&#8217;s got a project locked the UI won&#8217;t let a second developer anywhere near it. To get around this you need to get into SQL Anywhere. <a href="http://blog.stuandgravy.com/2007/03/15/connecting-to-a-local-database/" title="Login to a local database">Login</a> to the second developer&#8217;s local database, then the following script will unlock the project locally:</p>
<blockquote><p><font face="Courier New">UPDATE s_project<br />
SET locked_flg = &#8216;N&#8217;<br />
WHERE name = &lt;<em>Project Name</em>&gt;</font></p></blockquote>
<p>The second developer can now log into Siebel Tools, manually lock the project as normal and do what she has to do. Of course, once build is done the two developers will need to go through a merge exercise to get their changes into the one repository, but that effort can be preferable to losing days of development time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.notesonsiebel.com/2007/03/22/locally-unlocking-a-locked-project/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Connecting to a Local Database</title>
		<link>http://blog.notesonsiebel.com/2007/03/15/connecting-to-a-local-database/</link>
		<comments>http://blog.notesonsiebel.com/2007/03/15/connecting-to-a-local-database/#comments</comments>
		<pubDate>Thu, 15 Mar 2007 09:24:56 +0000</pubDate>
		<dc:creator>stuandgravy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Siebel]]></category>

		<guid isPermaLink="false">http://blog.notesonsiebel.com/2007/03/15/connecting-to-a-local-database/</guid>
		<description><![CDATA[SQL is my kind of fast, powerful, geekiness. I&#8217;m forever forgetting the ins-and-outs of connecting to a local database with SQL Anywhere though, so it needs noting.
There&#8217;s a pretty comprehensive SupportWeb article that covers everything you need to know. In summary:

for Siebel 6 use isql55.exe from the \bin directory, then username DBA    [...]]]></description>
			<content:encoded><![CDATA[<p>SQL is my kind of fast, powerful, geekiness. I&#8217;m forever forgetting the ins-and-outs of connecting to a local database with SQL Anywhere though, so it needs noting.</p>
<p>There&#8217;s a pretty comprehensive <a href="https://metalink3.oracle.com/od/faces/secure/km/DocumentDisplay.jspx?id=475652.1&amp;h=Y" target="_blank" title="MetaLink login required">SupportWeb article</a> that covers everything you need to know. In summary:</p>
<ul>
<li>for Siebel 6 use <font face="Courier New">isql55.exe</font> from the \bin directory, then username <font face="Courier New">DBA</font>             and password <font face="Courier New">SQL</font>.</li>
<li>for 7.0 and 7.5 use <font face="Courier New">dbisqlc.exe</font> and the same <font face="Courier New">DBA</font>/<font face="Courier New">SQL</font>.</li>
<li>for 7.7 and 7.8 it&#8217;s still <font face="Courier New">dbisqlc.exe</font> but the login changes to <font face="Courier New">DBA</font>/<font face="Courier New">&lt;<span style="font-style:italic;">Enterprise Name</span>&gt;</font> (in upper case).</li>
<li>not sure about 8 yet&#8230;</li>
</ul>
<blockquote><p><font color="#000080">Update: those executables are all in the client\bin directory, regardless of version. </font></p></blockquote>
<p>Another login option in all versions is the username SIEBEL with the local password for the database you&#8217;re connecting to (in upper case). This can be handy if somebody&#8217;s changed the database admin password, for instance&#8230;</p>
<p>The Watcom-SQL variant is somewhat different from Oracle or SQL Server SQL, so it&#8217;s worth keeping the <a href="http://manuals.sybase.com/onlinebooks/group-pbarc/conn5/sqlug/@Generic__BookView" title="SQL Anywhere User's Guide">SQL Anywhere User&#8217;s Guide</a> to hand while hacking around.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.notesonsiebel.com/2007/03/15/connecting-to-a-local-database/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
