for my full model recovery type databases i plan to do a full backup daily, and every hour a transaction log backup, using the code below scheduled as a job and the code further below is the stored procedure.
currently, using CCCInternet as an example, the size of the data file is 370mb and the size of the transaction log file is 673mb.
the size of the transaction log backups are only 350kb or so (which is good ?)
my questions are
a) is the code below (job and SP) good to use ? i presume backup log is backing up the transaction log ?
b) do i need to perform transaction logs at all for my simple databases ? the code below doesn't work for simple databases ?
c)does the size of the database file and trans log file seem reasonable ? or do i need to maybe shrink the trans log file ?
d) is there any other housekeeping routines i can do, apart from a full backup and trans log backup e.g. with the DB maint Plan you can do an optimization/integrity check ?
thanks very much
tony
currently, using CCCInternet as an example, the size of the data file is 370mb and the size of the transaction log file is 673mb.
the size of the transaction log backups are only 350kb or so (which is good ?)
my questions are
a) is the code below (job and SP) good to use ? i presume backup log is backing up the transaction log ?
b) do i need to perform transaction logs at all for my simple databases ? the code below doesn't work for simple databases ?
c)does the size of the database file and trans log file seem reasonable ? or do i need to maybe shrink the trans log file ?
d) is there any other housekeeping routines i can do, apart from a full backup and trans log backup e.g. with the DB maint Plan you can do an optimization/integrity check ?
thanks very much
tony
Code:
EXEC sp_MSforeachdb
'IF N''?'' IN(''CCCInternet'',''CCCIntranet'')
BEGIN
exec usp_BackupLog ''?''
END'
Code:
CREATE procedure usp_BackupLog
@DatabaseName varchar(100)
as
declare @date varchar(10)
declare @time varchar(10)
declare @BackupPath varchar(255)
declare @BackupFile varchar(300)
set @BackupPath = '\\servername\sharename\Log\'
set @date = convert(varchar(10), getdate(), 112)
set @time = replace(convert(varchar(10), getdate(), 108), ':', '')
set @BackupFile = @BackupPath + @DatabaseName + '_' + @date + '_' + @time + '.trn'
backup Log @DatabaseName to disk=@BackupFile
GO