Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Fragmentation Expand / Collapse
Author
Message
Posted Tuesday, February 26, 2013 2:44 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, June 11, 2013 7:31 AM
Points: 165, Visits: 463
Performance Slow.. how do i check the fragmentations, i mean which DB/tables to be reindexed







************************************
Every Dog has a Tail !!!!!
Post #1423946
Posted Tuesday, February 26, 2013 2:51 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, March 01, 2013 6:16 AM
Points: 81, Visits: 286
First find fragmentation this query helps you
select a.*,b.AverageFragmentation from 
(
SELECT
tbl.name AS [Table_Name],
tbl.object_id,
i.name AS [Name],
i.index_id,
CAST(CASE i.index_id WHEN 1 THEN 1 ELSE 0 END AS bit) AS [IsClustered],
CAST(case when i.type=3 then 1 else 0 end AS bit) AS [IsXmlIndex],
CAST(case when i.type=4 then 1 else 0 end AS bit) AS [IsSpatialIndex]
FROM
sys.tables AS tbl
INNER JOIN sys.indexes AS i ON (i.index_id > 0 and i.is_hypothetical = 0) AND (i.object_id=tbl.object_id)
)a
inner join
(
SELECT
tbl.object_id,
i.index_id,
fi.avg_fragmentation_in_percent AS [AverageFragmentation]
FROM
sys.tables AS tbl
INNER JOIN sys.indexes AS i ON (i.index_id > 0 and i.is_hypothetical = 0) AND (i.object_id=tbl.object_id)
INNER JOIN sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'LIMITED') AS fi ON fi.object_id=CAST(i.object_id AS int) AND fi.index_id=CAST(i.index_id AS int)
)b
on a.object_id=b.object_id and a.index_id=b.index_id

which ever having more fragmentation do reindex on that table
Post #1423952
Posted Tuesday, February 26, 2013 3:45 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, June 11, 2013 7:31 AM
Points: 165, Visits: 463
Thanks BriPan

One more query.. I am asked to Build a maintenance plan, Can u tell me the sequence in the belwo points

1) Full Backup + Log Backup
2) ReBuild Index
3) Truncate Log
4) Update Stats.. (Weekly)
5) Archieving of data (Weekly)

Please tell the sequence.. also tell any new things to include in this package?????

So that the maintenecae Plan will be upto date & covering everything which is required..








************************************
Every Dog has a Tail !!!!!
Post #1423977
Posted Tuesday, February 26, 2013 4:04 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, March 01, 2013 6:16 AM
Points: 81, Visits: 286
This is ok to me still at the end all depend on ur project requirement and DB requirement,u need to modify as per that only.
Post #1423990
Posted Tuesday, February 26, 2013 4:10 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, June 11, 2013 7:31 AM
Points: 165, Visits: 463
But Truncate Log after rebuild index is valid???


Truncate Query - (backup Log XYZ with truncate_only)

Is this fine or should i execute some other query?? do u have any query?








************************************
Every Dog has a Tail !!!!!
Post #1423992
Posted Tuesday, February 26, 2013 5:08 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:16 AM
Points: 38,123, Visits: 30,407
Don't truncate your log (not that you can in SQL 2008).
Please read through this - Managing Transaction Logs



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 #1424011
Posted Tuesday, February 26, 2013 5:15 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, June 11, 2013 7:31 AM
Points: 165, Visits: 463
Thanks Gail

But On weekly basis the Log gets Full & then application stops running or the DB runs very slow ... how to tackle this now...









************************************
Every Dog has a Tail !!!!!
Post #1424018
Posted Tuesday, February 26, 2013 5:22 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, June 11, 2013 7:31 AM
Points: 165, Visits: 463
Scenario

First Full backup was only taken... no Log backup was there.. hence the Log sie exceeds to maximum... upto 2GB+
And so they use to Truncate log..

Please assist what to do now in order to stream line this process...
i mean to keep the Log size minimum..








************************************
Every Dog has a Tail !!!!!
Post #1424020
Posted Tuesday, February 26, 2013 5:31 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:16 AM
Points: 38,123, Visits: 30,407
runal_jagtap (2/26/2013)
Thanks Gail

But On weekly basis the Log gets Full & then application stops running or the DB runs very slow ... how to tackle this now...


Please assist what to do now in order to stream line this process...
i mean to keep the Log size minimum..


GilaMonster (2/26/2013)
Please read through this - Managing Transaction Logs



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 #1424023
Posted Tuesday, February 26, 2013 5:39 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 6:17 AM
Points: 153, Visits: 1,747
No log backup means
"My data is of no value to the business, it doesn't matter if I lose all changes since the last full backup". If this is true, set database into simple recovery mode.

If, however, losing up to a day's worth of changes is going to cause disruption, make your users very unhappy and potentially lose people their jobs, which is more often the case - then you should backup the logs on a regular basis. If the business can cope ok with losing 15 minutes worth of data for example, backup the logs every 15 minutes. Somewhere Secure. NOT on the same spindles, using the same controller as the ones your data and log files are on.

Then test restoring them to your DR kit regularly


A backup strategy is worthless. A tested and documented *recovery* strategy though ... now you're starting to get somewhere.
Post #1424026
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse