SQL Server 2008 installed, though running version is still 2005 - sql

A while back I installed SQL Server 2008 on a development machine which already had Sql Server 2005 express from Visual Studio. When I look in my programs, I see 'Microsoft Sql Server 2008', which contains the management studio, etc. As well I can see 'MS Sql Server 2005'.
When I run a query in Management Studio 2008 to select the version running on my machine, it comes up as 2005, and leaves me scratching my head. When I look in the configuration manager, all I see is the SQLEXPRESS instance running ...
Are there any "quick" solutions to get 2008 running instead of 2005, considering 2008 is installed?

If your using the SQL Server 2005 Configuration Manager you will only see 2005 instances and lower.
To view instances of SQL Server 2008 you will want to make sure you are using SQL Sever 2008 Configuration Manager.
The final option would be to View All services using the Service Control Manager. Here you will need to look at what instances of SQL Server you have running on the machine.

If you want to find all the instance names, one way is to run powershell and execute the following
PS C:\> gwmi win32_service -filter "name like 'MSSQL%'" | fl DisplayName, pathname
For me the result is
DisplayName : SQL Server (SQLEXPRESS)
pathname : "c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\B
inn\sqlservr.exe" -sSQLEXPRESS
DisplayName : SQL Server (SQLEXPRESS2005)
pathname : "c:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Binn\sqlserv
r.exe" -sSQLEXPRESS2005
DisplayName : SQL Full-text Filter Daemon Launcher (MSSQLSERVER)
pathname : "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\
Binn\fdlauncher.exe" -s MSSQL10.MSSQLSERVER
DisplayName : SQL Server (MSSQLSERVER)
pathname : "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\
Binn\sqlservr.exe" -sMSSQLSERVER
DisplayName : SQL Server Active Directory Helper
pathname : "c:\Program Files\Microsoft SQL Server\90\Shared\sqladhlp90.exe"
DisplayName : SQL Active Directory Helper Service
pathname : "C:\Program Files\Microsoft SQL Server\100\Shared\SQLADHLP.EXE"
DisplayName : SQL Server Analysis Services (MSSQLSERVER)
pathname : "C:\Program Files\Microsoft SQL Server\MSAS10.MSSQLSERVER\OLAP\bi
n\msmdsrv.exe" -s "C:\Program Files\Microsoft SQL Server\MSAS10.M
SSQLSERVER\OLAP\Config"
Look for the one that has MSSQL10 and make sure that the service is started. Then use that instance name when connecting via SSMS.
If for some reason you didn't install into the default structure you can always visit the Exe directly and check its version for something like 2007.100.xxx
I happen to have 2005 and 2008 express as well as 2008 standard
If I was better at PowerShell I would have piped the PathName to get the version info

Related

Restore BacPac database backup in sql server 2014

I have database backup file with extension .bacpac so how can i restore it in sql server 2014 ?
Two options:
In SQL Server Management Studio, right-click on the Databases folder in the Object Explorer tree. Then click on "Import Data-tier application". The wizard will guide you through the process.
From the command line, run this command: "c:\program files (x86)\Microsoft sql server\120\dac\bin\sqlpackage.exe" /a:import /sf:"PATH_TO_YOUR_BACPAC_FILE" /tcs:"Data Source=YOUR_SERVER_NAME;Initial Catalog=NEW_DATABASE_NAME;Integrated Security=true"
Aside: Note that the example connection string in the command line option above assumes you're using Windows Authentication instead of SQL Server authentication to access the server.

SQL Server Configuration Manager - Cannot connect to WMI Provider

