データベース・バックアップ・リカバリ

2874 ワード

-- 
BACKUP DATABASE test to disk = 'D:\test.bak' --
go

--
--
1、
create database hotelbook_Data
on primary(filename='D:\shujuku\hotelbook_Data.mdf')
for attach


--2、 BACKUP
RESTORE DATABASE TESTDB
FROM DISK = 'D:\test.bak'
WITH MOVE 'TEST' TO 'D:\SQL\test.mdf',
MOVE 'TEST_LOG' TO 'D:\SQL\test.ldf'


--
drop database test
go

backup database to disk= ' ' with  COMPRESSION --sql server , 。

--
select 'kill '+CONVERT(varchar,spid)
from master..sysprocesses
where DB_NAME(dbid)='YinTaiOrder'




参照先:http://www.iteye.com/topic/166475