Tuesday, February 12, 2013

Database [databasename] cannot be upgraded because it is read-only or has read-only files


Today I was studying for my MCSA SQL Server 2012, for 70-461 (Querying SQL Server 2012) and I ran into an issue while going through Chapter 6: Querying Full-Text Data, Lesson 1, Excercise 2.

For this exercise I installed Full-Text Search on SQL Server 2012 and later I needed to make sure the Semantic Language Statistics Database was installed. This was not the case, so I tried to follow the necessary steps.
While I was trying to attach the database with the beneath script I was getting an error message of the following type:

CREATE DATABASE semanticsdb ON
(FILENAME = 'C:\Program Files\Microsoft Semantic Language Database\semanticsdb.mdf'),
(FILENAME = 'C:\Program Files\Microsoft Semantic Language Database\semanticsdb_log.ldf')
FOR ATTACH;
Msg 3415, Level 16, State 2, Line 1Database 'semanticsdb' cannot be upgraded because it is read-only, has read-only files or the user does not have permissions to modify some of the files. Make the database or files writeable, and rerun recovery.
As the error message was saying, I checked the permissions of the database files and ensured they were not read-only. Also, the service user account running the SQL Server instance had full access on the files..

I was about to give Everyone full access to the folder when it struck me: I tried starting the SQL Server Management Studio in Administrator mode. When I executed the script again I got a lovely message saying:

Converting database 'semanticsdb' from version 693 to the current version 706.Database 'semanticsdb' running the upgrade step from version 693 to version 694.Database 'semanticsdb' running the upgrade step...
Worked like a charm for me!

Thursday, February 7, 2013

Logical Query Processing

Well, that's been a while since my last post.. A new year, new chances!

Opposed to physical query processing which follows the order of the statements:
SELECT .. FROM .. WHERE.. GROUP BY ..)
logical query processing processes the statements in the following order:
FROM .. WHERE .. GROUP BY .. SELECT ..

Last week I saw this excellent poster from (who else then) Itzik Ben Gan, writing down the phases of logical query processing in T-SQL in a flow diagram.


You can download the original poster here.

Featured Post

My DataGrillen Adventure: Speaking, Connecting, and New Friendships

I just got back from an incredible trip to DataGrillen, and I can’t wait to share my experiences with you. If you haven’t heard of it,  Data...