Friday, June 29, 2012

Restore Content DB–SharePoint 2010

I “accidentally” deleted my default root site on my test SharePoint 2010 farm. Oopsy. As I was testing the backup functionality yesterday I thought I might as well try to do a restore. It didn’t work out-of-the-box, although I think I got there in the end.

This is a farm installation, not the single-box installation option, but all on one box so we can add others later if necessary. It’s SharePoint 2010 on Window Server 2008 R2 (no service pack) with SQL Server 2010 R2.

The farm was built a few weeks ago and has little content or use, so should be fairly easy – it’s not like we have heavily customised it or anything.

I did a full backup yesterday, so restoring to that should bring back the site I just killed.

SharePoint restore lets me select my backup and then choose just the bit I think I need to restore: the WSS_Content database. I choose to restore it using the existing configuration, so it should overwrite the current database.


A few minutes later the job finishes with an error message. The log shows the database restore completed ok, but OnPostRestore failed. Pointing my browser at the root site shows it’s not there – the restore hasn’t worked.

[6/29/2012 11:20:27 AM] Verbose: Starting OnPreRestore event.
[29/06/2012 11:20:27] Verbose: Starting object: WSS_Content.
[6/29/2012 11:20:28 AM] Verbose: Starting OnRestore event.
[29/06/2012 11:20:28] Verbose: Starting object: WSS_Content.
[29/06/2012 11:20:28] Verbose: [WSS_Content] SQL Server Connection String: Data Source=SPTEST01;Initial Catalog=WSS_Content;Integrated Security=True.
[29/06/2012 11:20:28] Verbose: [WSS_Content] SQL command started at: 29/06/2012 11:20:28. This command may take a while to complete and without notification.
[29/06/2012 11:20:28] Verbose: [WSS_Content] SQL Server Command:
IF EXISTS ( SELECT * FROM master..sysdatabases WHERE has_dbaccess(name)=1 AND name=@db_name )
    @db_location=c:\backups\sharepoint\AutoWeeklyFull\spbr0000\000000B4.bak, @db_name=WSS_Content
[29/06/2012 11:20:28] Verbose: [WSS_Content] SQL command timeout is set to 1.00 hours.
[29/06/2012 11:20:30] Progress: [WSS_Content] 5 percent complete.
[29/06/2012 11:20:30] Progress: [WSS_Content] 11 percent complete.
[29/06/2012 11:20:30] Progress: [WSS_Content] 15 percent complete.
[29/06/2012 11:20:30] Progress: [WSS_Content] 21 percent complete.
[29/06/2012 11:20:30] Progress: [WSS_Content] 25 percent complete.
[29/06/2012 11:20:30] Progress: [WSS_Content] 31 percent complete.
[29/06/2012 11:20:30] Progress: [WSS_Content] 35 percent complete.
[29/06/2012 11:20:31] Progress: [WSS_Content] 41 percent complete.
[29/06/2012 11:20:31] Progress: [WSS_Content] 45 percent complete.
[29/06/2012 11:20:31] Progress: [WSS_Content] 50 percent complete.
[29/06/2012 11:20:31] Progress: [WSS_Content] 56 percent complete.
[29/06/2012 11:20:31] Progress: [WSS_Content] 60 percent complete.
[29/06/2012 11:20:31] Progress: [WSS_Content] 66 percent complete.
[29/06/2012 11:20:32] Progress: [WSS_Content] 70 percent complete.
[29/06/2012 11:20:32] Progress: [WSS_Content] 76 percent complete.
[29/06/2012 11:20:32] Progress: [WSS_Content] 80 percent complete.
[29/06/2012 11:20:32] Progress: [WSS_Content] 86 percent complete.
[29/06/2012 11:20:32] Progress: [WSS_Content] 90 percent complete.
[29/06/2012 11:20:32] Progress: [WSS_Content] 96 percent complete.
[29/06/2012 11:20:34] Progress: [WSS_Content] 100 percent complete.
[29/06/2012 11:20:34] Verbose: [WSS_Content] SQL Server Message: Processed 6528 pages for database 'WSS_Content', file 'WSS_Content' on file 1.
[29/06/2012 11:20:34] Verbose: [WSS_Content] SQL Server Message: Processed 2 pages for database 'WSS_Content', file 'WSS_Content_log' on file 1.
[29/06/2012 11:20:36] Verbose: [WSS_Content] SQL Server Message: RESTORE DATABASE successfully processed 6530 pages in 4.654 seconds (10.960 MB/sec).
[29/06/2012 11:20:36] Verbose: [WSS_Content] SQL command completed at: 29/06/2012 11:20:36.
[29/06/2012 11:20:36] Verbose: [WSS_Content] Verifying that the database restoration is complete.
[29/06/2012 11:20:36] Verbose: [WSS_Content] SQL Server Command: USE [master]
                        SELECT status FROM master..sysdatabases WHERE name=@db_name
