德姆oUser.然后创建客商并mapping到数据库,那么要怎么准确的去除这个Windows认证账号呢

2:删除Windows认证用户前,确认是否有数据库的OWNER为此Windows认证用户。否则删除登录名时会报错


你无法创建一个相同的用户并mapping这个用户到数据库,
并且你无法删除数据库的用户: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::[澳门新葡8455最新网站,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

所以在删除Windows认证用户前,必须检查并修改作业的Owner,避免这种情况出现。

我执行到第2步的时候成功删除复制设置了,脚本如下:

ALTER AUTHORIZATION ON SCHEMA::[db_owner] TO [dbo];

ALTER  DATABASE MYDBNAME SET ONLINE 
USE MASTER 
DECLARE @srv_orig AS sysname = 'MYINSNAME' 
DECLARE @db_orig AS sysname ='MYDBNAME' 
EXEC sp_restoredbreplication @srv_orig,@db_orig 
ALTER DATABASE MYDBNAME SET MULTI_USER;

GO

恢复的数据库此时处于脱机状态

在SQL
Server数据库中,有时候会建立一些Windows认证的账号,例如,我们公司习惯给开发人员和Support同事开通NT账号权限,如果有离职或负责事宜变更的话,那么要如何正确的删除这些Windows认证账号呢?这篇文章就是来探讨一下如何正确的删除Windows认证账号。如下所示:

 

3:有时候删除用户时,报下面错误,必须修改后,才能删除对应的用户。

今天恢复某个数据库时出现如下的错误:

GO

  1. 执行 ALTER DATABASE 以使数据库联机;例如:ALTER DATABASE
    AdventureWorks SET ONLINE。  有关详细信息,请参阅 ALTER DATABASE
    (Transact-SQL)。 如果要保留复制设置,请转到步骤 2。 否则,转到步骤 3。

  2. 执行 sp_restoredbreplication (Transact-SQL)。 
    如果此存储过程成功执行,则还原完成。
    如果此存储过程未成功执行,请转到步骤 3。

  3. 执行 sp_removedbreplication (Transact-SQL) 以删除所有复制设置。 
    如果需要,请重新配置复制。 
    如果您根据建议将复制拓扑编写了脚本,请使用脚本来重新配置该拓扑。

The job failed. The owner (xxxxx) of job syspolicy_purge_history
does not have server access.

联机丛书搜索MSSQL_ENG003165

Msg 15138, Level 16, State 1, Line 3

找到如下解决方案:

USE [UserDatabase];

Msg 208, Level 16, State 1, Procedure sp_MSrestoredbreplication, Line
72
Invalid object name ‘master.dbo.MSreplication_options’.
Msg 3165, Level 16, State 1, Line 1
Database ‘MYDBNAME’ was restored, however an error was encountered while
replication was being restored/removed. The database has been left
offline. See the topic MSSQL_ENG003165 in SQL Server Books Online.
Msg 3167, Level 16, State 1, Line 1
RESTORE could not start database ‘MYDBNAME’.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

登录名 ‘xxxxxx’
拥有一个或多个数据库。在删除该登录名之前,请更改相应数据库的所有者。

sp_changedbowner ‘sa’

必须修改数据库的Owner后,才能删除登录名

相关文章

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图