Showing posts with label confirm. Show all posts
Showing posts with label confirm. Show all posts

Sunday, March 25, 2012

dbcc shrink log file

Hi:
I just want to confirm that do we need to backup the database after using
dbcc shrinkfile(log, )? I read somewhere that it invalidates the log
sequence, therefore, we will not be able to apply transaction logs to last DB
backup. Is it true about shrinking the log file? If it is, when is the good
time for shrinking the log file. Please let me know. Thanks in advance.
Shrinking the log will not invalidate your log sequence. But shrinking
should only be done under extreme circumstances. If you need to keep
shrinking it that is a clear indication it needs to be larger to begin with
and should stay at that size.
Andrew J. Kelly SQL MVP
"Sal" <Sal@.discussions.microsoft.com> wrote in message
news:464BA510-B21A-4463-9D35-F8327FB8AB84@.microsoft.com...
> Hi:
> I just want to confirm that do we need to backup the database after using
> dbcc shrinkfile(log, )? I read somewhere that it invalidates the log
> sequence, therefore, we will not be able to apply transaction logs to last
> DB
> backup. Is it true about shrinking the log file? If it is, when is the
> good
> time for shrinking the log file. Please let me know. Thanks in advance.
|||No, you do not need to take bakcup after shrinking log file.
Andrew J. Kelly wrote:
[vbcol=seagreen]
> Shrinking the log will not invalidate your log sequence. But shrinking
> should only be done under extreme circumstances. If you need to keep
> shrinking it that is a clear indication it needs to be larger to begin with
> and should stay at that size.
> --
> Andrew J. Kelly SQL MVP
>
> "Sal" <Sal@.discussions.microsoft.com> wrote in message
> news:464BA510-B21A-4463-9D35-F8327FB8AB84@.microsoft.com...
|||Thanks Guys
"amish" wrote:

> No, you do not need to take bakcup after shrinking log file.
> Andrew J. Kelly wrote:
>
>
sql

dbcc shrink log file

Hi:
I just want to confirm that do we need to backup the database after using
dbcc shrinkfile(log, )? I read somewhere that it invalidates the log
sequence, therefore, we will not be able to apply transaction logs to last DB
backup. Is it true about shrinking the log file? If it is, when is the good
time for shrinking the log file. Please let me know. Thanks in advance.Shrinking the log will not invalidate your log sequence. But shrinking
should only be done under extreme circumstances. If you need to keep
shrinking it that is a clear indication it needs to be larger to begin with
and should stay at that size.
--
Andrew J. Kelly SQL MVP
"Sal" <Sal@.discussions.microsoft.com> wrote in message
news:464BA510-B21A-4463-9D35-F8327FB8AB84@.microsoft.com...
> Hi:
> I just want to confirm that do we need to backup the database after using
> dbcc shrinkfile(log, )? I read somewhere that it invalidates the log
> sequence, therefore, we will not be able to apply transaction logs to last
> DB
> backup. Is it true about shrinking the log file? If it is, when is the
> good
> time for shrinking the log file. Please let me know. Thanks in advance.|||No, you do not need to take bakcup after shrinking log file.
Andrew J. Kelly wrote:
> Shrinking the log will not invalidate your log sequence. But shrinking
> should only be done under extreme circumstances. If you need to keep
> shrinking it that is a clear indication it needs to be larger to begin with
> and should stay at that size.
> --
> Andrew J. Kelly SQL MVP
>
> "Sal" <Sal@.discussions.microsoft.com> wrote in message
> news:464BA510-B21A-4463-9D35-F8327FB8AB84@.microsoft.com...
> > Hi:
> >
> > I just want to confirm that do we need to backup the database after using
> > dbcc shrinkfile(log, )? I read somewhere that it invalidates the log
> > sequence, therefore, we will not be able to apply transaction logs to last
> > DB
> > backup. Is it true about shrinking the log file? If it is, when is the
> > good
> > time for shrinking the log file. Please let me know. Thanks in advance.|||Thanks Guys
"amish" wrote:
> No, you do not need to take bakcup after shrinking log file.
> Andrew J. Kelly wrote:
> > Shrinking the log will not invalidate your log sequence. But shrinking
> > should only be done under extreme circumstances. If you need to keep
> > shrinking it that is a clear indication it needs to be larger to begin with
> > and should stay at that size.
> >
> > --
> > Andrew J. Kelly SQL MVP
> >
> >
> > "Sal" <Sal@.discussions.microsoft.com> wrote in message
> > news:464BA510-B21A-4463-9D35-F8327FB8AB84@.microsoft.com...
> > > Hi:
> > >
> > > I just want to confirm that do we need to backup the database after using
> > > dbcc shrinkfile(log, )? I read somewhere that it invalidates the log
> > > sequence, therefore, we will not be able to apply transaction logs to last
> > > DB
> > > backup. Is it true about shrinking the log file? If it is, when is the
> > > good
> > > time for shrinking the log file. Please let me know. Thanks in advance.
>

dbcc shrink log file

Hi:
I just want to confirm that do we need to backup the database after using
dbcc shrinkfile(log, )? I read somewhere that it invalidates the log
sequence, therefore, we will not be able to apply transaction logs to last D
B
backup. Is it true about shrinking the log file? If it is, when is the goo
d
time for shrinking the log file. Please let me know. Thanks in advance.Shrinking the log will not invalidate your log sequence. But shrinking
should only be done under extreme circumstances. If you need to keep
shrinking it that is a clear indication it needs to be larger to begin with
and should stay at that size.
Andrew J. Kelly SQL MVP
"Sal" <Sal@.discussions.microsoft.com> wrote in message
news:464BA510-B21A-4463-9D35-F8327FB8AB84@.microsoft.com...
> Hi:
> I just want to confirm that do we need to backup the database after using
> dbcc shrinkfile(log, )? I read somewhere that it invalidates the log
> sequence, therefore, we will not be able to apply transaction logs to last
> DB
> backup. Is it true about shrinking the log file? If it is, when is the
> good
> time for shrinking the log file. Please let me know. Thanks in advance.|||No, you do not need to take bakcup after shrinking log file.
Andrew J. Kelly wrote:
[vbcol=seagreen]
> Shrinking the log will not invalidate your log sequence. But shrinking
> should only be done under extreme circumstances. If you need to keep
> shrinking it that is a clear indication it needs to be larger to begin wit
h
> and should stay at that size.
> --
> Andrew J. Kelly SQL MVP
>
> "Sal" <Sal@.discussions.microsoft.com> wrote in message
> news:464BA510-B21A-4463-9D35-F8327FB8AB84@.microsoft.com...|||Thanks Guys
"amish" wrote:

> No, you do not need to take bakcup after shrinking log file.
> Andrew J. Kelly wrote:
>
>

Saturday, February 25, 2012

DBCC DBREINDEX

Can anyone confirm this for me. If I were to run this script below. Will it
reindex all tables indexes at one time as it goes through the cursor. Or
will it reindex one table indexes at a time as it goes through the cursor.
Basically will it pause each time the DBCC command is executed?
If the first part is true where it executes all at once then what is a good
way to only do one at a time? Can you pause between executions till each
execution is done?
THanks for the help.
DECLARE @.TableName varchar(255)
DECLARE ReindexTableCursor CURSOR FOR
SELECT name FROM sysobjects WHERE xtype = 'U' AND (name = 'Practice' OR name
= 'ID_Master')
ORDER BY name
OPEN ReindexTableCursor
-- Perform the first fetch.
FETCH NEXT FROM ReindexTableCursor INTO @.TableName
-- Check @.@.FETCH_STATUS to see if there are any rows to fetch.
WHILE @.@.FETCH_STATUS = 0
BEGIN
-- This is executed as long as the previous fetch succeeds.
PRINT 'Reindexing' + ' ' + @.TableName
DBCC DBREINDEX (@.TableName )
FETCH NEXT FROM ReindexTableCursor into @.TableName
END
CLOSE ReindexTableCursor
DEALLOCATE ReindexTableCursor
See the reply in the other newsgroup.
Andrew J. Kelly SQL MVP
"Dave Mortenson" <dmortenson@.dentrix.com> wrote in message
news:enpAF$obEHA.1356@.TK2MSFTNGP09.phx.gbl...
> Can anyone confirm this for me. If I were to run this script below. Will
it
> reindex all tables indexes at one time as it goes through the cursor. Or
> will it reindex one table indexes at a time as it goes through the cursor.
> Basically will it pause each time the DBCC command is executed?
> If the first part is true where it executes all at once then what is a
good
> way to only do one at a time? Can you pause between executions till each
> execution is done?
> THanks for the help.
> DECLARE @.TableName varchar(255)
> DECLARE ReindexTableCursor CURSOR FOR
> SELECT name FROM sysobjects WHERE xtype = 'U' AND (name = 'Practice' OR
name
> = 'ID_Master')
> ORDER BY name
> OPEN ReindexTableCursor
> -- Perform the first fetch.
> FETCH NEXT FROM ReindexTableCursor INTO @.TableName
> -- Check @.@.FETCH_STATUS to see if there are any rows to fetch.
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> -- This is executed as long as the previous fetch succeeds.
> PRINT 'Reindexing' + ' ' + @.TableName
> DBCC DBREINDEX (@.TableName )
> FETCH NEXT FROM ReindexTableCursor into @.TableName
> END
> CLOSE ReindexTableCursor
> DEALLOCATE ReindexTableCursor
>

DBCC DBREINDEX

Can anyone confirm this for me. If I were to run this script below. Will it
reindex all tables indexes at one time as it goes through the cursor. Or
will it reindex one table indexes at a time as it goes through the cursor.
Basically will it pause each time the DBCC command is executed?
If the first part is true where it executes all at once then what is a good
way to only do one at a time? Can you pause between executions till each
execution is done?
THanks for the help.
DECLARE @.TableName varchar(255)
DECLARE ReindexTableCursor CURSOR FOR
SELECT name FROM sysobjects WHERE xtype = 'U' AND (name = 'Practice' OR name
= 'ID_Master')
ORDER BY name
OPEN ReindexTableCursor
-- Perform the first fetch.
FETCH NEXT FROM ReindexTableCursor INTO @.TableName
-- Check @.@.FETCH_STATUS to see if there are any rows to fetch.
WHILE @.@.FETCH_STATUS = 0
BEGIN
-- This is executed as long as the previous fetch succeeds.
PRINT 'Reindexing' + ' ' + @.TableName
DBCC DBREINDEX (@.TableName )
FETCH NEXT FROM ReindexTableCursor into @.TableName
END
CLOSE ReindexTableCursor
DEALLOCATE ReindexTableCursorSee the reply in the other newsgroup.
--
Andrew J. Kelly SQL MVP
"Dave Mortenson" <dmortenson@.dentrix.com> wrote in message
news:enpAF$obEHA.1356@.TK2MSFTNGP09.phx.gbl...
> Can anyone confirm this for me. If I were to run this script below. Will
it
> reindex all tables indexes at one time as it goes through the cursor. Or
> will it reindex one table indexes at a time as it goes through the cursor.
> Basically will it pause each time the DBCC command is executed?
> If the first part is true where it executes all at once then what is a
good
> way to only do one at a time? Can you pause between executions till each
> execution is done?
> THanks for the help.
> DECLARE @.TableName varchar(255)
> DECLARE ReindexTableCursor CURSOR FOR
> SELECT name FROM sysobjects WHERE xtype = 'U' AND (name = 'Practice' OR
name
> = 'ID_Master')
> ORDER BY name
> OPEN ReindexTableCursor
> -- Perform the first fetch.
> FETCH NEXT FROM ReindexTableCursor INTO @.TableName
> -- Check @.@.FETCH_STATUS to see if there are any rows to fetch.
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> -- This is executed as long as the previous fetch succeeds.
> PRINT 'Reindexing' + ' ' + @.TableName
> DBCC DBREINDEX (@.TableName )
> FETCH NEXT FROM ReindexTableCursor into @.TableName
> END
> CLOSE ReindexTableCursor
> DEALLOCATE ReindexTableCursor
>

DBCC DBREINDEX

Can anyone confirm this for me. If I were to run this script below. Will it
reindex all tables indexes at one time as it goes through the cursor. Or
will it reindex one table indexes at a time as it goes through the cursor.
Basically will it pause each time the DBCC command is executed?
If the first part is true where it executes all at once then what is a good
way to only do one at a time? Can you pause between executions till each
execution is done?
THanks for the help.
DECLARE @.TableName varchar(255)
DECLARE ReindexTableCursor CURSOR FOR
SELECT name FROM sysobjects WHERE xtype = 'U' AND (name = 'Practice' OR name
= 'ID_Master')
ORDER BY name
OPEN ReindexTableCursor
-- Perform the first fetch.
FETCH NEXT FROM ReindexTableCursor INTO @.TableName
-- Check @.@.FETCH_STATUS to see if there are any rows to fetch.
WHILE @.@.FETCH_STATUS = 0
BEGIN
-- This is executed as long as the previous fetch succeeds.
PRINT 'Reindexing' + ' ' + @.TableName
DBCC DBREINDEX (@.TableName )
FETCH NEXT FROM ReindexTableCursor into @.TableName
END
CLOSE ReindexTableCursor
DEALLOCATE ReindexTableCursorSee the reply in the other newsgroup.
Andrew J. Kelly SQL MVP
"Dave Mortenson" <dmortenson@.dentrix.com> wrote in message
news:enpAF$obEHA.1356@.TK2MSFTNGP09.phx.gbl...
> Can anyone confirm this for me. If I were to run this script below. Will
it
> reindex all tables indexes at one time as it goes through the cursor. Or
> will it reindex one table indexes at a time as it goes through the cursor.
> Basically will it pause each time the DBCC command is executed?
> If the first part is true where it executes all at once then what is a
good
> way to only do one at a time? Can you pause between executions till each
> execution is done?
> THanks for the help.
> DECLARE @.TableName varchar(255)
> DECLARE ReindexTableCursor CURSOR FOR
> SELECT name FROM sysobjects WHERE xtype = 'U' AND (name = 'Practice' OR
name
> = 'ID_Master')
> ORDER BY name
> OPEN ReindexTableCursor
> -- Perform the first fetch.
> FETCH NEXT FROM ReindexTableCursor INTO @.TableName
> -- Check @.@.FETCH_STATUS to see if there are any rows to fetch.
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> -- This is executed as long as the previous fetch succeeds.
> PRINT 'Reindexing' + ' ' + @.TableName
> DBCC DBREINDEX (@.TableName )
> FETCH NEXT FROM ReindexTableCursor into @.TableName
> END
> CLOSE ReindexTableCursor
> DEALLOCATE ReindexTableCursor
>