Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 High Availability
»
Index !!!!
19 posts, Page 1 of 2
1
2
»»
Index !!!!
Rate Topic
Display Mode
Topic Options
Author
Message
OnlyOneRJ
OnlyOneRJ
Posted Tuesday, September 25, 2012 4:03 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Thursday, May 09, 2013 9:02 AM
Points: 158,
Visits: 443
Now Daily at morning 6:00 am the server (Database) does not have any transactions.. i mean its on IDLE state as there are no one to work with it.. and the people comes at 9:00am for work ..
So before the team vcomes to work with it, My plan is to
1) First Rebuild/Reorganise Index.. Query - alter index all on tablename rebuild
2) Execute a Stored procedure
USE [DBNAME]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROC [dbo].[pr_truncateLog]
AS BEGIN
DECLARE @DBName sysname,
@logName sysname
-- Obtener nombre de base de datos
SET @DBName = DB_NAME()
BACKUP LOG @DBName WITH NO_LOG
-- Obtener lista de archivos LOG
DECLARE logCursor CURSOR FOR
SELECT name
FROM sysfiles
WHERE groupid = 0
-- Para cada archivo LOG, ejecutar DBCC SHRINKFILE
OPEN logCursor
FETCH NEXT FROM logCursor
INTO @logName
WHILE @@FETCH_STATUS = 0 BEGIN
SELECT @logName = RTRIM(@logName)
DBCC SHRINKFILE (@logName)
FETCH NEXT FROM logCursor
INTO @logName
END
CLOSE logCursor
DEALLOCATE logCursor
END
3) Run EXEC sp_updatestats
4) Server Restart
Now is this correct or can anyone help me in step by step execution??????
************************************
Every Dog has a Tail !!!!!
Post #1363904
GilaMonster
GilaMonster
Posted Tuesday, September 25, 2012 4:15 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:56 AM
Points: 37,734,
Visits: 30,003
Ow, ow, ow, ow...
First you want to rebuild the indexes, then you want to break the log chain (no more point in time recovery), shrink the log file, ensuring that there will be slow downs and log fragmentation from the growths and restart the server ensuring that it'll be slow when the users start using it.
Well, to be honest I could think of worse things to do, but it might take work.
For the log, please read through this -
Managing Transaction Logs
Why not to shrink a DB, see -
http://sqlinthewild.co.za/index.php/2007/09/08/shrinking-databases/
, much the same goes for the log
Why restart daily? Some servers I work with haven't been restarted in months and there's seldom a need to restart SQL regularly, doing so means more work for the DB engine to repopulate all its caches.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #1363910
OnlyOneRJ
OnlyOneRJ
Posted Tuesday, September 25, 2012 4:26 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Thursday, May 09, 2013 9:02 AM
Points: 158,
Visits: 443
Gila :-(
Can you write the steps here with example or query??? i am not able to understand it ckear as i am new in DB activites
************************************
Every Dog has a Tail !!!!!
Post #1363919
GilaMonster
GilaMonster
Posted Tuesday, September 25, 2012 4:34 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:56 AM
Points: 37,734,
Visits: 30,003
No I can't, because what you're suggesting is incredibly harmful.
Read the article and blog post that I referenced. Especially read the article.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #1363922
vyas
vyas
Posted Tuesday, September 25, 2012 4:40 AM
Hall of Fame
Group: General Forum Members
Last Login: Thursday, May 16, 2013 4:02 AM
Points: 3,131,
Visits: 1,056
Why do u want to perform all the stuff at a shot??? How big your databases?
Plan accrodingly to the size of the databases.
Post #1363929
OnlyOneRJ
OnlyOneRJ
Posted Tuesday, September 25, 2012 4:42 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Thursday, May 09, 2013 9:02 AM
Points: 158,
Visits: 443
I want to perform this just as a Good Prectise..
There are 20 Databases almost 10 GB each.. thats it ;)
************************************
Every Dog has a Tail !!!!!
Post #1363930
anthony.green
anthony.green
Posted Tuesday, September 25, 2012 4:55 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
Good practise, 2 of the points are BAD practise
Rebuild/Reorg indexes - Do this yes
Shrinking the files - Bad idea
sp_updatestats - This is partily done in the Rebuild/Reorg
Restarting the server - Bad idea, as Gail already mentions you flush all the cache data out and SQL will perform badly until the cache's have been rebuilt.
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1363941
GilaMonster
GilaMonster
Posted Tuesday, September 25, 2012 5:02 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:56 AM
Points: 37,734,
Visits: 30,003
runal_jagtap (9/25/2012)
I want to perform this just as a Good Prectise..
But it's not good practice. Other than the index rebuild and maybe the stats update, the rest of the steps can be downright harmful and should not be done, much less on a regular basis.
Please, please, please, go and read the article I linked.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #1363944
OnlyOneRJ
OnlyOneRJ
Posted Tuesday, September 25, 2012 5:03 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Thursday, May 09, 2013 9:02 AM
Points: 158,
Visits: 443
That Means the points mentioned 1, 2 & 3 should be done only???
************************************
Every Dog has a Tail !!!!!
Post #1363945
anthony.green
anthony.green
Posted Tuesday, September 25, 2012 5:04 AM
SSCertifiable
Group: General Forum Members
Last Login: Friday, April 12, 2013 3:51 AM
Points: 5,075,
Visits: 4,831
No, only points 1 and 3
Index and statistic maintenance should be done
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1363946
« Prev Topic
|
Next Topic »
19 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.