SQL

Set SharePoint Content Database in Read-Only Mode

This weekend I am working on a SharePoint 2010 to 2013 upgrade.

One of the steps; the beginning steps I will do is set the databases I am upgrading into read only mode to prevent users or automated process from upgrading the database during the upgrade window.

Now I could have taken the system offline for this; but that would be simple and inconvenient for anyone looking for information.  And in IT its all about the Information now isn’t it. You can find my steps below.

SharePoint Application Server

  • I first logged into my central administration of my SharePoint Server (SharePoint 2010).
  • Under Application Management, Select Manage content databases
  • Chose your web application  and select the database
  • You will notice that there isn’t a location to set this database into read only mode; however you do see that its status indicates its not in read only mode.
  • Keep this page open, as we will reload it later.

SharePoing SQL Database Server

  • Log into your Microsoft SQL Database Server (Or use SSMS).
  • Launch SQL Server Management Studio (SSMS)
  • Connect to the SQL Database Server instance
  • Select the database in question
  • Right click and select Properties
  • Under properties select Options
  • Scroll down to the area that reads “State”
  • You will see Database Read-Only
  • Change the value from False to True, then click OK
  • You will see a notification that it will momentary kick active users.
  • Click OK to continue.

Now you can revisit the SharePoint Application Server and reload the page and you will now notice that the status has changed and is in read only mode.

Congrats, if you followed these steps you did it right.

Uninstall of SQL fails with error about RsFx Driver

I was working on uninstalling installations of SQL 2012 and SQL 2008 R2 to later do a clean install of SQL 2012. All seems to be going relatively smooth until I encountered the following message:

Warning 26003. Microsoft SQL Server 2008 R2 Setup
Support Files cannot be uninstalled because the
following products are installed:
Microsoft SQL Server 2008 R2 RsFx Driver

Understandable; So I will uninstall using Control Panel\Programs\Programs and Features (Add/Remove for the old school). However the item wasn’t listed. After searching on how to do this using the registry I found a simpler way, I am now calling it a clean and #jermsmit supported way to doing this.

Steps to correct this issue:

We need to obtain the product GUID from WMI using WMIC so that we can use the MSIEXEC /X {GUID} command to remove the software.

Open a command prompt as administrator and type: WMIC PRODUCT LIST to get a list of products and the GUID associated with them. I found using the following command works best: WMIC PRODUCT GET Caption, IdentifyingNumber > c:\info.txt 

Once you have the GUID of the software you want to uninstall you simply type: MSIEXEC /X {GUID}

Software is now uninstalled and you can proceed.

*note* the steps provided can be used for any software you are looking to uninstall that is not listed under Add/Remove programs. Just follow the steps as such:

  1. Get the product GUID from WMI (Win32_Product class)
  2. Find the GUID related to the product or products that the SQL error mentions
  3. Run MSIEXEC /X {GUID} for each of the products to uninstall them manually.

 

I hope you enjoyed this post
Please visit me on Facebook @ http://www.facebook.com/jermsmitcom & via twitter: #jermsmit

restore sql server database from mdf file

  1. First Open SQL Server Management Studio (SSMS). You may need to run as Administrator
  2. Right click the Databases folder and select attach from the menu.
  3. Click Add and select the mdf file. Click Ok, and then Click Ok again. You will get an error at this time because SSMS could not find the corresponding ldf file.
  4. Select the ldf file entry and Click Remove and then Click OK
  5. And that’s all folks

 

SQL Server Database Error: 661

One of my customers had an issue where they failed to open a connection to a particular database they had been testing. The error read: ‘the database e:somepathsomefolderjermsmit.mdf’ cannot be opened because it is version 611. The server supports version 655 and earlier. A downgrade path is not supported.

This issue is caused because you are not permitted to use a database from a later release on an earlier system. i.e they are not backwards compatible

Problem: Databases created under a newer version of SQL Server are not compatible with previous versions of SQL Server

Solution(s) that I am aware of in this case:

  • You need to either upgrade your SQL Server instance to the same version as the database or one newer
  • Or copy out the data in that database into an earlier version (using the data migration wizard perhaps)

If you need to know the version of your source and destination databases use the following query:

SELECT @@VERSION

The destination should be the same level or greater in in version.

Best of luck to ya

SQL Server backup in multiple parts

“It’s so logical and so simple. Fat is the backup fuel system. The role it plays in the body is that when there’s no carbohydrate around, fat will become the primary energy fuel. That’s pretty well known.” – Robert Atkins

Recently I have been working with my dB Administrator to get some DR backups to our offsite location. Simple task made difficult with a few challenges: Size of the database, Bandwidth to transfer to remote site, and method of transfer. We got past part of the size issues by compressing the SQL database backups, but we still had issues getting the files to the remote site in time. So we switched from using Microsoft DFSR to using cygwin and Rsync. However there was another issue at play; We could never seem to get the full backup there in time.

Out bottle neck at this point was the available bandwidth needed to transfer and the files. The transfer would break and well it needed to do a checksum on the file to resume. At 200GB into it all this process to a considerable amount of time to only again fail.

That is when I got creative and suggested to use SQL to span/split the backup into multiple parts so that in the event the transfer would break and resume it only had to do some from just a single part of the total sum of data. You know what?  It works. It’s been 2 weeks now and our backups reach the remote site.

And here is what you can do the split up your backups:

And now the backup is split into equal parts of the original backup file size. In my production environment we split our compressed database into 64 parts giving us about 4GB per file.

I hope this helps you,

– Jermal