Always On and Shrinking a file

  • Hi all,

    We have a database which is just bigger than 1TB, its part of an AG and all is fine.

    Except 60% of the database is allocated space and we want to reclaim the space to make things easier for us (its a pain copying massive backups between data centres amongst other things). Its never going to need this 60% again, we looked into that. So the space is fine to reclaim.

    On a standalone database this would be straight forward;

    1. Shrink the database file

    2. Check for index fragmentation and sort it out.

    However if I do this on the primary what's going to happen will it;

    a. Shrink the file on just the primary instance

    b. Shrink the file on primary and also on the secondary as well as it will send the changes over AlwaysOn

    c. Something else.

    Any assistance would be gratefully received as I've never shrunk a database which is in an AG before.

    Thanks,

    Nic

  • Hi

    Always on is technology, which is combination of both mirroring and clustering. We will shrink the database on which mirroring is configured. Here in Always on also we can shrink the database to release the unused space on primary replica. It will reflect in secondary replica also.

    Thanks

    Jagadish.

    Please correct me if I'm wrong.

  • Hi,

    That's as I thought, shrink the primary and the secondary will shrink, I'll try it out in a very small size reduction and see.

    Thanks for your reply.

    Nic

  • Seems to be working as planned and the secondary is shrinking automatically.

  • Just did it on our production systems. A rouge process blew up the log file on a database. We shrunk the primary, and the secondaries also shrunk.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply