How to restore the database.bak file in SQL Server 2008 - sql-server-2008

I have a database backup file I need to restore in SQL Server 2008.
I get an error
Specified cast is not valid. (SqlManagerUI)

Try this first and see if the backup is healthy:
DO
RESTORE FILELISTONLY FROM DISK = N'YOURFILE.bak'
then we can take it from there

Please check the Sql server version of the database from where you have backed up the version of database must be same or upper .Only then you can restore the database backup

Related

Restoring huge MySQL dump file to MS SQL Server 2008

I have a 19 GB .sql file which is a dump of a MySQL database.
How could I go about mounting that to MS SQL server? Is it just a matter of loading the 19 GB file into management studio and hitting F5?
I don't have access to the original MySQL databases or the server they were running on.
Thank you.
I would go about it like this.
Restore the MySQL databases to a MySQL server.
Setup a linked server from MS SQL to MySQL
Do a SELECT * INTO destinationtable FROM linkedserver.dbo.sourcetable
The only problem here is that you will need to make sure that index definitions etc are recreated.
Youre MySQL backup file will not run in MSSQL without a LOT of work.

Error when restoring database to a new server

I receive the following error when I try to restore a database to SQL Server 2008 from SQL Server 2008 Express R2:
The database was backed up on a server running version 10.50.2500.
That version is incompatible with this server, which is running 10.00.4064.
Either restore the database on a server that supports the backup, or use a backup
that is compatible with this server.
Is there anything that I can do to fix this or am I stuck using SQL Server Express?
You cannot go "back" in SQL Server versions - if your database is on 2008 R2 (v10.50) - you cannot back it up and restore it onto a 2008 (v10.00) version.
There's no trick, no workaround, no hack - it just cannot be done - period.
So you either need to upgrade your target system to 2008 R2 as well (Express will do, as long as the size is below 10 GB), or you need to script out structure and data to .sql files to run those on your "old" 2008 system (possibly using third-party tools like Red-Gate SQL Compare / SQL Data Compare to create those scripts and possibly run them against the target server directly).

Import .bak to MySQL (.sql)

I want to import a MS SQL SERVER2008 R2 database backup to MySQL Server. Any help on how I can convert the .bak to a .sql so that it can be imported to a MySQL database server?
I have read other threads regarding this but none have worked so far.
Thank you.
You can restore the database to a local version of SQL Server (you can download the free evaluation edition to do this):
http://msdn.microsoft.com/en-us/evalcenter/ff459612.aspx
Then you can use the import/export wizard in Management Studio to transfer your tables and other objects to your MySQL database (you may need additional ODBC drivers installed locally in order for SQL Server to establish a connection to MySQL).
EDIT
When restoring the database to SQL Server, don't use the clunky UI. Use an actual RESTORE DATABASE command. For example:
RESTORE DATABASE foo FROM DISK = 'c:\path\foo.bak';
Now, you may find that the original database was created with files placed on drives or folders that don't exist locally. So I suggest creating a very simple folder, temporarily, called c:\db_temp\, giving the Everyone account modify privileges, and then running the following:
RESTORE FILELISTONLY FROM DISK = 'c:\path\foo.bak';
This will return a resultset like:
LogicalName PhysicalName
----------- ------------
Foo C:\...\foo.mdf
Foo_log C:\...\foo_log.ldf
You need to build a RESTORE DATABASE command something like the following, based on the result above:
RESTORE DATABASE foo FROM DISK = 'c:\path\foo.bak'
WITH MOVE 'Foo' TO 'c:\db_temp\foo.mdf',
MOVE 'Foo_log' TO 'c:\db_temp\foo_log.ldf';

where to find MyDataBase.BAK file on SQL server 2008?

where to find MyDataBase.BAK file on SQL server 2008 ?
and how i can restore this file to my DataBase ?
thank's in advance
Did you back it up using SQL only without specifing a full path, e.g.
BACKUP DATABASE MyDataBase TO DISK='MyDataBase.BAK'
GO
I think by default your backup will get placed in the Backup folder in the SQL Server install, i.e. C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup or similar. You can restore it using
RESTORE DATABASE MyDataBase FROM DISK='MyDataBase.BAK'
GO
but if the orginal files are still there you'll need to specify alternate paths for the restore, e.g.
RESTORE DATABASE MyDataBaseTestRestore FROM DISK='MyDataBase.BAK'
WITH MOVE 'MyDataBase' TO 'C:\Temp\TestRestore.mdf',
MOVE 'MyDataBase_Log' TO 'C:\Temp\TestRestore_log.ldf'
GO
but it's so much simpler if you use management studio for all of this stuff.

Is it possible to restore a SQL 7 DB to SQL 2008?

I have an old SQL 7 DB .bak file I am trying to work with now. I tried to restore the backup in SQL 2008, but it said that it was unable to work with the file. Does anyone know how I could restore this DB?
You will need to install SQL Server 7, 2000, or 2005 and restore the backup to one of those first.
SQL 2000/2005 - Restore the backup, export, and restore to 2008.
SQL 7 - Restore the backup and use the SQL Server 2008 import functionality to import the data.
The database you are attempting to restore to is probably set with version 8 compatibility, not 7. That would be the first thing I would check.