Home All Groups Group Topic Archive Search About
Author
12 Jan 2006 2:02 PM
Wes
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.

Author
12 Jan 2006 2:04 PM
Uri Dimant
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.
>
Author
12 Jan 2006 2:41 PM
Andrew J. Kelly
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.

--
Andrew J. Kelly  SQL MVP


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.
>

AddThis Social Bookmark Button