Re-Add DB to a AG - complains about space on secondary

Dear all,

I removed a DB from an AG a few days ago to shrink the logs. When I try to add again, I get this error:

The share in the secondary has plenty of space, several times the space of the DB and the logs.

I did this operation a few months ago, which went very well.

If I ignore the warning and proceed, the DB stays in the secondary "Not Synchronizing / Recovery Pending".

Any idea or suggestion to fix this problem and add the DB?

Many thanks in advance.

First thing - you don't need to remove a database from the AG to shrink the log files unless you have allowed the system to fill the log drive and have actually run completely out of space on either the primary or the secondary.

To shrink the log files - after an unexpected large transaction for example - just issue DBCC SHRINKFILE(logical name or number, size). Following that, perform a transaction log backup - and repeat until the log file has been shrunk to the size needed.

Second - if SQL Server is reporting that you don't have enough space on the secondary, then there isn't enough space on the secondary. If the database you are trying to add still exists on the secondary - or the files still exist - then you won't be able to add the database.

You need to login to the secondary and verify the actual location(s) for the data and log files. Looking at a 'share' isn't the same since database files are not stored on file shares.