Error 5123 in SQL Server 2008 R2 - sql

I changed my windows. But I can not attach mdf,ldf files and cannot move or copy them.
My error is:
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
An exception occurred while executing a Transact-SQL statement or batch.
CREATE FILE encountered operating system error 5 (Access is denied) while attempting to open or create the physical file 'D:\Project\Masoomi\UniversityService\DataBase\Universityservice.mdf'. (Microsoft SQL Server, Error: 5123)
I run as administrator too. My windows is 7 and I installed SQL Server 2008 R2.
My previous windows was 7 and SQL Server 2008 R2.
What shall I do?

I shared the mdf,ldf files and problem solved.

As another solution I came across this today and was able to resolve it by simply running SQL Server Management Studio as administrator. I am using SQL Server 2008 R2.

Related

Why user instance is not created in SQL Server 2008 (Visual Studio 2010)?

I am using Visual Studio 2010 and want to use SQL Server 2008 as a backend. I successfully installed SQL Server 2008 and configured it. It is even getting connected in Visual Studio 2010 unless I am trying to create a database for an particular project.
It's causing an error:
Failed To Generate User Instance Of SQL Server Due To A Failure In Copying Database Files.The Connection Will Be Closed.
I searched and found one solution stating to delete Microsoft SQL Server data folder in user-appData... But still problem is there. What can be done to solve this issue?

System error 5 while setting up SQL server on share

I am trying to setup a SQL server on a local share. I am doing this because it is too expensive at my organization to buy a SQL server. I followed steps from:
https://stackoverflow.com/questions/12881455/sql-server-database-on-network-share
this is being done on Microsoft SQL server
Now, when I write in SQL server management studio (2012)
xp_cmdshell 'net use I: \\ShareDriveLocation'
I get a System error 5 has occurred, like below:
System error 5 has occurred. NULL. Access is denied. NULL. NULL
I have access to this share and I have even tried to map it on the work space I am working, still the same error.
I am working on a windows 7 machine and I connect to SQL server management studio with the name of my work space (DVVDI1234\SQLEXPRESS)
I would advise running SQL Server Management Studio as administrator.
The error suggests that the application doesn't have permission to do this.

Error starting SQL Server configuration manager

Trying to open SQLSTD configuration file, but can't access it. Anything am doing wrong here? I have all the permission
Error message when you open SQL Server Configuration Manager in SQL Server: "Cannot connect to WMI provider. You do not have permission or the server is unreachable"
Please help
MS KB shows some cause and fixes as well
Cause:
This problem occurs because the WMI provider is removed when you uninstall an instance of SQL Server. The 32-bit instance and the 64-bit instance of SQL Server share the same WMI configuration file. This file is located in the %programfiles(x86)% folder.
Resolution:
run below commmand in command prompt
mofcomp "%programfiles(x86)%\Microsoft SQL Server\number\Shared\sqlmgmproviderxpsp2up.mof"
Your number depends on version you are using
Microsoft SQL Server 2012 110
Microsoft SQL Server 2008 R2 100
Microsoft SQL Server 2008 100
Microsoft SQL Server 2005 90
Re-installation of sql server worked for me

Microsoft SQL Server Management Studio connection error

I am getting an error while opening the Microsoft SQL Server 2014 Management Studio:
named pipe error 40( Microsoft SQL server could not connect) Microsoft SQL server error: 67.
Possible reasons:
1) You entered an invalid Server Name\named Instance.
2) You installed MS SQL SERVER 2014 in a PC joined in a domain where the user has restrictions in accessing through the Database, because most of domains controller/server have installed SQL SERVER Express edition on it.
If you want to ask how I know about the reasons, it's because I experienced the same problem as before and talked directly to our System Admin/Head IT Department about the issue.

SQL Server 2008, Error: 948 While Attach Database got Version error?

Yesterday I installed SQL Server 2008 on my laptop (Windows 7 64 bit), I need to attach a .mdf to the server, but when I try to do this, I get this error:
Attach Database failed for server 'prince/sqlexpress' (Microsoft.SqlServer.smo)
ADDITIONAL INFORMATION:
1.An Exception Occured while executing a Transact Sql statement or Batch (Microsoft.SqlServer.connectioninfo)
2.Unable to open the Physical file Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)
With the help of Internet, I found some solution.
1.Start SQL Server manager as Administrator (right-click on the program, choose "Start as administrator"):
But I still got the same error.
That .mdf file does have have permission, so I moved into external drive (pendrive because my system have only C:\ drive, yet no partition I have done ) .
Then I got another error,
Attach database failed for Server 'Prince\SQLEXPRESS'.
(Microsoft.SqlServer.Smo) ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
The database 'Databasename' cannot be opened because it is version
655. This server supports version 611 and earlier. A downgrade path is not supported. Could not open new database 'Databasename'. CREATE
DATABASE is aborted. (Microsoft SQL Server, Error: 948)
I use the Query -
"select ##version;"
I got the Output as
"Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86) Feb 9 2007
22:47:07 Copyright (c) 1988-2005 Microsoft Corporation Express Edition
on Windows NT 6.1 (Build 7600: )"
what shall i do? But i installed SQL Server 2008. how do i change that?
How to solve this error, please help out this problem, If you have any solution please post it.
The message is very clear: the database MDF file is version 655. Your server understands version 611. Which means, despite to your claim to the contrary, that you are connected to a SQL Server 2005. Install a SQL Server 2008, connect to it, and attach your database. Please pay attention during the installation process to the instance name you choose and make sure you connect to that instance. You can also check now what instances you have installed, look at what services you have on your system. MSSQLSERVER will be the default instance, MSSQL$<instancename> will be a named instance. Use any SCM query tool to see what services you have installed, eg. sc.exe.
Microsoft SQL Server Management Studio needs Administrator rights to attach database in Windows 7. If you execute it directly so you will get the error 5120. Fix this executing Management Studio icon using the right mouse button and selecting execute as administrator. Good luck.
Finally I Solved My Problem,
Stop the SQLEXPRESS service and Uninstall all the Components related to SQL server 2005.
Then Open the registry Editor Go to HKEY_LOCAL_MACHINE--SOFTWARE--MICROSOFT--MICROSOFT SQL SERVER-DELETE the folder 90. Then again reinstall SQL Server 2008 and create new instanse for 2008 server. Now its working, I m able to Attach the mdf file.