[29/06/2012 11:20:36] Debug: [WSS_Content] Database status is 65536.
[29/06/2012 11:20:36] Verbose: [WSS_Content] SQL Server Command: SELECT TOP 1 1 FROM [WSS_Content]..sysobjects
[29/06/2012 11:20:36] Verbose: [WSS_Content] Database restoration has been verified.
[6/29/2012 11:20:36 AM] Verbose: Starting OnPostRestore event.
[6/29/2012 11:20:36 AM] Verbose: Starting object: WSS_Content.
[6/29/2012 11:20:36 AM] FatalError: Object WSS_Content failed in event OnPostRestore. For more information, see the spbackup.log or sprestore.log file located in the backup directory.
    SqlException: Cannot open database "WSS_Content" requested by the login. The login failed.
Login failed for user 'MYDOMAIN\SharePointAdminUserName'.
[6/29/2012 11:20:36 AM] Debug:    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at Microsoft.SharePoint.Utilities.SqlSession.OpenConnection()
   at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command)
   at Microsoft.SharePoint.SqlRemoteBlobSession.CheckRbsInstalled()
   at Microsoft.SharePoint.Administration.SPRemoteBlobStorageSettings.Installed()
   at Microsoft.SharePoint.Administration.SPDatabase.OnPostRestore(Object sender, SPRestoreInformation info)
   at Microsoft.SharePoint.Administration.SPContentDatabase.OnPostRestore(Object sender, SPRestoreInformation args)

Boo. Hiss. Out-of-the-box (OOTB) functionality not working. The account is the farm admin account which was used to install the SharePoint farm. There’s no way it doesn’t have enough rights and, sure enough, they look ok to me when viewed with SQL Server Management Studio. That account is a server admin and has the db_owner role on the database.

I try again, this time choosing to restore WSS_Content to a new name: WSS_Content2. This also fails in the same place, but with a different error message.

[29/06/2012 11:56:14] Verbose: [WSS_Content2] Database restoration has been verified.
[6/29/2012 11:56:14 AM] Verbose: Starting OnPostRestore event.
[6/29/2012 11:56:14 AM] Verbose: Current object: WSS_Content2 (previous name: WSS_Content).
[6/29/2012 11:56:15 AM] FatalError: Object WSS_Content2 (previous name: WSS_Content) failed in event OnPostRestore. For more information, see the spbackup.log or sprestore.log file located in the backup directory.
    SPException: Cannot attach database to Web application. Use the command line tool or Central Administration pages to attach the database manually to the proper Web Application.
[6/29/2012 11:56:15 AM] Debug:    at Microsoft.SharePoint.Administration.SPContentDatabase.OnPostRestore(Object sender, SPRestoreInformation args)

I guess that might be because the existing database is still configured and the new copy can’t co-exist, so I delete both the new database and the existing one using SQL Server Management Studio, so both WSS_Content2 and WSS_Content are gone. (It’s just a test box – a reinstall from scratch is possible if this doesn’t work).

This time it works, although the SharePoint Central Admin (CA) GUI is showing the previous error status with the successful restore log underneath. Still, this is the usual level of shoddyness that I expect from big fat Microsoft products so am unfazed.

Monday, June 18, 2012

Mobile Frame Zero

WP_000106Here is my first attempt at a mecha for Mobile Frame Zero, made with Lego I had as a child. This was primarily an initial investigation into simple joints as these will be important in any mecha. I got my initial ideas by looking at some of the mecha designs on Mobile Frame Hangar.

