当恢复sqlserver bak文件时,原始的用户无法删除的解决方法
程序员文章站
2023-12-16 18:03:40
你无法创建一个相同的用户并mapping这个用户到数据库, 并且你无法删除数据库的用户:demouser. 请运行以下脚本, 之后你就可以删除用户:demouser.然后创...
你无法创建一个相同的用户并mapping这个用户到数据库, 并且你无法删除数据库的用户:demouser.
请运行以下脚本, 之后你就可以删除用户:demouser.然后创建用户(demouser.)并mapping到数据库。
脚本:
go
alter authorization on role::[aspnet_membership_basicaccess] to [dbo]
go
go
alter authorization on role::[aspnet_membership_fullaccess] to [dbo]
go
go
alter authorization on role::[aspnet_membership_reportingaccess] to [dbo]
go
go
alter authorization on role::[aspnet_profile_basicaccess] to [dbo]
go
go
alter authorization on role::[aspnet_profile_fullaccess] to [dbo]
go
go
alter authorization on role::[aspnet_profile_reportingaccess] to [dbo]
go
go
alter authorization on role::[aspnet_roles_basicaccess] to [dbo]
go
go
alter authorization on role::[aspnet_roles_fullaccess] to [dbo]
go
go
alter authorization on role::[aspnet_roles_reportingaccess] to [dbo]
go
go
alter authorization on schema::[db_owner] to [dbo]
go
go
alter authorization on schema::[db_owner] to [db_owner]
go
请运行以下脚本, 之后你就可以删除用户:demouser.然后创建用户(demouser.)并mapping到数据库。
脚本:
复制代码 代码如下:
go
alter authorization on role::[aspnet_membership_basicaccess] to [dbo]
go
go
alter authorization on role::[aspnet_membership_fullaccess] to [dbo]
go
go
alter authorization on role::[aspnet_membership_reportingaccess] to [dbo]
go
go
alter authorization on role::[aspnet_profile_basicaccess] to [dbo]
go
go
alter authorization on role::[aspnet_profile_fullaccess] to [dbo]
go
go
alter authorization on role::[aspnet_profile_reportingaccess] to [dbo]
go
go
alter authorization on role::[aspnet_roles_basicaccess] to [dbo]
go
go
alter authorization on role::[aspnet_roles_fullaccess] to [dbo]
go
go
alter authorization on role::[aspnet_roles_reportingaccess] to [dbo]
go
go
alter authorization on schema::[db_owner] to [dbo]
go
go
alter authorization on schema::[db_owner] to [db_owner]
go