SQL Server 2000 / SQL Server Management Studio 2008 - How to copy a database? - sql-server-2000

I'm connecting to a SQL Server 2000 server with SQL Server Management Studio 2008 and need to make a copy of a database.
Right-Click the database and pick Copy Database brings up the nice wizard. When I pick the destination server (the same server as the source server) the wizard happily tells me I need SQL Server 2005 or better and stops.
How can I make a copy of the database? I have no access to the computer other than through the management studio. Upgrading the server is not an option that is available to me.

You'll probably need to backup the DB, then restore it with a the new name (and then get someone with access to do the clean up). This should be OK as long as you make sure that the physical file locations are updated when you choose a new db name.

Related

How to import Sql Server 2008 database into sql server 2012

My problem is I am working on a project and its database is created in SQL Server 2008. But I has SQL SERVER 2012 installed in my PC. I cannot import this file into my sql server and also cannot connect this database file with visual studio 2013
Help me please
The easiest way is creating a database backup in 2008, and restoring that into 2012. Should work without any issues, and the restore process will automatically upgrade the database to 2012.
Alternatively, it should also be possible to detach the database from 2008, after which you can copy the files (Do not move them, but copy. That way if anything goes wrong, you have a fallback option). You should then be able to attach it in 2012, which again, will convert the database to 2012.
There's also an option of using the copy database wizard from inside SSMS, which also converts the database.
Please note that if you convert the database, from that moment onwards, all other developers will have to upgrade to 2012 as well.

how to attach .mdf file to sql server 2008 EXPRESS

I have .mdf files created using SQL SERVER management studio in another computer and wish to attach the same to SQL SERVER 2008 EXPRESS in another computer. How should I do so?
I tried this method :How to: Attach a Database File to SQL Server Express
but then it shows an error that the database cannot be created due to compatibility issues.
Msg 948: The database xyz cannot be opened because it is version 706.
This server supports version 655 and earlier. A downward path is not
supported..
....
This basically means your SQL versions don't match. For example, if you backup a database on SQL 2012, you can't restore it to 2008. In your case Version 706 is a database file from Sql Server 2012 and Version 663 is a database file from Sql Server 2008R2 (with some SP).
You can either install SQL Express 2012 to attach the MDF, or if you can't do that, you would have to script out your schema and data and create the DB from scratch.. Unfortunately there's no way to 'downgrade' and MDF back to an older version of SQL.
The message is very clear:
The database MDF file is version 706. Your server understands version 655 . Which means, despite to your claim to the contrary, that you are connected to a SQL Server 2008.
Install a SQL Server 2012, 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.
SELECT ##VERSION AS 'SQL Server Version'

SQL Server 2008 Version Problem [duplicate]