I am trying to run the SQL Configuration Manager and get this error:
The typical solution is not working. Nor are any of the associated ones: running cmd as admin or changing mofcomp to mofcomp.exe. I keep getting an Access denied, 0x80070005 error despite having granted full control to sqlmgmproviderxpsp2up.mof as well as its parent folders to the users & admins on the computer.
Please help.
Navigate to your SQL version’s shared directory (cd ):
SQL 2008: C:\Program Files (x86)\Microsoft SQL Server\90\Shared\
SQL 2008 R2: C:\Program Files (x86)\Microsoft SQL Server\100\Shared\
SQL 2012: C:\Program Files (x86)\Microsoft SQL Server\110\Shared\
SQL 2014: C:\Program Files (x86)\Microsoft SQL Server\120\Shared\
Then run the following command:
mofcomp sqlmgmproviderxpsp2up.mof

Error when using sqlmaint.exe with SQL Server 2008 R2 Express

Before my migration from MSDE (SQL Server 2000) to SQL Server 2008 R2 Express, I used the following sentence to take a backup of my database :
C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn>sqlmaint.exe
-S \"(local)\\SQLEXPRESS"\
-D \"DB Name"\
-BkUpDB \#"C:\Documents and Settings\emmug\Application Data\CalibrationSystem\Backup"\
-BkUpMedia DISK
But now, I get this error :
Microsoft (R) SQLMaint Utility (Unicode), Version 10.0.1600.22
Copyright (c) Microsoft Corporation.
The SQLDMO 'Application' object failed to initialize (specific error: One of the library files needed to run this application cannot be found.)
So I saw that SQLDMO was not supported in SQL Server 2008 R2 but I could use Microsoft SQL Server 2005 Backward Compatibility Components. Unfortunately, that doesn't work.
Microsoft now uses SQL Server Management Objects (SMO) but there don't give any code sample to help me.
So is there somebody know a solution for my issue ?
Thanks
Emmanuel
You can use SQLCMD.exe, e.g
SQLCMD.exe -S "(local)\SQLEXPRESS" -Q"BACKUP DATABASE dbName TO DISK = 'C:\Documents and Settings\emmug\Application Data\CalibrationSystem\Backup\dbname.bak'"

Unable to connect to SQL Server 2008 R2

I am unable to connect to a local SQL Server 2008 R2 trial version from Visual Studio 2010 Express.
When adding a new connection, I browse to the database file in this location:C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\AdventureWorks_Data.mdf, I encounter this error:
Could not open new data base 'C:\PROGRAM FILES\MICROSOFT SQL
SERVER\MSSQL10_50.SQLEXPRESS\MSSQL\DATA
ADVENTUREWORKS_DATA.MDF'.CREATE DATABASE is aborted. An attempt to
attach an auto-named database for file C:\Program Files\Microsoft SQL
Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA AdventureWorks_Data.mdf
failed. A database with the same name exists, or specified file cannot
be opened, or it is located on UNC share. File activation failure.The
physical file name "C:\Program Files\Microsoft SQL
Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\AdventureWorks_Data_log.ldf"
may be incorrect.
The log cannot be rebuilt when the primary file is read-only.
Another guess, you don't by any random chance have another user logged into the same machine that would have the DB file locked by connecting to it in the same way you say you're trying to? I'd imagine the previous comment about that database file already being attached to by the sql service is probably far far more likely, but just for wild chance I'm leaving my idea here for you or anyone else who happens by

SQL Server 2005 backup restore failing (with folder permissions)

I am trying to restore a database (from file thedb.bak). I am using SQL Server Express edition 2005 on a Windows 7 Ultimate 64-bit machine.
When I try to restore I get the following error:
System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\Thedb.MDF'. (Microsoft.SqlServer.Express.Smo)
My username (antoniocs) is an Administrator. I have edited the permissions in the folder (C:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\) so that the user AntonioCS has full control.
I really need to restore this backup. What am I missing?
Note: I am using the Windows authentication to login. Should I try another user (the one I use is an administrator in the machine)?
The account running the SQL Server service requires permissions on that folder.
You may be connected to SQL Server, but actions are done in the service account context: not you.
Run services.msc from command line, see what account is used, permission this folder accordingly.
Do you have a database that uses Thedb.MDF? I ran into this error when I tried to restore a database over a file that SQL Server used. From the restore window, choose Options and change the path or the filename from the "Restore the database files as".