Hi SQLRNNR,
Here are the steps to setup testing environment. Let me know if anything else required.
Thanks again.
* SQL2008r2/SE/SP1; client tool: SQL Server Management Studio (SSMS)
* partner1/principal database: P1 (dev box); db1 (Primary db; Recovery Model=FULL)
* partner2/mirrored database: P2 (DR box); Failover db will be called db1 as well
* No witness server
* as sysadmin, setup dbs: backup/restore P1.db1 to P2.db1 (full/tlog); leave P2.db1 in restoring state;
* as sysadmin, initiate mirroring from P1.db1: use SSMS > P1.db1 properties > mirroring> Configure Security Wizard;
* as sysadmin, create low priv acct on P1 called "mirror_client"; DF db = db1; add "mirror_client" into db1; initially set to R/W - but elevated thru later testing to dbo - you can set to db_owner or ALTER here;
* as sysadmin, create low priv acct on P2 called "mirror_client"; DF db = master; note: P2.db1 database is inaccessible (restoring state); P2.db1 dbo is mapped to sysadmin acct used during earlier restore (verify: see P2.db1 properties);
* note: later tests, as sysadmin, I added acct "mirror_client" to P1.master and to P2.master (both db_owner);
* P1.db should be mirrored to P2.db1; as sysadmin, verify SSMS: P1.db1 (Principal, Syncronized), P2.db1 (mirror, syncronized, restoring ...)
* scenerio: need to run ALTER statement from P2 re: assume P1 box inaccessible due to sharknado
* use SSMS, log on to P2 as "mirror_client";
* as "mirror_client", run following statement:
use master;
ALTER DATABASE db1
SET PARTNER OFF;
go
* note: all tests (see earlier threads) errored from P2 unless "mirror_client" was granted sysadmin
* note: from P1, as "mirror_client", the ALTER statement worked if "mirror_client" set to dbo on P1.DB1
* I even tried wrapping the ALTER statement in SP (master db) and run SP as "mirror_client" (db_owner) but errored; "mirror_client" was able to run SP after being granted sysadmin
here is error message again:
Msg 927, Level 14, State 7, Line 1
Database 'db1' cannot be opened. It is in the middle of a restore
Many thanks. Jeff