SQL Server 计划数据库备份 2005
我们将对SQL Server数据库进行定期备份 2005 如果没有任何集中备份系统的情况下. Debemos tener encuenta que este sistema no nos va a reemplazar los backups que se van generando constantemente por lo tanto hay que mirar o buscar una solucion para que no se nos incremente demasiado y nos llegue a llenar el disco.
Lo primero es conectarnos a nuestro servidor de Bases de Datos por medio de SQL Server Management Studio.
Nos situamos en el Agente de SQL Server -> Trabajos -> Boton derecho (Nuevo Trabajo)
En General rellenamos el nombre del Trabajo.
En Pasos pinchamos en Nuevo.
Rellenamos el Nombre del Paso, seleccionamos la BBDD y en comando introducimos el Script sguiente que nos realizara la Copia de Seguiridad por fecha:
DECLARE @strDatabase nvarchar(50)
DECLARE @strFolder nvarchar(500)
SET @strDatabase = N’NOMBRE_BBDD‘
SET @strFolder = N’目标路径‘
DECLARE @tToday datetime
SET @tToday = GETDATE()
DECLARE @strBackupName nvarchar(100)
SET @strBackupName = @strDatabase + N’ ‘
+ STR(DATEPART(year, @tToday), 4, 0)
+ REPLACE(STR(DATEPART(month, @tToday), 2, 0), N’ ‘, N’0′)
+ REPLACE(STR(DATEPART(day, @tToday), 2, 0), N’ ‘, N’0′)
+ REPLACE(STR(DATEPART(hour, @tToday), 2, 0), N’ ‘, N’0′)
+ REPLACE(STR(DATEPART(minute, @tToday), 2, 0), N’ ‘, N’0′)
DECLARE @strBackupFile nvarchar(600)
SET @strBackupFile = @strFolder + N” + @strBackupName + N’.bak’
BACKUP DATABASE @strDatabase
TO DISK = @strBackupFile
WITH
NOFORMAT,
INIT,
SKIP,
NAME = @strBackupName
在计划中点击新建.
输入名称, 选择我们想要的计划类型 (每日, 周刊…), 勾选我们感兴趣的天并设置执行时间.
全部确认,这样就创建了新的定时备份.














































