I'm trying to upgrade a database from a SQL Server 2000 instance to a SQL Server 2008 instance. I'm doing this by right clicking on the database and selecting copy database. My current issue is that I'm getting this error in the log file:
OnError,AQUE-SQLDEV,NT
AUTHORITY\SYSTEM,aque-db2000_aque-sqldev_sql2008_Transfer Objects
Task,{F0ACDE4D-D023-400C-BE3C-91CD3A537988},{40E67169-0F3F-4F86-AD2E-6E2CB532BA5C},18/10/2011
15:38:37,18/10/2011 15:38:37,0,0x,Script failed for User 'WebUser'.
StackTrace: at
Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyCollection
depList, SqlSmoObject[] objects) at
Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(SqlSmoObject[]
objects) at
Microsoft.SqlServer.Management.Smo.Transfer.Microsoft.SqlServer.Management.Common.ITransferMetadataProvider.SaveMetadata()
at
Microsoft.SqlServer.Management.Dts.DtsTransferProvider.Configure(ITransferMetadataProvider
metadataProvider) at
Microsoft.SqlServer.Management.Smo.Transfer.GetTransferProvider()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData() at
Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
InnerException-->Creating a user without an associated login is not
supported in SQL Server 2008.;
Does anyone know why this might be happening?
Thanks,
Sachin
Based on the error it sounds like you need to create a login first on the SQL 2008 server that matches the same login/user that exists on the SQL 2000 server. You could do a couple of things:
create a new database in 2008 to migrate to
create a new login in 2008 that matches the existing login from sql 2000
map the new login to that new database from step #1
run the copy database wizard
If it was me, I would do as marc_s suggested and perform a full backup of the existing database on sql 2000, then restore to a blank database in sql 2008. If you can, update the compatibility mode in database properties to be 2008. I've done this hundreds of times and works like a charm.
The reason can be that a file with the new Database name already exist on the filesystem. We encountered this when we renamed Database X to X_Old, and tried to copy database Y to X. This cannot be done, because database X_Old is still associated with the filename X.
Either delete the conflicting database, or rename the file on the file system.
See http://codecopy.wordpress.com/2012/01/03/error-while-copying-a-database/
Related
I have SQL Server 2012 (64-bit) (MSSQL11)
running on Windows 2012 R2 (64-bit) (NT 6.3)
with .NET framework 4.0.
It has a database called db_X and since this is a live production database it is always running and stopping it is not an option.
This is the only SQL Server database server that I practically have.
I want to take a backup (i.e. a full backup) of db_X (which I know how to do) and restore that backup (that .bak file) under a different name (say db_Y) in the same SQL Server database server.
I created a new database called db_Y, then right clicked db_Y then went to Tasks --> Restore --> Database...
Then I gave the path to that .bak file (as source) and tried to restore it by giving db_Y as destination (with the option - overwrite the existing database i.e. WITH REPLACE)
But this is not working. It is giving an error.
It says restore of database db_Y failed. System.Data.SqlClient.SqlError: The file C:...\db_X1.mdf cannot be overwritten. It is being used by database db_X. Microsoft.SqlServer.SmoExtended.
But I still believe that this can be done using the Management Studio. Or at least using a script. (as this is a common requirement.)
Why is it trying to restore on db_X, when I have clearly given db_Y as my destination? Isn't this a bit scary as db_X is my live database (because I might lose some data)?
How is it possible to (have a copy of an existing and running database under a different name in SQL Server or in other words) restore a backup of an existing and running database with a different name in SQL Server 2012?
I am grateful if someone could kindly explain how this can be done using the Management Studio or at least using a script.
When you are restoring the database, you need to rename the database to something other than the name of the original:
And then click the Files section and makes sure the file names are different than the original database:
I installed a trading software that uses pair specified and gives me details about it. For initiating the software I have to create a database that it uses to store and retrieve information from. Now I have deleted the database(mdf and ldf file) and now when I create it again it shows that database already exists error. Do I have to delete DSN or something?
I can do create database using another sql server instance, but I want to do on the same one.
I am clueless. Thanks in advance.
The database information is maintained by sql server express. So just deleting the file doesn't remove the database from sql server. You need to detach the database and then your logic should work. Try sql server management studio express 2008. Or try connect to sql server express programmatically and execute sp_detach_db permissions.
Source : MSDN
A Database is not only MDF and LDF files but also a record in the master database. So you should drop this record about your DB using DROP DATABASE command or through MSSQL Enterprise Manager.
I have a db running on an instance of sqlserver 2003, Ive tried to import it into sqlserver 2012 but that wont work it's says it's to old.
so I've imported it into sqlserver 2005, I have then backed it up again and tried to import it into sqlserver 2012 but it comes up with the same error.
I can restore other db's from sqlserver 2005 so I can only presume its keeping its 2003 settings when I back it up.
Can anyone help
I suspect that your database might have some deprecated functionality that prevents your upgrade from working.
There's a list of deprecated functionality between SQL Server 2000 and SQL Server 2005 on technet.
I would strongly advise you to use the SQL Server 2005 Upgrade Advisor to identify such functionality, and address any potential issues. Then, and only then you should have a database compatible with SQL Server 2005, and can (hopefully) proceed from there.
if u want database structure only then take database script then run into sql server 2005, if u want database with data also mean
right click the Database go task
click Generate Script
There Two options entire database or with specific objects
entire database for DataBase structure only
with specific objects - select all objects then click Next you find the Advance button then click it.
scroll down and Find Type of Data Scripts click and change to Schema and data then you will save as file file or new query window
this is one of the method to restore the database.
Set your compatibility level to (90) Sql server 2005 in your database properties after restoring.
I created a database in SQL Server 2008. I detached the database and I copied the .mdf over to the server, which is running SQL Server Enterprise Manager (SQL Server 2000).
When I try to attach the MDF I get...
Microsoft SQL-DMO (ODBC SQL State: HY000) Error 602: Could not find
row in sysindexes for database ID 13, object ID 1, index ID 1. Run
DBCC CHECKTABLE on sysindexes.
What does this mean? Is this because the db was created in a newer version?
From the documentation on the (I believe depreciated, but used in SQL Server 2000) sp_attach_db stored proc:
A database created by a more recent version of SQL Server cannot be
attached in earlier versions.
I think you'll have to script the schema and data of your database.
Pinal Dave has a good tutorial on how to do this here - just remember to make sure you choose the following settings:
Under General:
Script for server version: SQL Server 2000
Under Table/View options:
Script data: True
Remember to double check the settings for any others you might be interested in, such as foreign keys, triggers etc.
This is do-able, but you'd need to convert it to the SQL 2000 format before detaching it and attaching it on the old server. Here are the steps:
In entreprise manager, right click the database
Choose properties
On the left, click Options
Change the "Compatibility Level" to SQL Server 2000 (80)
Then save, and detach before reattaching on the old server.
I have created a database in App_Data and I want to use this file in my project.
In the toolbar I grabbed the sqlDatasource. I clicked on Configure data source. I chose Microsoft SQL Server database file and said continue. I browsed for the file. I chose it then I clicked ok. The following error occurred:
I says the database myweb.mdf cannot be opened because it is version 661 and the server version is 662 and earlier: create database is aborted. The attempt to attached an auto-named database for the \app-data\myweb.mdf failed. A database with the same name exists or specified file cannot be opened or it is located on UNC share.
Sounds like you've upgraded to SQL Server 2008 R2 Whilst the database was created in SQL Server 2008, seems you need to upgrade the database using the database migration wizard
see this answer for a similar problem
Check this: SQL Server: Attach incorrect version 661
You'll have to either upgrade your 2008 SP2 instance to R2, or you have to copy out the data in that database into an 2008 database (eg using the data migration wizard, or something equivalent).