Procedure: BackupDB ,备份数据库的进程,网站中可用到
USEGO
/****** Object: StoredProcedure . Script Date: 08/18/2008 09:47:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE .
as
declare @location varchar(120)
set @location = N'c:\dbbackups\SERVERDB.bak'
BACKUP DATABASE TO DISK = @location WITH NOFORMAT, INIT, NAME = N'KO-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
declare @backupSetId as int
select @backupSetId = position from msdb..backupset where database_name=N'Kn_Online' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N'Kn_Online' )
if @backupSetId is null begin raiserror(N'Verify failed. Backup information for database ''Kn_Online'' not found.', 16, 1) end
RESTORE VERIFYONLY FROM DISK = @location WITH FILE = @backupSetId, NOUNLOAD, NOREWIND
Don't forget to change @location.
this proc is usefull because u can easily attach it to a php file, and make something like a: *Backup Tool*使用这个进程你可以轻易的在PHP网页中实现备份数据库的功能 ...............看不懂
页:
[1]