Is detaching and again Attaching a Database will affect the Replication

  • I need to detach and attach the database being replicated to shrink the database.

    Is it will affect the replication process currently being runnning.

    Secondly If i will backup and restore the database with the same name as replication process going on, will this make any affect on replication.

    Please advise..

    Thanks

  • you don't need to detach\attach the database to shrink it.

    you can backup and restore the database without affecting replication as long as replication is quiesced (stop all the replication agents)

    ---------------------------------------------------------------------

  • You also don't want to shrink it unless some event made it much larger than needed. You should have free space in the file to handle data and index growth (and rebuilding indexes) as file growth can be an expensive operation.

    Shrinking can also cause fragmentation in your tables, so you'd need to rebuild indexes afterwards, which means you'd need 2x the largest index in space.

  • On secure side,I did take backup of DB and restore on another server and found DB shrink to approximately 50%.

    As on actual server where DB resides, Many users are getting timeout from application queries.

    As well as replication is running of that DB.

    Can you please advise me, if i have to backup and restore the DB,, what steps I have to take that will not affect replication.

    Thanks

    Jaswinder Gogia

  • On secure side,I did take backup of DB and restore on another server and found DB shrink to approximately 50%.

    As on actual server where DB resides, Many users are getting timeout from application queries.

    As well as replication is running of that DB.

    Can you please advise me, if i have to backup and restore the DB,, what steps I have to take that will not affect replication.

    Thanks

    Jaswinder Gogia

  • as long as you completely stop replication, you can safely backup db and restore it to a new location (on the same server) if that is what you want to do.

    If you are restoring it to an earlier point in time you will have to reinitialise replication.

    If you are moving to a new server you will gave to remove replication from the otiginal server first, then recreate on the new server, (script it out)

    If you are getting timeouts thats likely to be poor code or perhaps indexes need de-fragmenting or stats updating.

    ---------------------------------------------------------------------

  • Do I have to stop the replication agent for that subscription only where I have to backup and restore the Database.

    Or should I have to stop the whole replication?

  • if it was me i would stop all agents

    ---------------------------------------------------------------------

  • Can you also let me know How I can update stastics

    UPDATE STATISTICS TableName

    Will it enhance the execution of queries.

    Thanks

    Jaswinder

  • Do you also have to stop all the replication agents if you are dropping or adding article to the subscription?

Viewing 10 posts - 1 through 9 (of 9 total)

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