I am trying to restore a database on DR server, after my restore, i cannot
use the ID to login to the application. 3 observations:
1) I am using scripts, so all my commands are in SQL statements. Here is my
script for restoring the database:
Alter database FRR_SGMAS set single_user with rollback immediate
go
restore database FRR_SGMAS from DISK='F:\program files\microsoft sql
server\mssql\backup\frrsgmas_b.dmp'
WITH MOVE 'FRR_SGMAS_Data' TO 'F:\Program Files\Microsoft SQL
Server\MSSQL\data\FRR_SGMAS_Data.mdf',
MOVE 'FRR_SGMAS_Log' TO 'F:\Program Files\Microsoft SQL
Server\MSSQL\data\FRR_SGMAS_Log.ldf',
FILE = 1
go
Alter database FRR_SGMAS set multi_user
go
2) At the security of DR server level, the ID was not granted the rights to
access the database. I need to re-grant the rights.
3) The ID need db_owner rights, I notice if i have 2 IDs, it is impossible
to grant 2 IDs with db_owner rights by script.
As a result, I cannot login to this application, since the ID does not have
DB_owner access. The application require the ID to have db_owner access.
How can i grant the rights by running SQL script? As I mentioned before, i
have 2 ID that needs to have db_owner rights.
I have tried to drop user and login, and add user and login. However, i am
still not sure how can i add dbowner roles to the ID. I tried
sp_changedbowner, however, i cannot do it to another user.
Thanks for the help in advance.Have you tried using sp_change_users_login? Please see BOL for details of
this command.
"Sam" wrote:
> I am trying to restore a database on DR server, after my restore, i cannot
> use the ID to login to the application. 3 observations:
> 1) I am using scripts, so all my commands are in SQL statements. Here is
my
> script for restoring the database:
> Alter database FRR_SGMAS set single_user with rollback immediate
> go
> restore database FRR_SGMAS from DISK='F:\program files\microsoft sql
> server\mssql\backup\frrsgmas_b.dmp'
> WITH MOVE 'FRR_SGMAS_Data' TO 'F:\Program Files\Microsoft SQL
> Server\MSSQL\data\FRR_SGMAS_Data.mdf',
> MOVE 'FRR_SGMAS_Log' TO 'F:\Program Files\Microsoft SQL
> Server\MSSQL\data\FRR_SGMAS_Log.ldf',
> FILE = 1
> go
> Alter database FRR_SGMAS set multi_user
> go
> 2) At the security of DR server level, the ID was not granted the rights t
o
> access the database. I need to re-grant the rights.
> 3) The ID need db_owner rights, I notice if i have 2 IDs, it is impossible
> to grant 2 IDs with db_owner rights by script.
> As a result, I cannot login to this application, since the ID does not hav
e
> DB_owner access. The application require the ID to have db_owner access.
> How can i grant the rights by running SQL script? As I mentioned before,
i
> have 2 ID that needs to have db_owner rights.
> I have tried to drop user and login, and add user and login. However, i a
m
> still not sure how can i add dbowner roles to the ID. I tried
> sp_changedbowner, however, i cannot do it to another user.
> Thanks for the help in advance.sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment