SOLVED Event ID 14421 cannot attach a database that was being restored
Had a tough time when I accidentally detached the secondary database which was in standby mode with log shipping enabled from the primary database.
I was lucky that although my secondary database server was offsite, my database was just around 900 MB. Here's what helped:
On the primary database server
- Take a full backup of the database
- compress it (My compressed database was around 170 MB)
- Copy over the backup to the secondary database server.
On the secondary database server
- decompress the backup database
- Delete/move the the physical database file
- create a new database with the same name as was earlier
- Restore the database from the backup you just moved
Once the restore is completed, the database will start replaying the logs. After the process is completed, you should see the database back to standby / read-only state.