|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
BACKUP DATABASEDECLARE @Name varchar(50)
DECLARE @Disk varchar(255) SET @Name='Databasename' SET @Disk = 'Drive:\path\' + @Name +'.bak' BACKUP DATABASE @Name to DISK = @Disk BACKUP LOG @Name WITH NO_LOG DBCC SHRINKDATABASE (@Name, TRUNCATEONLY) I plan to run this sort of logic on a weekly schedule. Does truncating the log pose any problems? If so, how do I manage the log size. Wes
http://www.karaszi.com/sqlserver/info_dont_shrink.asp Show quote "Wes" <W**@discussions.microsoft.com> wrote in message news:374F9E8B-2BF5-46E1-BDD5-6AFA580F8849@microsoft.com... > DECLARE @Name varchar(50) > DECLARE @Disk varchar(255) > > SET @Name='Databasename' > SET @Disk = 'Drive:\path\' + @Name +'.bak' > > BACKUP DATABASE @Name to DISK = @Disk > BACKUP LOG @Name > WITH > NO_LOG > DBCC SHRINKDATABASE (@Name, TRUNCATEONLY) > > I plan to run this sort of logic on a weekly schedule. Does truncating > the > log pose any problems? If so, how do I manage the log size. > In addition to the link Uri posted you almost never want to do a truncate on
the log as it makes the log useless for a restore. Either backup the log on a regular basis or set the recovery mode to simple. -- Show quoteAndrew J. Kelly SQL MVP "Wes" <W**@discussions.microsoft.com> wrote in message news:374F9E8B-2BF5-46E1-BDD5-6AFA580F8849@microsoft.com... > DECLARE @Name varchar(50) > DECLARE @Disk varchar(255) > > SET @Name='Databasename' > SET @Disk = 'Drive:\path\' + @Name +'.bak' > > BACKUP DATABASE @Name to DISK = @Disk > BACKUP LOG @Name > WITH > NO_LOG > DBCC SHRINKDATABASE (@Name, TRUNCATEONLY) > > I plan to run this sort of logic on a weekly schedule. Does truncating > the > log pose any problems? If so, how do I manage the log size. > |
|||||||||||||||||||||||