November 17, 2008 at 1:42 pm
I changed the code master.dbo.sysdatabases to sys.databases.
But still have the same problem.msdb is backing up when I ran the job manually,but not when I scheduled it to run midnight.
November 17, 2008 at 1:45 pm
msdb is there in system databases and Iam able to take the backup of it.
backup database msdb to disk='Z:\Backups\msdb.bak'
November 17, 2008 at 1:58 pm
Looks like you are trying to backup to a mapped drive. That may be the problem. Can you change the destination of the backup file to use a UNC instead?
November 17, 2008 at 7:52 pm
It is not a mapped drive!
November 17, 2008 at 8:45 pm
Mani
There have been a couple of good suggestions posted on possible causes of your problem. However, I think it is a problem in the code and needs to be worked as a debugging issue instead of a configuration issue.
To my earlier post, are you more comfortable tracing for the problem or editing the code with print statements? Based on your response I will recommend the next steps for trying to solve this problem.
David
November 18, 2008 at 5:36 am
Since you are only backing up the three system database try to eliminate the select/loop and just specify the database names.
Create procedure [dbo].[Backup]
As
Begin
DECLARE @name VARCHAR(100) -- database name
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name
SET @path = 'E:\Backup\'
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
-- Backup Master
SET @fileName = @path + 'master' + '_' + @fileDate + '.BAK'
BACKUP DATABASE @name TO DISK = @fileName
-- Backup model
SET @fileName = @path + 'model' + '_' + @fileDate + '.BAK'
BACKUP DATABASE @name TO DISK = @fileName
--Backup msdb
SET @fileName = @path + 'msdb' + '_' + @fileDate + '.BAK'
BACKUP DATABASE @name TO DISK = @fileName
END
November 19, 2008 at 12:32 pm
Thank You All..
I have created a mantenance plan instead of the backup script. Now the msdb is backing up...
Viewing 7 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply