How do you upgrade a SQL Express Database to SQL Server Workgroup or Standard? - sql-server-2005

I have a website that was originally developed using a SQL Express database in the App_Data folder. Now I need to take upgrade it, without loosing any data, to SQL Server 2005 Workgroup or Standard.
Is there a guide on how to properly upgrade by Microsoft or another source?

When installing Workgroup or Standard it will upgrade the database server and the databases at the same time. Make sure you have a backup of your database (just in case). You can always backup the database and restore it to Workgroup or Standard as well.
Here's a guide:
http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=55

Related

Does SQL Server database compatibility level negate SQL Server version compatibility

For instance I have an application that says it supports SQL Server 2005 to SQL Server 2008. If I transfer that database to a SQL Server 2017 machine and set the compatibility mode to 2008, should it behave just the same as if it were really on a SQL Server 2008 box? I know that the compatibility mode does limit the feature set and behaviors to what would be present in SQL Server 2008. So part of me thinks this should work just fine. But another part of me wonders if there may be others things that I am not considering that could potentially be an issue. Does anyone have any experience where this has come back to bite you?
"Upgrade the database to a SQL 2017 server and set the compatibility
mode to 2008 should it behave just the same as if it were really on a
SQL 2008 server"
Yes this is correct.
This also happens to be Microsoft's recommended upgrade process. As per Microsoft, upgrade to the latest version off SQL Server but keep the source database compatability level.
If a full database backup was taken on a older version of SQL server but restore was done on a new version, then the database compatability level is the same as old version unless its not supported on new version. In that case the database compatability level will switch to the lowest supported.
More here and here

Conversion from LocalDB (.mdf) file to SQL Server Express .mdf file and reverse process

Since we need to move around our database a lot (like update it with new Rows which are generated by code and then update it prod db and reverse process). SQL Server CE, being a file based system was very helpful.
We would like to upgrade to use SQL Server Local Db but at the same time, it has limitations of use with IIS (though possible with AttacheDbFile). In this regard, since LocalDb is more or less a version of SQL Server Express, would it be possible to use our SQL Server LocalDB .mdf in our development environment and then copy them in prod but use by attaching to a SQL Server Express instance?
If yes, what additional thing, we need to do make it possible?
Also, we would like the reverse process to be worked out as well, mean detach the .mdf file and use it as LocalDb in development environment. I have read the great blog articles of
Krzysztof Kozielczyk also but not have experimented much with LocalDb.
LocalDB IS SQL Server Express (introduced with SQL Server 2012 Express), and the .mdf file is identical between LocalDB and SQL Server Express (and even a "full" SQL Server edition like Web, Standard or Enterprise Edition).
The only caveat is: you need to be using the same versions of those databases, since the file format is only identical amongst same versions, and can only be used amongst the same versions (e.g. 2012) - or it can be "upgraded" to the next newer version (e.g. you could move a database from LocalDB 2012 to a SQL Server 2014 Express once it's released) - but you can never go back down to an earlier version (you cannot take a LocalDB 2012 .mdf database file and attach it to a SQL Server 2008 version).

How to automatically restore a SQL Server 2008 R2 backup file

My team needs to update an automated content process running over SQL Server 2008 servers to include the content of a SQL Server 2008 R2 database delivered by a third-party vendor.
The request to third-party to deliver us on SQL Server 2008 is NOT an option.
My common sense indicates there is no way to downgrade from 2k8 R2 to 2k8 as in most of the software products I know. However, I'm wondering if I would be able to do something like this in a script:
Restore SQL Server 2008 R2 .bak file onto our SQL Server 2008 R2 instance
Update compatiblity level to SQL Server 2008 (100). Here is the bug in my plan: I've not found any compatiblity level distinctions between 2008 versions in internet. Any clue on this?
Backup the database.
Restore the database in SQL Server 2008
There may be some other ideas you may want to share with me.
Just recall there should not be manual intervention on this database conversion since this operation needs to be incorporated to an automated process.
Any help/suggestions/comments will be welcome!
No, you cannot restore a database backwards, regardless of compatibility level. Compatibility level affects certain database engine behaviors, but does not downgrade the database version. You will never be able to restore onto 2008 a database that ever existed in a 2008 R2 instance.
For workarounds, you can:
restore the database on R2, then use the import/export data wizard (or a third party tool) to transfer schema / data to the 2008 instance (and you should be able to automate this to some extent, e.g. Red-Gate's tools have command-line interfaces)
upgrade your 2008 servers to 2008 R2 or 2012
push back on the vendor
By design, you can only restore a DB backup to the same or newer version of SQL Server. A backup created with SQL Server 2008 R2 can only be restored with SQL Server 2008 R2 or SQL Server 2012. This is regardless of the compatibility level of the database. It's a limitation of the backup and restore procedures. This has been a limitation since prior to SQL Server 2000 (i.e., every version I've ever used).
Maybe you can script out the creation of new database, instead of backing up and restoring you basically just do a data dump with script.
Try looking at this How can I get a SQL dump of a SQL Server 2008 database?

Will SQL Server Express work with a database made in regular SQL Server?

I was wondering if we could backup the database that we currently host on regular SQL Server, and put it onto our clients computer when we setup SQL Server Express for them.
Is this possible?
Thanks,
Matt
Yes, it's possible to restore a database backup from the Standard edition to the Express edition. It's not possible to restore a SQL Server 2008 to a SQL Server 2005 version, though.
However, there a some minor differences between versions. I've noticed an issue in SQL Server Express 2005 when calling .NET SQL CLR functions across databases, so your mileage may vary. I haven't been able to find a good overview of the exact differences between the various SQL Server editions.
It's always best to keep the development platform as close as possible to the release platform. I can only recommend that you use the Express edition of SQL Server for development as well; and re-test your application.

Importing Sql Server 2005 database into Sql Server express 2008

Is there any way to import a database backup from 2005 into 2008 express edition. What I've had to resort to is doing a script the database, then import all the data through DTS. Whenever I tried to import straight from a backup file it says something about not being to import into a new version of sql server or I'll get the below error.
title: Microsoft SQL Server Management Studio
Specified cast is not valid. (SqlManagerUI)
SQL 2005 backups should be restored on 2008 without problem (have done that myself many times). What exact error message did you got about versions?
The other error (Specified cast is not valid) seems to be Management Studio error, not server error. Have you full rights on 2008 server?
Look at this question - any-reason-to-have-sql-server-2005-and-2008-installed-on-same-machine - there are talked both about restoring SQL2005 backups and about attaching SQL2005 data files.
(Of course you cannot attach production databases. To attach non-production databases just detach them, make file level copy of these and attach copies to new server. Orginal files need to attach to original server too :))
I imagine that you are in a development process where your data will have to be regularly copied to you SQL 2008 server.
You can then think of configuring a replication between the SQL 2005 server (publisher) and SQL Server Express 2008 (suscriber). Depending on your requirements, you have the choice between snapshot or merge replication. If no update is done on the suscriber side, go for snapshot.
Once you want to have your 2008 server running independantely from the publisher, just delete the replication.
A valid SQL Server 2005 Express backup file should be able to be restored to SQL Server 2008 Express. If the SQL Server 2005 backup is from the Standard or Enterprise versions, you might hit problems restoring it to Express. The user context that the backup was created from should not affect the ability to restore that backup.
One thing you can do is to try running the restore operation as a verification, without actually trying to run the restore. That will tell you if the backup file is valid or not. You can use this syntax:
RESTORE VERIFYONLY
FROM yourbackupfile.bak
If possible, I would also suggest trying to simply detach the original database from 2005 and then attaching the file at the 2008 edition.
While I have only tried this with the standard edition myself, it has worked perfectly with the compatibility mode keeping the database set to 2005.
Have you tried running the Upgrade Advisor http://www.microsoft.com/download/en/details.aspx?id=11455 - it might be able to highlight problems for upgrading the original database.