sqlserver数据库出错的解决方法
1.SQLServer2008数据库sa账户登录127.0.0.1失败
http://blog.sina.com.cn/s/blog_546a30270102weh2.html
2.SqlServer配置管理器中的sql服务 远程过程调用失败
3.无法通过windows authentication进行登录
http://www.cnblogs.com/zerocc/p/3425431.html
通过命令行来启动数据库的话,
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn>sqlservr.exe
2017-06-07 11:16:15.12 Server Microsoft SQL Server 2012 (SP1) - 11.0.3156.0 (X64)
May 4 2015 18:48:09
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )
2017-06-07 11:16:15.12 Server (c) Microsoft Corporation.
2017-06-07 11:16:15.12 Server All rights reserved.
2017-06-07 11:16:15.12 Server Server process ID is 21236.
2017-06-07 11:16:15.12 Server System Manufacturer: 'Dell Inc.', System Model: 'Latitude E5470'.
2017-06-07 11:16:15.12 Server Authentication mode is MIXED.
2017-06-07 11:16:15.12 Server Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log\ERRORLOG'.
2017-06-07 11:16:15.13 Server The service account is 'ASNET\clu'. This is an informational message; no user action is required.
2017-06-07 11:16:15.13 Server Registry startup parameters:
-d C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\master.mdf
-e C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log\ERRORLOG
-l C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
2017-06-07 11:16:15.29 Server SQL Server detected 1 sockets with 4 cores per socket and 8 logical processors per socket, 8 total logical processors; using 8 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2017-06-07 11:16:15.29 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2017-06-07 11:16:15.29 Server Detected 16266 MB of RAM. This is an informational message; no user action is required.
2017-06-07 11:16:15.31 Server Using conventional memory in the memory manager.
2017-06-07 11:16:15.41 Server This instance of SQL Server last reported using a process ID of 27204 at 2017/6/7 11:14:29 (local) 2017/6/7 3:14:29 (UTC). This is an informational message only; no user action is required.
2017-06-07 11:16:15.41 Server Node configuration: node 0: CPU mask: 0x00000000000000ff:0 Active CPU mask: 0x00000000000000ff:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2017-06-07 11:16:15.42 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2017-06-07 11:16:15.44 Server Software Usage Metrics is disabled.
2017-06-07 11:16:15.44 spid4s Starting up database 'master'.
2017-06-07 11:16:15.53 Server CLR version v4.0.30319 loaded.
2017-06-07 11:16:15.56 Server Common language runtime (CLR) functionality initialized using CLR version v4.0.30319 from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\.
2017-06-07 11:16:15.69 spid4s Resource governor reconfiguration succeeded.
2017-06-07 11:16:15.69 spid4s SQL Server Audit is starting the audits. This is an informational message. No user action is required.
2017-06-07 11:16:15.70 spid4s SQL Server Audit has started the audits. This is an informational message. No user action is required.
2017-06-07 11:16:15.75 spid4s SQL Trace ID 1 was started by login "sa".
2017-06-07 11:16:15.75 spid4s Server name is 'WASYGSHA01-1020'. This is an informational message only. No user action is required.
2017-06-07 11:16:15.77 spid4s Failed to verify Authenticode signature on DLL 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\ftimport.dll'.
2017-06-07 11:16:15.78 spid16s Starting up database 'msdb'.
2017-06-07 11:16:15.78 spid17s Starting up database 'LISA5_RPS'.
2017-06-07 11:16:15.78 spid18s Starting up database 'LISA5_PRG_Rewind'.
2017-06-07 11:16:15.78 spid20s Starting up database 'LISA5_CMS_Rewind'.
2017-06-07 11:16:15.78 spid9s Starting up database 'mssqlsystemresource'.
2017-06-07 11:16:15.78 spid19s Starting up database 'Installer_Repository5'.
2017-06-07 11:16:15.78 spid22s Starting up database 'Installer_CMS_Master5'.
2017-06-07 11:16:15.78 spid21s Starting up database 'Installer_Program_Master5'.
2017-06-07 11:16:15.78 spid23s Starting up database 'd_lisa_Program_RDC1F47A8FA04CD9272'.
2017-06-07 11:16:15.80 spid13s A self-generated certificate was successfully loaded for encryption.
2017-06-07 11:16:15.80 spid24s Starting up database 'd_lisa_CMS_RDC1F47A8FA04CD9272'.
2017-06-07 11:16:15.80 spid25s Starting up database 'TW_LS_RPS'.
2017-06-07 11:16:15.80 spid26s Starting up database 'TW_LS_PRG_DHL4_Base'.
2017-06-07 11:16:15.85 spid27s Starting up database 'TW_LS_CMS_DHL4'.
2017-06-07 11:16:15.85 spid13s Server is listening on [ 'any' <ipv6> 1433].
2017-06-07 11:16:15.86 spid28s Starting up database 'TW_LS_PRG_DHL4'.
2017-06-07 11:16:15.87 spid13s Server is listening on [ 'any' <ipv4> 1433].
2017-06-07 11:16:15.87 spid9s The resource database build version is 11.00.3000. This is an informational message only. No user action is required.
2017-06-07 11:16:15.87 spid13s Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSSQLSERVER ].
2017-06-07 11:16:15.89 spid13s Server named pipe provider is ready to accept connection on [ \\.\pipe\sql\query ].
2017-06-07 11:16:15.91 Server Server is listening on [ ::1 <ipv6> 1434].
2017-06-07 11:16:15.91 Server Server is listening on [ 127.0.0.1 <ipv4> 1434].
2017-06-07 11:16:15.91 Server Dedicated admin connection support was established for listening locally on port 1434.
2017-06-07 11:16:15.93 spid13s SQL Server is now ready for client connections. This is an informational message; no user action is required.
2017-06-07 11:16:15.93 Server SQL Server is attempting to register a Service Principal Name (SPN) for the SQL Server service. Kerberos authentication will not be possible until a SPN is registered for the SQL Server service. This is an informational message. No user action is required.
2017-06-07 11:16:15.94 spid9s Starting up database 'model'.
2017-06-07 11:16:15.97 Server The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/WASYGSHA01-1020.asnet.accorservices.net ] for the SQL Server service. Windows return code: 0x2098, state: 15. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.
2017-06-07 11:16:15.98 Server The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/WASYGSHA01-1020.asnet.accorservices.net:1433 ] for the SQL Server service. Windows return code: 0x2098, state: 15. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.
2017-06-07 11:16:16.01 spid9s Clearing tempdb database.
2017-06-07 11:16:16.45 spid9s Starting up database 'tempdb'.
2017-06-07 11:16:16.53 spid29s The Service Broker endpoint is in disabled or stopped state.
2017-06-07 11:16:16.53 spid29s The Database Mirroring endpoint is in disabled or stopped state.
2017-06-07 11:16:16.55 spid29s Service Broker manager has started.
2017-06-07 11:16:16.65 spid4s Recovery is complete. This is an informational message only. No user action is required.
2017-06-07 11:16:40.50 Logon Error: 18456, Severity: 14, State: 5.
2017-06-07 11:16:40.50 Logon Login failed for user 'ASNET\clu'. Reason: Could not find a login matching the name provided. [CLIENT: 127.0.0.1]
2017-06-07 11:20:29.80 Logon Error: 18456, Severity: 14, State: 5.
2017-06-07 11:20:29.80 Logon Login failed for user 'ASNET\clu'. Reason: Could not find a login matching the name provided. [CLIENT: 172.31.212.20]
2017-06-07 11:21:45.60 Server Using 'dbghelp.dll' version '4.0.5'
2017-06-07 11:23:15.55 Server ***Unable to get thread context for spid 0
2017-06-07 11:23:15.55 Server * *******************************************************************************
2017-06-07 11:23:15.55 Server *
2017-06-07 11:23:15.55 Server * BEGIN STACK DUMP:
2017-06-07 11:23:15.55 Server * 06/07/17 11:23:15 spid 14040
2017-06-07 11:23:15.55 Server *
2017-06-07 11:23:15.55 Server * Non-yielding Scheduler
2017-06-07 11:23:15.56 Server *
2017-06-07 11:23:15.56 Server * *******************************************************************************
2017-06-07 11:23:15.56 Server Stack Signature for the dump is 0x000000000000029A
2017-06-07 11:23:17.04 Server External dump process return code 0x20000001.
External dump process returned no errors.
2017-06-07 11:23:17.04 Server DoMiniDump () encountered error (0x80004005) - Unspecified error
2017-06-07 11:23:17.04 Server Process 0:0:0 (0x511c) Worker 0x00000004784A0160 appears to be non-yielding on Scheduler 5. Thread creation time: 13141278975449. Approx Thread CPU Used: kernel 0 ms, user 0 ms. Process Utilization 0%. System Idle 95%. Interval: 70137 ms.
https://www.isunshare.com/sql-server/fix-sql-server-failed-login-error.html
Failed to verify Authenticode signature on DLL 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\ftimport.dll'.
Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos.
最后发现是域账号的问题导致的,电脑的sql server是前同事安装的,但是安装的时候,是用的他自己的域账号。
我的域账号尝试登陆无法识别的。
处理方法,用之前同事的域账号登陆电脑,然后连接上数据库。然后把自己的域账号加入到logins中。
SQL server 2008 15434 以及 15023
从数据库删除用户的的时候,提示用户已经登录,不允许删除
通过下面的查询语句找到session编号
SELECT session_id
FROM sys.dm_exec_sessions
WHERE login_name = 'chuck'
然后强制结束session,其中67是我找到的编号
kill 67
=========================================
删除用户之后,重新创建用户遇到的问题
在出问题的数据库上执行这个命令
sp_change_users_login 'AUTO_FIX', 'chuck'
The row for user 'chuck' will be fixed by updating its login link to a login already in existence.
The number of orphaned users fixed by updating users was 1.
The number of orphaned users fixed by adding new logins and then updating users was 0.
多次 执行直到出现
The number of orphaned users fixed by updating users was 0.
The number of orphaned users fixed by adding new logins and then updating users was 0.
sqlserver附加数据库失败

