<?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>Personal Weblog of John Wood</title>
	<atom:link href="http://www.webofwood.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webofwood.com</link>
	<description>Wordpress weblog of John Wood, a Database Administrator</description>
	<lastBuildDate>Thu, 04 Mar 2010 19:18:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easy Oracle Backup Deployment with Grid Control</title>
		<link>http://www.webofwood.com/2010/03/03/oracle-backup-deployment/</link>
		<comments>http://www.webofwood.com/2010/03/03/oracle-backup-deployment/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 21:52:53 +0000</pubDate>
		<dc:creator>John Wood</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.webofwood.com/?p=88</guid>
		<description><![CDATA[I recently installed GRID Control and while “playing around” with it, I discovered the fantastic capability to build a job once and deploy over many targets. I thought this is very cool after experiencing so many problems with Dbconsole.
I found you can create a Job with minimal effort and deploy it to various targets with minimal effort. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently installed GRID Control and while “playing around” with it, I discovered the fantastic capability to build a job once and deploy over many targets. I thought this is very cool after experiencing so many problems with Dbconsole.</p>
<p>I found you can create a Job with minimal effort and deploy it to various targets with minimal effort. Database backups fit this mold exceptionally well. In my shop, all of our backups are rather routine and all share common properties: complete backup, daily at 6PM. All of our databases are small enough for complete backups rather than incremental.</p>
<p><span id="more-88"></span>If you want to quickly and easily build the backups for a dozen or more databases, you can try this process. I’m sure you will find it simple and effective. The basic steps involved are:</p>
<ol>
<li>Build a Job “template” and save it in the Job Library</li>
<li>Choose between submitting the Job for scheduling against multiple targets or submitting the Job for each target. <strong>This process</strong> submits the Job for each target. I chose this method because I believe it gives me more flexibility to accommodate future changes for individual target requirements. You can try both methods to see which best suits your needs.</li>
</ol>
<p>To start, bring up Oracle Grid Control and then choose the Jobs tab at the top. My screen is shown below. <strong>Now click on Job Library tab</strong> of that screen.</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs000.jpg" target="_blank"><img class="aligncenter" style="display: inline; border-width: 0px;" title="jobs-000" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs000_thumb.jpg" border="0" alt="jobs-000" width="240" height="167" /></a></p>
<p>You should now be in the Job Library. Follow the numbered sequences on the next image below to <strong>create a new Library Job</strong></p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs001.jpg" target="_blank"><img class="aligncenter" style="display: inline; border-width: 0px;" title="jobs-001" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs001_thumb.jpg" border="0" alt="jobs-001" width="240" height="99" /></a></p>
<p>Fill in <strong>General</strong> information about the Job</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs002.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-002" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs002_thumb.jpg" border="0" alt="jobs-002" width="244" height="108" /></a></p>
<p>Key or paste in your RMAN script into the <strong>Parameters</strong> screen. I use a very generic script which uses all of the defaults I had previously established in Backup Settings for the target. A copy of my RMAN script is available here for cut &amp; paste.</p>
<pre class="brush: sql">run {
backup device type disk database;
backup device type disk archivelog all not backed up delete all input;
delete noprompt obsolete device type disk;
}</pre>
<p>After entering the script you’ll go on to specifying the Schedule. We won’t worry about the <em>Credentials</em> tab until we deploy to a target.</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs004.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-004" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs004_thumb.jpg" border="0" alt="jobs-004" width="244" height="92" /></a></p>
<p>Set up your <strong>Schedule</strong>. Because we are deploying to individual targets, you will be able to change this later per target. In my case, all the targets have the same schedule so I can set it here and not worry about it when I deploy.</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs007.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-007" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs007_thumb.jpg" border="0" alt="jobs-007" width="244" height="136" /></a></p>
<p><strong>Deploy</strong> your new Job by selecting it from the list and then clicking the <em>Submit</em> button.</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs008.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-008" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs008_thumb.jpg" border="0" alt="jobs-008" width="244" height="142" /></a></p>
<p>Now you will see another Job creation screen with the General settings. However, this one is now in the Jobs category and not the Job Library. You may notice, the Job name has been filled in with the name from your Job Library along with a suffix (most likely .1).  This is the time to add a Target or Targets.</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs010.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-010" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs010_thumb.jpg" border="0" alt="jobs-010" width="244" height="181" /></a></p>
<p>Select one or more from the <strong>Targets List.</strong> I chose to use one target for each deployment. However, you can deploy one Job to multiple targets at the same time. My preference is to run the deployment for each target thereby creating a Job for each.</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs012.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-012" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs012_thumb.jpg" border="0" alt="jobs-012" width="244" height="185" /></a></p>
<p>We’re back to the <strong>General</strong> information screen of the Job creation. At this time I also change the suffix for the Job name to match the Instance name of my target.</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs013.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-013" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs013_thumb.jpg" border="0" alt="jobs-013" width="244" height="112" /></a></p>
<p>The <strong>Credentials</strong> screen gives you the opportunity to choose which credentials you want to use. In my case I am using the preferred credentials which I had already set up for each target.</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs014.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-014" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs014_thumb.jpg" border="0" alt="jobs-014" width="244" height="122" /></a></p>
<p><strong>The final Job</strong> scheduled to run every day at 6PM according to the time of the target ( you could have targets in differing time-zones).</p>
<p style="text-align: center;"><a href="http://www.webofwood.com/wp-content/uploads/2010/03/jobs015.jpg"><img class="aligncenter" style="display: inline; border: 0px;" title="jobs-015" src="http://www.webofwood.com/wp-content/uploads/2010/03/jobs015_thumb.jpg" border="0" alt="jobs-015" width="244" height="125" /></a> </p>
<p style="text-align: left;">If you chose, as I did, to deploy to individual targets, you would now return to the Job Library, select your job, and click submit. This would be repeated for each target.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webofwood.com/2010/03/03/oracle-backup-deployment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cycle Those SQL Server Logs</title>
		<link>http://www.webofwood.com/2010/02/15/cycle-those-sql-server-logs/</link>
		<comments>http://www.webofwood.com/2010/02/15/cycle-those-sql-server-logs/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 21:21:04 +0000</pubDate>
		<dc:creator>John Wood</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[errorlog]]></category>
		<category><![CDATA[schedule]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.webofwood.com/?p=62</guid>
		<description><![CDATA[Don’t you just hate it when you open one of your server logs in Management Studio and then you have to wait forever to review it because it never stops reading? I’ve done it enough times and decided to put an end to it or at least greatly reduce the incidence.
Using Powershell and a simple [...]]]></description>
			<content:encoded><![CDATA[<p>Don’t you just hate it when you open one of your server logs in Management Studio and then you have to wait forever to review it because it never stops reading? I’ve done it enough times and decided to put an end to it or at least greatly reduce the incidence.</p>
<p>Using Powershell and a simple script to execute Sp_Cycle_Errorlog, I now have a weekly, Windows scheduled task which executes the sproc to cycle the logs for all my SQL Servers.</p>
<pre class="brush: ps">foreach ($svr in get-content D:\Scripts\Servers.TXT ){
    $svr
    Invoke-Expression 'SQLCMD -E -S $svr -Q "Exec Sp_Cycle_Errorlog"' | Out-Null
	}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webofwood.com/2010/02/15/cycle-those-sql-server-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linked Server 64bit Deficiency</title>
		<link>http://www.webofwood.com/2009/08/07/linked_server_64bit/</link>
		<comments>http://www.webofwood.com/2009/08/07/linked_server_64bit/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 17:00:41 +0000</pubDate>
		<dc:creator>Woody</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[2000]]></category>
		<category><![CDATA[2005]]></category>
		<category><![CDATA[32bit]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[linked server]]></category>
		<category><![CDATA[sproc]]></category>

		<guid isPermaLink="false">http://www.webofwood.com/2009/08/07/create-linked-server-view-of-sql-server-2000-32bit-on-64bit-sql-server-2005/</guid>
		<description><![CDATA[First off, I need to give recognition to Joel Mansford for his blog which gave me the answer to my problem.
Connecting SQL Server 2005 x64 to SQL Server 7 (32bit) as a linked server!? 
After creating a linked server on a 64bit SQL Server 2005 instance, I then needed to create a view which referenced [...]]]></description>
			<content:encoded><![CDATA[<p>First off, I need to give recognition to Joel Mansford for his blog which gave me the answer to my problem.<br />
<a href="http://joelmansford.wordpress.com/2007/08/10/connecting-sql-server-2005-x64-to-sql-server-7-32bit-as-a-linked-server/">Connecting SQL Server 2005 x64 to SQL Server 7 (32bit) as a linked server!? </a></p>
<p>After creating a linked server on a 64bit SQL Server 2005 instance, I then needed to create a view which referenced the linked server. The linked server is a SQL Server 2000 32bit instance. However, when I tried to create the view, I got this error:  <em>Cannot obtain the schema rowset &#8220;DBSCHEMA_TABLES_INFO&#8221; for OLE DB provider &#8220;SQLNCLI&#8221;.</em></p>
<p>This really proved to be a conundrum because I had just recently created the same linked server and view on another SQL 2005 instance. However, I had not yet connected the fact the 2005 instance was 32bit as opposed to the one I was now working on, which is 64bit.</p>
<p>I wrestled with it being a permissions issue for a while but ruled that out when I could not create the view even while using a domain admin account having authority of all the instances. A search on Google, using the above mentioned error message, turned up Joel&#8217;s blog. His specific problem was relative to SQL Server 7 but the answer applied to SQL Server 2000 also. He had found the original post of the ultimate solution and was good enough to include it in his blog which I have an excerpt here.</p>
<blockquote><p>I found an extremely helpful post by Marek Adamczuk at <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=62887&amp;SiteID=1">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=62887&amp;SiteID=1</a>. Marek  explains the 32-bit editions are missing a stored procedure on the master database called <strong>sp_tables_info_rowset_64.</strong></p>
<p>Marek’s solution is to create a wrapper on the master database as follows (his code not mine):</p>
<pre class="brush: sql">create procedure sp_tables_info_rowset_64
    @table_name sysname,
    @table_schema sysname = null,
    @table_type nvarchar(255) = null
as
declare @Result int set @Result = 0
exec @Result = sp_tables_info_rowset
    @table_name,
    @table_schema,
    @table_type</pre>
</blockquote>
<p>It would appear the existing sproc does the same thing but just needs to be referenced using the 64bit name. Kudos to both Joel and to Marek for making this solution available!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webofwood.com/2009/08/07/linked_server_64bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Where Clause &#8211; Compare to a list of values</title>
		<link>http://www.webofwood.com/2009/08/04/powershell-where-compare-list/</link>
		<comments>http://www.webofwood.com/2009/08/04/powershell-where-compare-list/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 17:28:35 +0000</pubDate>
		<dc:creator>Woody</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.webofwood.com/2009/08/04/powershell-where-clause-compare-to-a-list-of-values/</guid>
		<description><![CDATA[As a databases admin with a few dozen servers and a few hundred SQL Server database, I need to effectively build automated jobs to perform various administrative tasks such as backing up databases. I&#8217;m still new to PowerShell but I am beginning to see how immensely helpful it is to me and my work.
I found [...]]]></description>
			<content:encoded><![CDATA[<p>As a databases admin with a few dozen servers and a few hundred SQL Server database, I need to effectively build automated jobs to perform various administrative tasks such as backing up databases. I&#8217;m still new to PowerShell but I am beginning to see how immensely helpful it is to me and my work.</p>
<p>I found a good PowerShell script for backing up databases at <a title="Use Powershel to back up all user databases" href="http://blogs.msdn.com/buckwoody/archive/2009/06/25/use-powershell-to-backup-all-user-databases.aspx" target="_blank">this blog location</a>. However, I wanted to change it slightly to accommodate backing up ALL, System, User, or a list of databases. Processing ALL, System, or User is straightforward enough but I had to it was the first time I came up against have to compare a value against a list of values. In SQL you simply use an IN operator with a list of values but I was not sure of how to accomplish the same process in PowerShell.</p>
<p>Here was my problem: the user could supply a list of databases to backup and the backup script has a line with captures all the database objects for that SQL Server instance. I need to backup only those which are in the users list.</p>
<p>I found that the PowerShell <strong>WHERE</strong> clause can use a <strong>-contains</strong> operator which effectively filters the selection for an array. To test the operation I set up a small script to build two arrays and then I piped one array through a WHERE filter of which the results are piped to a ForEach. The ForEach sees only the results of the WHERE which mimics the SQL IN operator.</p>
<p>Run this code in PowerShell to see what I mean.</p>
<pre class="brush: ps">$a = @("db1","db2","db3","db4")
$d = @("db1","db2","db3","db4","db5","db6","db7","db8")
$d | where { $a -contains $_ } | foreach { Write-Host $_ }</pre>
<p><strong>$a</strong> represents the list of database supplied by the user.<br />
<strong>$d</strong> represents the array of databases returned when accessing the Microsoft.SqlServer.Management.Smo.Server object.<br />
I can now back up the user supplied databases within the foreach script block.</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d05e848e-d526-4494-8d76-eea0b3f11e9c" class="wlWriterSmartContent" style="margin: 0px; display: inline; padding: 0px;">del.icio.us Tags: <a rel="tag" href="http://del.icio.us/popular/PowerShell%20Script%20Where%20compare%20list">PowerShell Script Where compare list</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.webofwood.com/2009/08/04/powershell-where-compare-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips &amp; Tricks Using Compare-Object &#8211; Copy New Files</title>
		<link>http://www.webofwood.com/2009/07/29/tips-tricks-using-compare-object-copy-new-files/</link>
		<comments>http://www.webofwood.com/2009/07/29/tips-tricks-using-compare-object-copy-new-files/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 15:57:32 +0000</pubDate>
		<dc:creator>Woody</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.webofwood.com/2009/07/29/tips-tricks-using-compare-object-copy-new-files/</guid>
		<description><![CDATA[This is a wonderful article which not only details the use of Compare-Object but also provides some very excellent examples on its use.
Tips &#38; Tricks Using Compare-Object &#8211; Dreaming in PowerShell &#8211; PowerShell.com
I am very new to PowerShell but I am beginning to like using it considerably more each day. I recently had a need [...]]]></description>
			<content:encoded><![CDATA[<p>This is a wonderful article which not only details the use of Compare-Object but also provides some very excellent examples on its use.</p>
<p><a href="http://powershell.com/cs/blogs/tobias/archive/2009/01/09/tipps-amp-tricks-using-compare-object.aspx">Tips &amp; Tricks Using Compare-Object &#8211; Dreaming in PowerShell &#8211; PowerShell.com</a></p>
<p>I am very new to PowerShell but I am beginning to like using it considerably more each day. I recently had a need for a quick and easy way to script a process which would copy only new files from one location to another. after scouring the Internet for a good example, I stumbled upon the Compare-Object cmdlet and this <a title="Compare-Object" href="http://powershell.com/cs/blogs/tobias/archive/2009/01/09/tipps-amp-tricks-using-compare-object.aspx" target="_blank">excellent article</a>.</p>
<p>The actual script I came up with is rather simple and serves my purpose exactly. As I  mentioned, I am new to PowerShell and there may very well be a better method. However, this one works for me.</p>
<h3>The script code:</h3>
<pre class="brush: ps">param(
    [string]$s = '\\serverx\c$\ProgramData\Polaris\3.5\SQLVS1\AuthorityUpdates',
    [string]$t = '\\servery\data03\shared\libraries\zmarc'
)

$target = Get-ChildItem $t
$source = get-childitem $s
Compare-Object $source $target -Property Name -PassThru |
    Where-Object { $_.SideIndicator -eq '&lt;=' } |
    foreach-object -process{
        copy-item $_.FullName -destination $t
        }</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webofwood.com/2009/07/29/tips-tricks-using-compare-object-copy-new-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
