<?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>Gabe Hilado&#039;s SharePoint &#38; ASP.NET Blog &#187; Database</title>
	<atom:link href="http://spdeveloper.net/tag/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://spdeveloper.net</link>
	<description>Microsoft, SharePoint, ASP.NET, Software Solutions</description>
	<lastBuildDate>Thu, 29 Sep 2011 15:13:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>You have backups. Can you recover?</title>
		<link>http://spdeveloper.net/2010/02/you-have-backups-can-you-recover/</link>
		<comments>http://spdeveloper.net/2010/02/you-have-backups-can-you-recover/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 09:45:17 +0000</pubDate>
		<dc:creator>Gabe Hilado</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Operations]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Deployment]]></category>
		<category><![CDATA[Administrators]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Management]]></category>
		<category><![CDATA[Restore]]></category>

		<guid isPermaLink="false">http://spdeveloper.net/?p=174</guid>
		<description><![CDATA[I had phone meeting with a potential new customer last Thursday and the customer said that he was watching the news about a lunatic who crashed a plane into the IRS building. The news didn’t hit the place I was working at yet so I didn’t know what was going on. But as we talked [...]]]></description>
			<content:encoded><![CDATA[<p>I had phone meeting with a potential new customer last Thursday and the customer said that he was watching the news about a <a href="http://news.yahoo.com/s/ap/20100218/ap_on_re_us/us_plane_crash_texas">lunatic who crashed a plane into the IRS building</a>. The news didn’t hit the place I was working at yet so I didn’t know what was going on. But as we talked about the news, it reminded me of 9-11, plane crashing into Pentagon. Plane crashing into a building—yep, it definitely reminds you of the threats out there. Eventually we talked business and ended our call and I went about my day.</p>
<p>I’m not sure if the crash took out IT resources (such as servers) for the IRS. I couldn’t help but think, “If the crash took out IRS servers, were they able to recover in a timely fashion”? Yeah I know it’s geeky and nerdy to be thinking about these things but I’m an IT pro—I can’t help but ponder these things! <img src='http://spdeveloper.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Every IT resource—infrastructure and systems alike—should have a disaster/recovery plan</strong>. Within government agencies, they like to call this Continuity of Operations Planning or COOP. COOP is pretty comprehensive and includes not just how to recover IT but also how management succession, crisis procedures, etc. If you are part of IT and you get detailed to participate in COOP planning, most of your contributions to this COOP plan will revolve around recovering IT assets such as servers, applications, databases, and the like,</p>
<p>I can’t remember how many times I’ve seen network and DB administrators claim “yeah we have backups” and when disaster comes, the backups were no good and couldn’t be restored! What good is that??! What the hell is that?? See, <strong>it’s not enough that you are backing up data and applications; you must also rehearse recovery procedures</strong> using the capture back-ups so that you can confidently report to your management, “Yes, we have backups and can recover in the event of a disaster.”</p>
<p>In the SharePoint world, it’s not enough that you are backing up content and configuration databases—you should rehearse recovery procedures from time to time. How do you know you can recover a toasted SharePoint farm configuration if you’ve never rehearsed it and seen with your own two eyes that your backups are good? <strong>You must test your recovery procedures</strong>.</p>
<p>How often should you backup and test recovery procedures? Well, one can probably write a dedicated Web site just on the topic of disaster-recovery (just google it and there are tons). So, without having to discuss this too much, as a general guide I like to follow, the more critical your systems, the more backups and test-recovery procedures you should do. For less-critical apps, your frequency doesn’t have to be as extensive (the important thing is you do it). Just as an example, for critical apps—daily full back-ups with incremental back-ups during the day and test recovery procedures every 2 weeks. The “least frequent” backup schedule I’ve ever done for a “non-critical” app is bi-weekly full backups and test recoveries every 3 months.</p>
<p>The point is, you must backup and be ready to recover when disaster strikes. Nine years ago, the terrorists attacked WTC and the Pentagon. Last week, some lunatic had a personal grudge against the government. Who knows, maybe this week, some admin at your office spills some latte on your production server and toasts mission-critical apps. Whatever the disaster may be, be ready.</p>
]]></content:encoded>
			<wfw:commentRss>http://spdeveloper.net/2010/02/you-have-backups-can-you-recover/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disconnected ODP.Net and System.Data.OracleClient Connections</title>
		<link>http://spdeveloper.net/2009/10/disconnected-odp-net-and-system-data-oracleclient-connections/</link>
		<comments>http://spdeveloper.net/2009/10/disconnected-odp-net-and-system-data-oracleclient-connections/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 06:14:56 +0000</pubDate>
		<dc:creator>Gabe Hilado</dc:creator>
				<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Connection Sring]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[ODP.NET]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://spdeveloper.net/?p=24</guid>
		<description><![CDATA[Wow, talk about Mondays! I&#8217;ve been developing an ASP.NET Web service that connects to an Oracle backend.  Up to today, we&#8217;ve only tested on an isolated network and guess what&#8211;the configuration of this environment didn&#8217;t exactly mirror the QA or the production environment. When we were testing on this isolated network, the application never had Oracle [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, talk about Mondays! I&#8217;ve been developing an ASP.NET Web service that connects to an Oracle backend.  Up to today, we&#8217;ve only tested on an isolated network and guess what&#8211;the configuration of this environment didn&#8217;t exactly mirror the QA or the production environment. When we were testing on this isolated network, the application never had Oracle connectivity problems. Today, we go to the staging or QA environment and the Oracle connections would just die after 20 minutes or so. &#8220;<strong><em>ORA-; exceeded maximum idle time </em></strong>&#8220;. If you reload the erroneous page, you get a different error: &#8220;<strong><em>ORA-01012; not logged on</em></strong>&#8220;. Keep reloading the page but the app is stuck with the &#8220;not logged on&#8221; exception. After 30 minutes or so, the application can connect to the Oracle server again! So what happened here?</p>
<p>Here&#8217;s what happened. Apparently, due to security policies set forth by the organization, all Oracle connections must time-out (Oracle session status=&#8221;SNIPE&#8221;) if the connection has exceeded the &#8220;Idle Time&#8221; specification in the Oracle Profile. Without getting deep into Oracle, the server will kill the connections after the Idle Time limit. I actually had our Oracle DBA helped me diagnose the problem. The Oracle DBA set traces and we monitored the Oracle sessions. That&#8217;s when I saw that even if initially, the application will keep several connections open (connection pooling is turned on for the OracleConnection object and you will see INACTIVE status in the Oracle sessions&#8211;inactive is okay&#8211;it just wasn&#8217;t executing commands at that time), after several minutes (15 minutes is the set Idle Time), the Oracle sessions would disappear. In a few rare occassions, we actually saw the Oracle sessions for the app time-out. The sessions appear with a &#8220;SNIPE&#8221; status for a little bit and then the server eventually cleans them up.</p>
<p>Is this behavior reproducable? Absolutely! Create an Oracle Profile (get your DBA if you don&#8217;t have rights to do this) and set the Idle Time to a short interval like 5 minutes. Next, associate the Oracle user-name that the application will use to the profile that has the 5-minute Idle Time limit. Run the app and you should be able to connect to Oracle. Wait like 10 minutes; your next call will generate the Oracle errors. Another way to reproduce this is the run the app for the first time and then watch the Oracle sessions. Kill the sessions created by the app. You will get &#8220;<strong><em>ORA-00028: your session has been killed</em></strong>&#8221; instead of the &#8220;idle time exceeded error&#8221;. But the following Oracle commands after that error will now generate the &#8220;not logged on&#8221; error. The ODP.NET pool manager gave the application a connection that should have been discarded because it&#8217;s already dead!</p>
<p>The ODP.NET provider will keep threads in the pool even though the server has already killed them! What&#8217;s the fix? The fix is a parameter that you need to add to your connection string. On my Oracle connection string, I only specify Data Source, User Name, and Password; no other parameters. I added an additional parameter called Validate Connection and you have to set it equal to True. I googled all day to find what this does. You can learn more out about this at the <a href="http://www.oracle.com/technology/tech/windows/odpnet/tom.html">Oracle site</a>. When you say <strong><em>Validate Connection=True</em></strong> on the connnection string, the ODP.NET connection pool will test the connection first before it returns the connection to the requesting app. The connection string look something like:</p>
<pre class="brush: xml;">
&lt;add key=&quot;connectionString&quot;
     value=&quot;Data Source=ORCL;
            User ID=me;
            Password=myPassword;
            Validate Connection=True;&quot; /&gt;
</pre>
<p> By putting <strong><em>Validate Connection=True</em></strong> on the connection string, connectionObject.Open() will get you a connection that is either:</p>
<ul>
<li>Valid open connection from the connection pool</li>
<li>A fresh new connection the connection pool</li>
</ul>
<p>You&#8217;ll stop getting crappy, dead connections from the pool. What&#8217;s downside? The pool manager will now ping the Oracle server using the connection first (to test if it&#8217;s still valid) before it returns to the application. A small price to pay I say to make the application stable.</p>
<p>I&#8217;ve tested using the <strong>Validation Connection=True</strong> method and it works. I can kill sessions in Oracle and the app will just re-open valid connections. The Oracle instance can be shutdown and restarted&#8211;when it restarts, the pool will simply create new database connections. Another possible approach is to set the <strong>Connection Lifetime</strong> parameter to a time value that is below the Idle Time limit in the server. In theory, this method will make the ODP.NET connection pool will discard the connections before the server kills it. My only problem with this latter strategy is that this doesn&#8217;t take into account Oracle server &#8220;bounce&#8221;, firewall disconnects, physical disconnects and the like. Just go with the Validate Connection parameter&#8211;it is still application pooling; just a bit busier.</p>
<p> </p>
<p><strong><span style="text-decoration: underline;">NOTE</span></strong>: the stuff I wrote above is applicable to ODP.NET only. The System.Data.OracleClient namespace also has OracleConnection, OracleCommand, and adapter and reader objects as well. But they&#8217;re not the same. The System.Data.OracleClient, by default, does not use application pool. I tested this several times, again, by monitoring the Oracle sessions. If you put Pooling=True in your connection string, then the application will use connection pooling. What happens when the sessions are killed or sniped and you are using System.Data.OracleClient.OracleConnection in you app? First, you get &#8220;<strong><em>ORA-00028: your session has been killed</em></strong>&#8221; just like in ODP.NET. The difference between System.Data.OracleClient and ODP.NET OracleConnection is that in the former, it&#8217;s smart enough to not keep giving the cut-off connection back to application. You&#8217;ll get ORA-00028 error once and the succeeding calls should be fine. ODP.NET on the other hand, will keep that bad connection in the pool even though it&#8217;s been bad for a while; only when the ODP.NET connection has exceeded it&#8217;s TTL that it is removed from the pool.</p>
]]></content:encoded>
			<wfw:commentRss>http://spdeveloper.net/2009/10/disconnected-odp-net-and-system-data-oracleclient-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

