Monthly Archives: October 2015
Database [Database Name] cannot be upgraded because its non-release version (539) is not supported by this version of SQL Server.
The error is due to the incompatibility of the database you are trying to import as compared to the version of SQL server you are trying to import as destination server.
The error is :
“Database ‘pubs’ cannot be upgraded because its non-release version (539) is not supported by this version of SQL Server.
You cannot open a database that is incompatible with this version of sqlservr.exe. You must re-create the database.
Could not open new database ‘pubs’. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 950)”
Possible reasons:
Trying to restore an older version of the databases into higher version of SQL Server engine (based on compatibility mode)
Possible Solutions:
- One way is to extract the source database by exporting to SQL script and executing on the destination server
- or use SQL Database Migration wizard. Even though it was created specifically for migration on premise DB to cloud database it works for on premise DB to on premise migration too)
Unable to open the physical file [Database Name].mdf. Operating system error 5: “5(Access is denied.)”. (Microsoft SQL Server, Error: 5120)
It is ACL list error (access control list).
Possible reasons:
- SQL Server service (sqlsrvr.exe) should have RW permissions on the folder that contains the .BAK file (check service account SQL engine is using)
- Trying to create the MDF and LDF file for the intended database at a different location as compared to the default directories
Possible Solutions:
- Add the service account running the SQL Server to have full RW access to the folder that contains the .BAK file using security permissions or
- move the .BAK file (or MDF/LDF files depending on restore or attach option) to the default folder for SQL Server backups or
- starts SSMS as administrator or
- change the user account running the SQL service to an account who has admin privileges to the folder containing .BAK file, attach DB and then revert back with original account
Summary of solutions : SQL Server service account should have access to the folders where it is reading or writing to avoid ACL permissions issues.
Unable to open the physical file “”. Operating system error 2: “2(The system cannot find the file specified.)”. (Microsoft SQL Server, Error: 5120)
Error 5120 is a sharing violation of the files we are trying to open.
Possible reasons:
- Incorrectly configured path of MDF and LDF files
- Either of MDF or LDF files are missing
- Because the file is already attached to one of the existing databases on the server
Possible Solutions:
- When attaching the MDF file, remove the log file (assuming you have taken full back of the DB before detach and attach) by clicking on remove using UI
or
use SQL script
[cc lang=”TSQL”]
— Attaching MDF File without ldf file
CREATE DATABASE PubsDB ON
(FILENAME = N’D:\MSSQL\DATA\PubsDB.mdf’)
FOR ATTACH_REBUILD_LOG
GO
— if one file missing
CREATE DATABASE PubsDB ON
( FILENAME = N’D:\MSSQL\DATA\PubsDB.mdf’)
FOR ATTACH
GO
— recreate all log files
EXECUTE sp_attach_single_file_db @dbname = ‘PubsDB’,
@physname = N’D:\MSSQL\DATA\PubsDB.mdf’
GO
[/cc]
Unable to open physical file – Operating system error 5: 5(error not found) Microsoft SQL Server: Error 5120
It is a clear indication that either MDF or LDF files is missing.
Try below options:
- give permissions to the account running SQL Server service to the location where MDF & LDF files are located
- open SSMS with admin privileges
- modify the MDF and LDF files properties as below
right-click on the file in Windows Explorer, select Properties
select the Security tab
Click Advanced
Click Change Permission
Uncheck “Include inheritable permissions…”, a window will open
Click Remove (removes all permissions), the window will close
Click Add
Enter your login name and click OK, the permission window will open
Check Full Control – Allow
Click OK, OK, OK, OK