I am getting following error.
Restore failed for Server
I have recently upgraded SQL Server 2005 Express to SQL Server 2008 Express.
I have taken a Backup on Production Server, having SQL Server 2008
Backup was good and I tried restoring Backup on Production Server, that works great.
Than I downloaded that backup file in .Zip format with FileZila Software (And that is good too).
But when I tried to restore that file I am getting following error.
Restore failed for Server
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------ ADDITIONAL INFORMATION:
The media family on device 'C:\go4sharepoint_1384_8481.bak' is incorrectly formed. SQL Server cannot process this media family. RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4053&EvtSrc=MSSQLServer&EvtID=3241&LinkId=20476
Things I tried which didn't worked
Attempt 1
Try to take backup using following command
BACKUP DATABASE go4sharepoint_1384_8481
TO DISK='C:\HostingSpaces\dbname_jun14_2010_new.bak' with FORMAT
And tried restore that file.
Attempt 2
Somebody wrote to test Version of my SQL Server.
When I tried to run following command in SQL Server 2008
Select ##Version
It is giving following output
Microsoft SQL Server 2005 - 9.00.4053.00 (Intel X86) May 26 2009 14:24:20 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 6.0 (Build 6002: Service Pack 2)
My Production Database is in SQL Server 2008, and I am trying to restore DB in SQL Server 2008 but above version is showing as if i am using SQL Server 2005.
Any idea how can I restore SQL Server 2008 DB.
Many Thanks.
Is it possible that, instead of upgrading your 2005 instance to 2008, you instead installed 2008 side-by-side with 2005, and you're connecting to your existing 2005 instance? Look for other instances on your machine.
You cannot restore a backup from a higher SQL Server version on a lower version - this has never been able in SQL Server.
If you have a SQL Server 2008 backup, you can only restore that on a SQL Server 2008 (or later) machine - but not on a 2005 box. No trick, no workaround, no way to do it.
You have 2 options here.
Use WITH REPLACE while using the RESTORE command. This will overwrite the existing database and restore the database state represented by the backup files.
Delete the database to which you are trying to restore to and restore again using RESTORE command. This will create a new database with the state represented by the backup files.
Please note that in both these options you will lose the existing data of the database you are trying to restore to.
Make sure it is installed correctly - in your program files\microsoft sql server directory there whould be a 100/150 folder. Check out the install log in setup bootstrap\log.
As described above the reason for this behaviour is that by default SQL Server doesn't allow restoring a database backup to an older version of SQL Server, regardless of the compatibility level of the database the backup was taken from.
You can try to:
Start SQL Server Management Studio and connect to the instance where the database resides
In the database context menu navigate to Tasks | Generate Scripts…. This will invoke the Generate and Publish Scripts wizard
In the Introduction step of the wizard click Next
In the Choose Objects step of the wizard make sure that the Script entire database and all database objects option is selected and click Next
In the Set Scripting options step of the wizard:
Select the Save scripts to a specific location option
Specify whether the database objects and data will be scripted to a single file multiple files, as well as the path and encoding of the generated scripts
Click Advanced
In the Advanced Scripting Options dialog that will appear:
Specify the version of the SQL Server you need the database restored to in the Script for Server Version option
In the Script for Server Version option specify Schema and data
Set the following options to True:
Script Logins
Script Full-Text Indexes
Script Triggers
Click OK
Click Next
In the Summary step of the wizard click Next
In the Save or Publish Scripts step of the wizard click Finish
Execute the generated SQL script(s) against the older SQL instance
Although the procedure listed above should work:
1. It doesn’t migrate all of the database objects (e.g. sequences or queues)
2. It might fail if your database contains dependencies which SQL Server fails to recognize (e.g. dependencies to databases residing on linked servers)
You can take a look at the rest of the article on Solution center. There is also third party tools you can take in consideration.

Connecting to SQL Server 2008 Express from VB 2008 Express

I'm using VB 2008 Express for our College Project. I'm also running SQL Server 2008 Express and have installed SQL Server Management Studio and used it to create my database.
Both software have been installed and running locally. I'm trying to connect to the database from VB 2008 Express. Database connection wizard have 3 options:
connecting to Access db
connecting to SQL Server 3.5 compact db and
connecting to SQL Server db file.
There are no problems connecting to the first two but when I try to connect to my SQL server DB file (.mdf) it throws the following error ("Unable to open the physical file .... Operating system error 32:(failed to retrieve text for this error. reason:1815.......an attempt to attach an auto-named database for file ...... .mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share")
I appreciate if anyone who had the same experience and overcome the problem could point me in the right direction.
Thanks very much.
Little Critter.
You need to detach your database from the server. Since you created the file there it is already running on the SQL Express server. Operating System Error 32 is a sharing violation and it means that the file is in use.
Try this:
Open Sql Express 2008 Managment Studio and find your database in the Object Explorer tree.
Right click on your database, choose tasks, and then select "Detach"
When the "Detach Database" dialog appears, select the checkbox that says "Drop Connections"
Click ok.
Your database should detach from the database server. Now the server will no longer bring that database up automatically and you should be able to get exclusive access to it.
Note that if you want to make more edits to the MDF you will have to reattach the database or you will need to use the tools built into VB 2008 Express. Because of this most people would choose to leave the database attached and not run it as a "User Instance". Check out this link for alternative ways to get to your data: How to: Access and Initialize Server Explorer/Database Explorer.
Anyway, you may have your reasons for setting it up this way. The steps outlined above should fix you up. Good luck with your project!

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.