Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Posts
    67

    Unanswered: 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.

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Shouldn't it be set primary, rather than set partner?

  3. #3
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    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.

  4. #4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •