var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Database 'X' cannot be opened. It is in the middle of a restore while activating SB
I'm working on a SQL Server 2005 mirroring database test.
The idea is to stop main DB server and activate the standby being mirrored (pretendng that principal DB Server is down)
Mirror works fine.
But for the test I do the following:
- Stop the principal SQLSERVER
- Connect to the standby server and execute the followng:
sqlcmd -S <IP> -d master -U opmirror -P xxxxx -Q "ALTER DATABASE DB_NAME SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS;"
And it returns this error:
"Database 'DB_NAME' cannot be opened. It is in the middle of a restore"
What's wrong with it?
Why can't the standby database be opened?
Thaks a lot.
Shouldn't it be set primary, rather than set partner?
Sorry. Looks like you have it correct. Does the opmirror account have a default database set to the mirrored database? Even though the master database is specified in the connection, sqlcmd (or any connection for that matter) will try to open the default database first.
I think the error was displayed because primary DB was not down.
I'll re-check wether it was down or not becuase same error is displayed when you run that command while primary DB is up.
Thanks a lot.