ich bekomme regelm��ig MS-SQL-Server Datenbanken zugeschickt und
vermute, dass diese manchmal vor dem Kopieren nicht heruntergefahren
wurden. Mich interessieren nur die Inhalte der Datenbanken, daher
folgende Fragen:
Kann man aus einem mitkopierten *.ldb File analog wie bei Access
schlie�en, dass die Datenbank nicht runtergefahren wurde? Welche
Programme / Dienste reicht es zu beenden, damit Datenbanken sicher
kopiert werden k�nnen?
TIA, Georg Telemann
To copy a data base in SQL Server, the best option is to use
BACKUP/RESTORE. You run these commands from with in a query window.
To backup up a database is easy:
BACKUP DATABASE yourdb TO DISK = 'somefile'
To restore a copy, takes a little more job. First run "sp_helpdb yourdb",
the using that output you can do:
RESTORE DATABASE yourcopy FROM disk = 'somefile'
WITH MOVE 'name1' TO 'filepath1-modified',
MOVE 'name2' TO 'filepath2-modified',
REPLACE
name1 and name2 are the names in the rightmost column in the output.
Those are the logical names of the files.
filepath1 and filepath2 are the physical names for the files, and you
need to modify these names, preferably to match the names of your copy.
There are also wizards etc in Management Studio, but they mainly serve
to leave you at a guess what is actually going on. And by using commands,
you can save those in a file and reuse later.
--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx