Monday 6 May 2013

Checking up on Backup history?

Ever needed to show the history of your backups? Here is the SQL script to do it


SELECT top 10
    database_name,
    recovery_model,
    CASE bs.type
        WHEN 'D' THEN 'FULL'
        WHEN 'I' THEN 'DIFFERENTIAL'
        WHEN 'L' THEN 'TRANSACTION LOG'
        ELSE 'UNKNOWN'
    END AS backup_type,
    backup_start_date,
    backup_finish_date,
    backup_size,
    compressed_backup_size
FROM msdb.dbo.backupset bs
where database_name = 'AX2012'
order by backup_finish_date desc



Thursday 11 April 2013

Database Maintenance Strategies for Dynamics AX - reblog

I just happened to come across these blog posts while perusing my news feed:

http://blogs.msdn.com/b/axinthefield/archive/2012/08/01/database-maintenance-strategies-for-dynamics-ax.aspx

http://www.brentozar.com/archive/2009/02/index-fragmentation-findings-part-1-the-basics/

That reminded me of an article which I found a couple of years back that described index fragmentation in this manner:

"Index fragmentation is a lot like cholesterol. The bad kind, not the good kind. It builds up slowly. Some deletes occur, leaving empty space in a data page here. Inserts occur, but the target page is packed, so a page split occurs so the record can be inserted in the correct order, yet the other page is now mostly empty. Updates are a double whammy. Over time, your index pages continue to be less and less full, meaning you have to perform that many more reads per query.

Just like cholesterol, it’s not perceptible. Sure, if you compared yourself now to 10 years ago, you’d be able to instantly recognize that you feel tired all the time, or occasionally dizzy spells or have blurred vision. Then all of a sudden — HEART ATTACK!"