If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Database 'X' cannot be opened. It is in the middle of a restore while activating SB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-12, 11:21
djuritz djuritz is offline
Registered User
 
Join Date: Sep 2005
Posts: 67
Database 'X' cannot be opened. It is in the middle of a restore while activating SB

Hi all,

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.
Reply With Quote
  #2 (permalink)  
Old 02-07-12, 11:56
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,899
Shouldn't it be set primary, rather than set partner?
Reply With Quote
  #3 (permalink)  
Old 02-07-12, 11:58
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,899
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.
Reply With Quote
  #4 (permalink)  
Old 02-07-12, 12:54
djuritz djuritz is offline
Registered User
 
Join Date: Sep 2005
Posts: 67
Hi,

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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On