1: ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
2:
3: RESTORE DATABASE MyDatabase FROM DISK = 'X:\Path\mybackup.bak'
1: ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
2:
3: RESTORE DATABASE MyDatabase FROM DISK = 'X:\Path\mybackup.bak'
Ayende wrote about Setting Up Zero Friction Projects - Data Access, and mentioned the new SchemaUpdate feature in NHibernate.
The idea being that the ddl is automagically created from the nhibernate hbm.xml files, and executed against the delvelopers local database.
Something like:
At what cost? Well, almost zero :-)
I have created a sample C# VS2008 Solution, that can be downloaded here.
That is take a backup of database A and restore the .bak file to database B.
By far the easiest way is to do it in script:
restore database myDatabase from disk = 'C:\mybackup.bak' with replace
No more opening of SSMS (yawn), replacing file paths and remember to set a overwrite flag.
Jeff has a great post titled The shortest, fastest, and easiest way to compare two tables in SQL Server: UNION !
No joins or select in. Just pure UNION magic.
If you execute the same query two or more times in a row, the time it takes to complete might vary. If you are the only user on the database, it is because of the build in query cache.
The cache can be cleared with the following script:
DBCC DROPCLEANBUFFERS DBCC FREEPROCCACHE