我遇到的问题是,之前用的EntityFramework,添加数据库,是以链接数据文件生成的。
链接数据库后台是由EF做的
<connectionStrings>
<add name="SchoolDBEntities" connectionString="metadata=res://*/School.csdl|res://*/School.ssdl|res://*/School.msl;provider=System.Data.SqlClient;provider connection string="data source=LUJUNTAO\MSSQLSERVER2012;initial catalog=SchoolDB;persist security info=True;user id=sa;password=123456;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
坑爹了,发现之前连接数据库的时候,没有用127.0.0.1,用的居然是LUJUNTAO\MSSQLSERVER2012

备注:
在"127.0.0.1"附加的数据库和在"用户名\数据库实例"附加的数据库是不一致的
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
连接局域网中的数据库(remote database),遇到上面的错误。原因是本地配置的代理没有bypass掉局域网的ip。然后还需要重启一下机器
登录失败 18456
Server Name: .
Error Number: 18456
Severity: 14
State: 1
Line Number: 65536
State 1
Error information is not available. This state usually means you do not have permission to receive the error details. Contact your SQL Server administrator for more information.
最后发现是因为连错了数据库,
本地安装了sql server 2008和sql server 2014,其中sql server 2008的连接是127.0.0.1,但是sql server 2014的连接应该是127.0.0.1\sql2014
用everything搜索,ssms.exe "C:\Program Files (x86)\Microsoft SQL Server\" 【ssms.exe是sql server management studio】
"C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\Ssms.exe"
登陆失败 error 26
在连接数据库的时候,需要显示指定端口1433。
或者启用SQL Server Browser
https://dba.stackexchange.com/questions/118458/connect-to-sql-server-without-specifying-port
如果sql server browser是灰色的,无法启用。那么打开services管理工具,设置SQL Server Browser服务的启动方式为Automatic()
https://stackoverflow.com/questions/21375014/i-cannot-start-sql-server-browser
sqlserver数据库出错的解决方法的更多相关文章
- entityframework使用CodeFirst创建MySql数据库出错的解决方法恢复
先告诉大家一个秘密,EF在使用 update-database 时候,使用的连接字符串来自于解决方案中的“启动项目”,而不是你在包管理器中选择的“默认项目” 0x01. 先说错误,方便大家检索到 开发 ...
- mysql5.x升级至mysql5.7后导入之前数据库date出错的解决方法!
mysql5.x升级至mysql5.7后导入之前数据库date出错的解决方法! 修改mysql5.7的配置文件即可解决,方法如下: linux版:找到mysql的安装路径进入默认的为/usr/shar ...
- Django的admin管理系统写入中文出错的解决方法/1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‘locate’
Django的admin管理系统写入中文出错的解决方法 解决错误: 1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and ( ...
- Sqlserver2012数据库乱码的解决方法
Sqlserver2012数据库乱码的解决方法 1. 在创建数据库时,一定要指定数据库的排序规则 2. 输入数据库名称 3. 选中选项,在排序规则中选中Chinese_P ...
- VS 2013 professional版在win10上安装出错的解决方法
VS 2013 professional版在win10上安装出错的解决方法 win10上安装完VS 2012 professional和VS 2017 professional后,由于项目的需要,要在 ...
- SqlServer表死锁的解决方法
SqlServer表死锁的解决方法 前些天写一个存储过程,存储过程中使用了事务,后来我把一些代码注释掉来进行调试找错,突然发现一张表被锁住了,原来是创建事务的代码忘记注释掉.本文表锁住了的解决方法 ...
- python学习--python 连接SQLServer数据库(两种方法)
1. python 学习.安装教程参照: http://www.runoob.com/python/python-tutorial.html 2. 集成开发环境 JetBrains PyCharm C ...
- MVC4升级MVC5导致原项目出错的解决方法
原文:MVC4升级MVC5导致原项目出错的解决方法 出现安全透明方法"WebMatrix.WebData.PreApplicationStartCode.Start()"尝试访问安 ...
- Asp.Net 应用程序在IIS发布后无法连接oracle数据库问题的解决方法
asp.net程序编写完成后,发布到IIS,经常出现的一个问题是连接不上Oracle数据库,具体表现为Oracle的本地NET服务配置成功:用 pl/sql 等工具也可以连接上数据库,但是通过浏览器中 ...
随机推荐
- 洛谷P3368 树状数组2 树状数组+差分
正解:树状数组+差分 解题报告: 戳我! 不得不说灵巧真滴是越来越弱了...连模板题都要放上来了QAQ 因为今天考试的T3正解要用到树状数组这才惊觉树状数组掌握得太太太太差了...之前一直靠线段树续着 ...
- vue学习六之vuex
由于状态零散地分布在许多组件和组件之间的交互中,大型应用复杂度也经常逐渐增长.为了解决这个问题,Vue 提供 vuex. 什么是Vuex Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式 ...
- notefirst使用
1:如果格式不正确,导入题录失败的话,可以手动添加.点击新建题录即可.输入文章的标题等信息. 2:导入word中的文献,可以使用word中notefirst的引文编辑功能,对文献进行删除,编辑等. 3 ...
- 视频处理工具FFmpeg的安装(windows/Linux)
♣FFmpeg是什么? ♣FFmpeg组成 ♣下载工具 ♣安装FFmpeg ♣应用到j2ee项目 前言:学习视频编码,一定要知道雷霄骅(leixiaohua1020)的专栏 ,伟大的程序员,26岁去世 ...
- [py]面向对象图解assignment
python的chained assignment 在python中 a is b is c 等价于 a is b and b is c 所以,猜猜 False is False is False # ...
- [LeetCode] 38. Count and Say_Easy
The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 ...
- IP设置-内置服务器-外置服务器
HBulider 中 运行 -> 设置web服务器 -> 内置服务器将 127.0.0.1 换为局域网的ip,可以在局域网内所有电脑,手机上浏览页面.但是只能浏览html,php asp等 ...
- 利用<object>和<embed>实现视频播放
直接使用<object>或<embed>都可以实现视频播放,那么两者的区别是什么? 1.是为了兼容不同浏览器,IE只支持对Object的解析:火狐,谷歌,Safari只支持对E ...
- python+Django框架运用(三)
Django模型 模式指的是根据数据库中数据表的结构来创建出来的class,每一张表到Python中就是一个 class,表中的每一个列,到Python中就是class的一个属性. 在模型中可以完成对 ...
- Java获取配置文件跟路径
一直以为使用new File(相对路径)可以读取class目录下的文件,其实不然.网上查询了一些资料,弄清楚了原理,总结如下: package com.coshaho.learn; import ja ...