database-restore

Keeping SQL Server Dev Environment up to date

Hi All, I'm trying to figure out the best way to keep my Development servers synced up to the Production servers. Initially, I was just going to restore the backups from the production environment to the dev environment every week or so, however I realized that this would wipe out any actual development work that had taken place during ...

Problem in importing database in MySQL

I have a .sql file with some database backups inside. Now I want to restore them back to MySQL. How can I this using command line of MySqL please? I found this: mysql -u username -p -h localhost database_name < dumpfile.sql but I don't know what username should be, what database_name should be and how I could browse to a .sql file ...

Best way to auto-restore a database every hour

I have a demo site where anyone can login and test a management interface. Every hour I would like to flush all the data in the SQL 2008 Database and restore it from the original. Red Gate Software has some awesome tools for this, however they are beyond my budget right now. Could I simply make a backup copy of the database's data fil...

choose append to existing backup instead of overwrite

Hello, I have a database and I made it's first backup 2 days ago. Then yesterday I spent an entire adding new records. This morning I ran a backup, (but I selected append to existing backup set) as pictured below. I just ran a restore and I found that it wiped out all my data from yesterday and it restored it from the backup of 2 days a...

Undo table updates in SQL Server 2008

I updated a table in my SQL Server 2008 by accident, I was updating a table from another by copying cell by cell, but I have overwritten the original table. Is there a way that I can restore my table contents as it was? ...

Recreation of MySQL DB using "mysql mydb < mydb.sql" is really slow when the table has tens of millions of records. How to improve it?

It seems that a MySQL database that has a table with tens of millions of records will get a big INSERT INTO statement when the following mysqldump some_db > some_db.sql is done to back up the database. (is it 1 insert statement that handles all the records?) So when reconstructing the DB using mysql some_db < some_db.sql then the...

Getting SqlServer2005 error: backup set holds a backup of a database other than the existing 'DbName' database

I am trying to upgrade from a server running SqlServer2005 (no service packs) to a server running SqlServer2005 service pack 3. I am trying to copy the databases from one to another by doing a backup on one, then a restore on the other. I am using ssms. When I try to restore a backup of, call it DbName, created on the first server,...

Restore Problem SQL Server Version?

Hi, 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 ...

SQL Server 2008 Version Problem.

Possible Duplicate: Restore Problem SQL Server Version? I have recently upgraded to SQL Server 2008 express from SQL Server 2005 express. But when I tried to run following command on SQL Server 2008 Query window Select @@Version I am getting following output: Microsoft SQL Server 2005 - 9.00.4053.00 (Intel X86) May 2...

SQL Server: where do I do put database so that it appears in the listbox

I am trying to restore a DB I am getting this prompt, however I am unable to point to a database to restore from Has anyone else experienced this horrific problem? ...

how to restore a sql server backup containing filestream data assigning a new folder name for filestream data?

To create a new database and populate it from a backup I typically do: CREATE DATABASE MyDatabase -- I create an empty database -- I retrieve the filepath of mdf and ldf files DECLARE @FileData varchar(1000) DECLARE @FileLog varchar(1000) set @FileData = (select filename from MyDatabase.dbo.sysfiles where fileid = 1) set @FileLog = (s...

How to insert into a temp table the info given by RESTORE FILELISTONLY / HEADERONLY / VERIFYONLY.

How to insert the resultset given by the commands RESTORE FILELISTONLY RESTORE HEADERONLY RESTORE VERIFYONLY into an automatically generated temp table ? I would like to use a technique similar to (so the table is auto created, with all the columns matching the resultset's columns) SELECT * INTO #TempTable FROM (RESTORE FILELISTON...

Enabling broker after Restoring Sql Server DataBase

Hello, I have DataBase with enabled Service Broker. Then I want to restore my database in program from backup of other database, but after restoring(I restore on existing database name), my method, whitch enables Service Broker, puts this error: Msg 9772, Level 16, State 1, Line 1 The Service Broker in database "ServeDB2" cannot be ...

Restore SQL Server DB direct from another DB

How can I restore a live database without taking its backup first. We can do this from SQL Server Management Studio, but I want to do this with script, which i can run as a scheduled job. Please help. ...

Need advice concerning the restoration of an sql 2005 Database

Hello. Our goal is to restore a test environment from our live environment, so basically we would like to simply backup our current live databases, and just restore them in our test server. However... we do not have enough room to move the backups, one of our databases is 50 GB, and we only have around 20 GB free(the backup is 40 GB u...

How can I query how much time a SQL server database restore takes?

Hi Im trying to write a query that will tell me how much time a restore (full or log) has taken on SQL server 2008. I can run this query to find out how much time the backup took: select database_name, [uncompressed_size] = backup_size/1024/1024, [compressed_size] = compressed_backup_size/1024/1024, backup_s...

Error restoring backup from SQL2K to SQL2008R2

I'm restoring a SQL 2000 user database on a sql 2008 r2 box, but sometimes I receive the following error. This is also at the SQL Log. Error: 928, Severity: 20, State: 1 During upgrade, database raised exception 156, severity 25, state 1, address 0000000001C05A9F. Use the exception number to determine the cause It has ...

SMO "Restore failed for Server" Restoring Backup From File

I'm using the following code to restore a backup sql database with C# and SMO. void RestoreDatabaseWithSMO(string sConnect, string dbName, string backUpPath) { using (SqlConnection cnn = new SqlConnection(sConnect)) { cnn.Open(); cnn.ChangeDatabase("master"); ServerConnection sc = new ServerConnection(cn...

Exclusive access could not be obtained because the database is in use

I'm using following code to restore databases, void Restore(string ConnectionString, string DatabaseFullPath, string backUpPath) { string sRestore = "USE [master] RESTORE DATABASE [" + DatabaseFullPath + "] FROM DISK = N'" + backUpPath + "' WITH FILE = 1, NOUNLOAD, STATS = 10"; using (SqlConnection con = new SqlConne...