Firstly, you can get quite a lot done with single-pip pieces. They give a single degree of freedom because they join with a single peg in a hole, so can be rotated. The tops of the legs, for example, are just single-pip blocks, so can be turned, and the feet have a single pip on the top, so they can be rotated to make it look like the feet point in or out, which also improves stability.

The legs join the torso via a combination of a Mini Handle (3839) (a 2x1 plate with two poles) and Lamp Holders (4081).

Note: The Lego PickABrick website sells new, individual bricks, but won’t let me link to the parts directly (javascript: how not to do it). So I’m linking to BrinkLink instead, but I’ve included the brick name and design identifier from the Lego site so you can search there if you prefer.

The shoulders are a combination of Space Positioning Rockets (3963) (details not available on PickABrick) and Angular Bricks 1x1 (4070), although there are many other parts that could do the same job. Note the the rocket parts provide mountings to the side (for the arms) but also to the front and rear, giving a way to add all sorts of other systems to the mecha.


I bought into the Mobile Frame Zero Kickstarter via Penny Arcade. I liked the idea of a table-top dice-based battle game which uses Lego bricks as the protagonists and well as the scenery, but I was also interested in Kickstarter itself as a new (to me anyway) way of funding things.

Traditionally you either pay up front for things or you get them “free”, but stuffed full of adverts. Either way, someone else invested capital and is now trying to make profit (Return on Investment or ROI). With Kickstarter you can choose to help fund something up front (cloud-sourced capitalism maybe).

In this case the project has also declared that the output will be open-sourced, which gives it a sense of purity – once the funding has achieved its objective (to create the game rules in this case) the product will be given away, so nobody (or everybody, if you prefer) can exploit it. Cloud-sourced patronage, perhaps?

Maybe this model could be adapted for music and film? A band pledges to write some music (or release some they already have ready to go) and once enough backers fund it the piece or album is written and released. Given that the band were paid up front there’s no need for copyright. Some people will benefit from the piece without paying, but what comes around goes around – there will be other pieces that you didn’t fund that you come to benefit from too. You also get to influence what gets done more directly than the traditional market system where investors take ‘risks’ (or more likely don’t, preferring to rehash the same pop culture ad nauseam) and then hope to exploit them afterwards. Here the money goes directly to the stuff you actually want to see. And after, maybe your name stays on a permanent list of backers as a testament to the stuff you helped create (even in only a small, remote way).

Wednesday, June 13, 2012

Remote connections to SQL Express

I can connect to my SQL Express server from Management Studio while remoted onto the server, but couldn’t connect to it from my workstation from Management Studio. This is v 10.5.1600.1, which is SQL Server 2008 R2.

I confirmed all the steps in the following post:

I confirmed that it wasn’t a SQL permissions thing, because I’m using the same credentials I used when connecting on the server.

Still no luck. Connecting to servername\sqlexpress fails with:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

On a whim, I tried connecting to just the servername without the instance name. Success. It looks like SQL Express thinks it is the default instance. I don’t know how it was installed. Maybe this was intentional.

I did also set it to respond to the default SQL Server port (1433) mainly because, when following the instructions in the blog post linked above, I couldn’t think of another port number to use so just borrowed the standard one (there’s no other SQL instance on the server).

If I am logged on to the server via remote desktop, I can connect to either servername or servername\sqlexpress. From my workstation only servername works.

TL;DR: Try connecting to the default instance if your named instance won’t respond, just because it might work anyway.

Wednesday, June 6, 2012

Chicken of the Woods

WP_000120I spied this on my route to work, just outside of Crudgington, Shropshire, in early June 2012, growing on the north side of an oak tree. It’s a cluster of sulphur polypore, commonly called Chicken of the Woods. It was fresh, solid & heavy with water. I took a photo of it then broke off a large piece to examine at home.



The top side has orange bands and the underside is a vivid yellow.

WP_000122  WP_000123


I sliced some up into ~1cm wide strips and then lightly fried them in olive oil. The strips take on a golden colour during the frying and were delicious, having a firm, meaty texture and a chicken-like flavour.