Skip to main content

Posts

Showing posts from March, 2016

Replacing a Failed Drive - ZFS

FreeNAS makes it easy to replace a faulty drive in an array Instructions at  https://doc.freenas.org/9.3/freenas_storage.html#replacing-a-failed-drive  explain it well Basically, all the action is completed in drive status from the raid volume, and click the "Replace" button.  This is not immediately intuitive. You would think that you could also do this from "View Disks", but you cannot. From Volumes, select the row of root of the volume that is suffering, click the "Status" icon,   It looks like a bunch of rows. This takes you to another screen. Select the disk in question, if not already offline, take it offline.  Then, Press the replace button, and select the new drive from the pulldown (obviously, the new drive needs to be in the system) Depending on how you got the new disk into the machine, you may also need to "Detach" the old disk afterwards

My Version Control System for MSSQL

I previously used a trigger to store previous versions of MSSQL stored procedures, documented elsewhere in my blog, at Version Control of Stored Procedures - MSSQL This was nice and provided a good automated backup for MSSQL structure changes, however I always wanted something to punch through to git. I now have it... Step 1: Create a SQLPS script  $ServerName = " DB\SQL " $SQL_Databases = @( "db1" , "db2 " ) $dbentities = @( "Tables" , "StoredProcedures" , "Triggers" , "Views" , "UserDefinedFunctions" ) $doTableTriggers = $true $dumpPath = "D:\DB_Structure_VersionContro l" foreach ( $db in $SQL_Databases ) { foreach ( $ent in $dbentities ) { $targetPath = " $dumpPath \ $db \ $ent \" $pathok = Test-Path $targetPath if ( ! $pathok ){     New-Item -ItemType Directory -Path $targetPath } foreach ( $tbl in Get-ChildItem SQLSERVER:SQL