Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)

摘要:
然而,之后又发生了另一个错误。提示如下:System.Data.SqlClient.SqlException:Loginfofailedforuser'dcp_Prod',因为帐户当前已锁定。系统管理员可以解锁。原因是什么?lockedout被锁定,然后使用管理员站起来解锁。字面意思是这样的。按照提示再次打开帐户属性。单击“状态”选项卡,将选中“登录锁定”属性。取消选中,然后单击“确定”返回程序。服务程序将每3秒连接到数据库并执行相应的操作。如果在此过程中尝试更改密码,帐户将被锁定。在管理员工具-˃服务中,关闭程序,更改密码,然后重新打开程序。此错误消失。

今天遇到的问题比较有意思。首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:
Message: System.Data.SqlClient.SqlException: Login failed for user 'dcp_prod'.  Reason: The password of the account has expired.
很明显,这个是因为密码失效了,dcp_prod这个账户使用了密码失效策略,打开数据库查看这个账户的属性,果然,Enforce password policy和Enforce password expiration这两个属性被选中了。

Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)第1张

现在只需要重新设置一下密码就可以了。但是之后又出现了一个错误,提示如下:
System.Data.SqlClient.SqlException: Login failed for user 'dcp_prod' because the account is
currently locked out. The system administrator can unlock it.
这是什么原因呢,locked out是锁住了,然后使用administrator站好去解锁,字面意思是这样的,照着提示区做,再次打开账户属性。

Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)第2张

(这里是回复正常之后的状态,默认是灰色不可用的)

点击Status标签,果然Login is locked out属性被选中,取消选中,点击OK,回到程序中。奇怪了,还是上面的locked out提示,打开属性查看,这个属性又一次被选中了。这样连续来回了好几次都是这样,开始纳闷了。后来在网上查,网上说有其他用户尝试连接数据库,我恍然大悟,是那个service程序在跟我争夺数据库。这个service程序每3秒钟会连接一次数据库,进行相应的操作,在这中间如果尝试修改密码,账户会被锁定的。我Administrator tool->service中关掉程序,修改密码,重新打开程序,这个错误就消失了。

原文链接

PS:如果Sql server账号因为密码输错,尝试过多次登录,也会导致Sql server账号locked out,原文如下:

Login failed for user 'sa' because the account is currently locked out. The system administrator can unlock it. (Microsoft SQL Server, Error: 18486)

SQL server has local password policies. If policy is enabled which locks down the account after X number of failed attempts then the account is automatically locked down.This error with 'sa' account is very common. sa is default administartor login available with SQL server. So there are chances that an ousider has tried to bruteforce your system. (This can cause even if a legitimate tries to access the account with wrong password.Sometimes a user would have changed the password without informing others. So the other users would try to lo)

You can unlock the account with the following options (use another admin account or connect via windows authentication)

1.Alter account & unlock

ALTER LOGIN sa WITH PASSWORD='password' UNLOCK 

2.Use another account

Almost everyone is aware of the sa account. This can be the potential security risk. Even if you provide strong password hackers can lock the account by providing the wrong password. ( You can provide extra security by installing firewall or changing the default port but these measures are not always practical). As a best practice you can disable the sa account and use another account with same privileges.

ALTER LOGIN sa DISABLE 

You can edit the lock-ot options using gpedit.msc( in command prompt type gpedit.msc and press enter). Navigate to Account Lokout policy as shown in the figure(这说明sql server账号会被锁定的最大失败登录次数,是在windows操作系统的组管理策略中设定的)

原文链接

免责声明:文章转载自《Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇UML类图学习总结java使用map去重复下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

1.Oracle10g安装

1.1 下载安装包 我们可以到ORACLE的官方网站去下载它的安装压缩包,不过得详细看相关的软件声明,废话少说,以下就是Oracle10g的链接地址和站点截图http://www.oracle.com/technology/global/cn/software/products/database/oracle10g/index.html     1.2.安...

Sqlserver 使用同义词跨服务器数据库连表查询

  跨服务器,跨数据库查询并不是什么新鲜事,不过之前在工作中看到一段代码,之前也没有接触过数据库同义词,发现挺方便的。代码示例类似这样:   代码很普通,奇怪之处在于A 表在服务器ServerA的DatabaseA中,而B表在服务器ServerB的DatabaseB中。于是我第一反应是linked server,但可以这样写吗?没远程Server 的ip...

关于MSSQL导入导出时主键与约束丢失的问题解决

导入数据时,使用默认选项,会丢失主键、约束、默认值等属性,按如下步骤操作:-->导出向导 -->选择数据源 -->选择目的 -->指定表复制或查询:不要使用默认选项,选择“在SQL Server数据库之间复制对象和数据” -->选择要复制的对象:在本页中根据需要选择相应的开关项,对于列约束,必须选择“扩展属性”,若去掉“复制所...

关于下拉菜单(dropdownlist)一些用法心得

asp.net学习地址 :http://www.cnblogs.com/limshirley/ 1.与数据库绑定 SqlConnection conn= new SqlConnection(ConfigurationSettings.AppSettings["job"]);//数据库连接信息 SqlCommand myCommand = new SqlCo...

Oracle数据库的启动和关闭过程

一、Oracle数据库的完整启动过程是分步骤完成的,包含以下3个步骤 启动实例-->加载数据库-->打开数据库 因为Oracle数据库启动过程中不同的阶段可以对数据库进行不同的维护操作,对应我们不同的需求,所以就需不同的模式启动数据库。 1. Oracle启动需要经历四个状态:SHUTDOWN 、NOMOUNT 、MOUNT 、OPEN 2....

Windows-server-2008-R2安装Oracle-11g-R2-dataguard

一、安装环境 1、服务器环境:Windows server 2008 R2 x64 Standard 两台 CPU:8核 内存:8G 硬盘空间:1060G 2、软件:oracle 11g R2 二、安装前配置 1、IP地址配置要求 主库IP:192.168.2.50 备库IP:192.168.2.51 注:两台主机要保证可以ping通 2、oracle安装...