Database Mirroring works on transaction logs. It applies transaction logs from Principle to Mirror. But Operation like addition of file is no log operation because of that file not be added to Mirror automatically.
Steps to Add Database File on Database involved in DB Mirroring :-
1) Break the Mirroring
ALTER DATABASE USERDB1 SET PARTNER OFF
2) Add New Data or log file, whatever is required
USE [master]
GO
ALTER DATABASE [UserDB1] ADD FILE
( NAME = N’UserDB1_1',
FILENAME = N’H:MSSQL12.INS1MSSQLDATAUserDB1_1.ndf’ ,
SIZE = 3072KB , FILEGROWTH = 1024KB )
TO FILEGROUP [PRIMARY]
3) Take Transaction Log backup at Primary
BACKUP LOG USERDB1 TO DISK = ‘C:USERDB1_LOG.TRN’
4) Restore Step 3 Transactional Backup on Mirror with Move option
RESTORE LOG [USERDB1] FROM
DISK = N’C:USERDB1_LOG.TRN’
WITH Move N’UserDB1_1' TO
N’I:MSSQL12.SQL14I2MSSQLDATAUserDB1.ndf’,
NORECOVERY, NOUNLOAD, STATS = 10
5) Reestablished DB Mirroring again
First on Mirror
ALTER DATABASE USERDB1
SET PARTNER = ‘TCP://SQL2014.RohitGarg.local.in:5022’
View original post 91 more words