Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SQLError
Yak Posting Veteran
63 Posts |
Posted - 2004-09-16 : 21:53:25
|
| Hi, I have the following sp for backing up my databasesCREATE Procedure s_Backup@Path varchar(256) ,asDECLARE @pathToFile as varchar(256)select @pathToFile = @Path + '\MyDataBase.bak'BACKUP DATABASE MyDataBase TO DISK = @pathToFile WITH INIT , NOUNLOAD , NAME = 'MyDataBase BackUp', NOSKIP , STATS = 10, NOFORMATselect @pathToFile = @Path + '\master.bak'BACKUP DATABASE master TO DISK = @pathToFile WITH INIT , NOUNLOAD , NAME = 'Master BackUp', NOSKIP , STATS = 10, NOFORMATselect @pathToFile = @Path + '\msdb.bak'BACKUP DATABASE msdb TO DISK = @pathToFile WITH INIT , NOUNLOAD , NAME = 'Msdb BackUp', NOSKIP , STATS = 10, NOFORMATselect @pathToFile = @Path + '\pubs.bak'BACKUP DATABASE pubs TO DISK = @pathToFile WITH INIT , NOUNLOAD , NAME = 'Pubs BackUp', NOSKIP , STATS = 10, NOFORMATGODoes anyone see anything wrong here?Also, is there a way to show the current progress while thisprocedure is run?thanks |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-09-16 : 23:36:46
|
Have a look at Tara's backup procedures here:http://weblogs.sqlteam.com/taradYou can find the progress of a RESTORE by doing this:DECLARE @spid INTSELECT @spid = (SELECT TOP 1 spid FROM sysprocesses WHERE cmd LIKE 'RESTORE%')DBCC OUTPUTBUFFER(@spid) If you have used STATS in your proc, it will tell you what percent you're at. It will also print the percent out so you can look at in in QA, or capture it to an output file if running from a job.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
SQLError
Yak Posting Veteran
63 Posts |
Posted - 2004-09-18 : 14:00:17
|
| Hi, my backup procedure is small compared to tara's.Am I doing something wrong here?Also, when I ran hers, I get a timeout error. Does anyoneknow why?thanks |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-09-19 : 01:34:10
|
| "Am I doing something wrong here?"IIRC Tara's is making a filename containing the date/time, so that each backup file is unique. Also, Tara's is deleting files older than, say, 2 days. And it is backing up every database on the server - you routine will need modification each time you create a new database.Dunno about the timeout ... perhaps it is trying to write to a disk drive that you don;t have? I assume you've changed the stuff that defines the path where backups should be stored?Kristen |
 |
|
|
|
|
|
|
|