|
|
|
The following script will show you some powerful technique to script backup task for system/user database. Example also shows how to create one file which contains several backups which can expire at specified date. |
Click here to copy the following block |
create table #tmpDevice (device_name sysname, physical_name varchar(255), desription varchar(255), status int, cntrltype smallint, size int)
insert into #tmpDevice exec sp_helpdevice
declare @count int select @count = count(*) from #tmpDevice where charindex('Daily_Sys_Full_Bak', device_name) > 0
declare @ret int if @count > 0 begin exec @ret = sp_dropdevice 'Daily_Sys_Full_Bak' end
EXEC sp_addumpdevice 'disk', 'Daily_Sys_Full_Bak', 'c:\BW_Sys_Full_111705.bak'
BACKUP DATABASE master TO Daily_Sys_Full_Bak WITH Name = 'MASTER_FULL' , INIT BACKUP DATABASE msdb TO Daily_Sys_Full_Bak WITH Name = 'MSDB_FULL', INIT
|
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|