I was trying to move some content dbs in our MOSS farm to another drive in the same Server. I stopped all website from IIS and stopped all the related services, then ran stsadm deletecontentdb command with all the required parameters.
Then I detached the db and it threw an error and I just closed it by clicking Ok. Now I went to the drive to copy and paste the .mdf and .ldf file to the new drive. I tried to copy the .mdf file and I got access denied error but the db was already detached, I was screwed! The downtime was only for a couple of hours and I had many dbs to move to this new drive.
I googled for some time and did not get many solutions, some people had encountered this error but none of them posted an answer. I tried to attach the file again from the old location, atleast site will not go down. But when I tried to attach I got this wierd error from SQL Server 2005 Management Studio:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'M:\SQLDataFiles\Kubera_Portal_CU_Sempra.mdf'. (Microsoft SQL Server, Error: 5123)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476
The help links provided my Microsoft did not take me anywhere, it did not help!
Now I could not copy the file to new location or attach the file again! Finally somebody wrote in a blog that such files can be copied by taking ownership of the file. I changed the owner and took ownership and then I was able to copy the file to new location. Then there was something else, the .ldf file was missing and I have no clue why that happened. Since there was nothing else to be done, I attached the .mdf file alone and gave a location for the .ldf file and it got attached. Those were some hear pulling moments because I was dealing with a production server!
Then I detached the db and it threw an error and I just closed it by clicking Ok. Now I went to the drive to copy and paste the .mdf and .ldf file to the new drive. I tried to copy the .mdf file and I got access denied error but the db was already detached, I was screwed! The downtime was only for a couple of hours and I had many dbs to move to this new drive.
I googled for some time and did not get many solutions, some people had encountered this error but none of them posted an answer. I tried to attach the file again from the old location, atleast site will not go down. But when I tried to attach I got this wierd error from SQL Server 2005 Management Studio:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'M:\SQLDataFiles\Kubera_Portal_CU_Sempra.mdf'. (Microsoft SQL Server, Error: 5123)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476
The help links provided my Microsoft did not take me anywhere, it did not help!
Now I could not copy the file to new location or attach the file again! Finally somebody wrote in a blog that such files can be copied by taking ownership of the file. I changed the owner and took ownership and then I was able to copy the file to new location. Then there was something else, the .ldf file was missing and I have no clue why that happened. Since there was nothing else to be done, I attached the .mdf file alone and gave a location for the .ldf file and it got attached. Those were some hear pulling moments because I was dealing with a production server!
Comments