declare @location varchar(120)
set @location = N'c:\KoDB\VuRaLLy-'+replace(str(year(getdate()))+'-'+str(month(getdate()))+'-'+str(day(getdate())),' ', '')+'.bak'
BACKUP DATABASE [Kn_Online] 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
GO
-------------------
Bu Kodu Kopyalamadan Önce C: Klasöründe KODB Adlı Klasör Oluşturun Oraya DB'Yi Oraya Kopyalıyacak
set @location = N'c:\KoDB\VuRaLLy-'+replace(str(year(getdate()))+'-'+str(month(getdate()))+'-'+str(day(getdate())),' ', '')+'.bak'
BACKUP DATABASE [Kn_Online] 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
GO
-------------------
Bu Kodu Kopyalamadan Önce C: Klasöründe KODB Adlı Klasör Oluşturun Oraya DB'Yi Oraya Kopyalıyacak