Error: 18456, Severity: 14, State: 38 Reason: Failed to open the explicitly specified database 'ReportServer'. [CLIENT: <local machine>] - sql

I'm facing a situation which every 10 seconds an error log is recorded with the following msg:
2018-07-25 09:07:09.59 Logon Error: 18456, Severity: 14, State: 38.
2018-07-25 09:07:09.59 Logon Login failed for user 'svc_sql'. Reason: Failed to open the explicitly specified database 'ReportServer'. [CLIENT: <local machine>]
In my instance I don't have a 'ReportServer' database. I know that in the past the server was migrated to a new machine and I reckon the 'ReportServer' database was created with a new name in the new server. I really don't know how the migration was done.
I've activated the SQL_Profiler with all audit options and I could see that this user also executes a procedure sometimes.
I've checked the default database for this user and it's Master.
Any ideas how can I fix this issue? My error log is flooding with this message.
Thanks a lot.
Rod

I've checked the default database for this user and it's Master.
The error doesn't tell you about default database but about explicitly specified database, that is different, it's the database that is mentioned in connection string under Initial Catalog or Database.
Do you see what application tries to open this database? The problem is in that application, it uses old connection string. If it's SSMS, it's simple, it's in the Options of connection dialog, but if it's another application, the connection string can be written in the ini file or hardcoded.
I don't know if I try to run DBCC CHECKDB master will solve this.
Of course it cannot solve this. This has nothing to do with database integrity. It's your client that uses wrong connection string.
Any ideas how can I fix this issue? My error log is flooding with this
message.
If you just want to save your errorlog from these messages just turn off failed logins audit:
Or you should find this application by its name or host or client address.
Or you can temporarily disable this login and see who will call you saying he cannot login anymore, or, if it's your local machine, some of your applications will fail, this way you'll find it.

I had the same error and doing the following resolved the error for me:
From within the SQL Server Management Studio
Security
Logins
Right Click the user ID that was failing login
Server Roles
Make sure all the checkboxes are checked. Right clicked Security and refresh.

Related

sqlplus ORA-01017: invalid username/password; logon denied

on my windows 10 system every time I attempt to login I see the following error.
ORA-01017: invalid username/password; logon denied
During the install process I was not asked to create any users. I do seem to recall that I was asked to enter 'Oracle_1' as the admin password but I was not asked to enter an admin userid. I could not login with that id.
I was able to start a sqlplus session by executing "sqlplus /nolog". However, once in the session I really could not do anything, even a help command failed because I was not connected to a database.
On windows 10 how do I create a user that will enable me to successfully login and manipulate database tables ?
In Eclipse on a Tomcat server, the config file is under Overview>Open Launch Configuration> Arguments Tab> VM arguments. Make sure the keys for -Ddb.user and -Ddb.password are correct. Also check the information in c:\users\\config\customProperties\startup\application.properties. Perhaps someone more experienced may chime in based on your current set-up.

sql server 2012 copy database failed between two instances on the same host

I am learning the sql server 2012 and got stuck when using the copy datase, trying to figure out why.
I created two instances on the same host, using administrator, windows authentication.
(the default instance:iZp0w14yqtvxcmZ, the second instance: iZp0w14yqtvxcmZ\instance2, try to copy database from the default one to the second one)
It failed at the last step: execute sql server agent job.
here is the error log from windows event viewer:
Message: Failed to connect to server iZp0w14yqtvxcmZ.
StackTrace: at Microsoft.SqlServer.Management.Common.ConnectionManager.Connect()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.OpenConnection(Server& server, ServerProperty serverProp)
InnerException-->Login failed for user 'NT Service\SQLAgent$INSTANCE2'.
Then I tried to add the login 'NT Service\SQLAgent$INSTANCE2' in the default instance. Then tried again and got another error:
Event Name: OnError
Message: An error occurred while transferring data. See the inner exception for details.
StackTrace: at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferExtraObjectsViaSmoTransfer()
InnerException-->Windows NT user or group 'iZp0wd5ebkvswaZ\Administrator' not found. Check the name again.
But the Adminitrator does exist in the computer management -> local user and groups -> group, so I don't know what to do now. NEED HELP !!!
Thanks a lot!
after two-day's struggling, I figured it out. The sql server agent service should use a domain-based account for a multi-server environment. Also that account should be able to log in and perform the job.
I solved the issue changing the login method to system local account.
Two instances must have the same password and open, then in this case:
insert into [EI7-PC\SQLEXPRESS2].[MYCOMPANY].[dbo].[inventory] SELECT *
FROM [EI7-PC\SQLEXPRESS1].[MYCOMPANY].[dbo].[inventory] where itemno='10-0001'
The reason for the same password is unknown, this is per my experience. With two different password you may get an error about 'sa' failed to login.

Can SQL Server refuse a connection to one specific client, but allow access to every other client?

Trying to learn SQL Server, so bear with my noobness, please.
I see the same errors repeatedly in the SQL Server log:
Error: 18456, Severity: 14, State: 38.
Login failed for user 'domain\username'. Reason: Failed to open the explicitly specified database. [CLIENT: ]
There were also many failed login attempts for the same client prior to this error starting.
I checked the connection string on the problem client and it's identical to the string used on other clients that successfully connect. Can SQL Server limit access to a specific IP/client, but continue to allow access to all other users?
This has been discussed here by Aaron Bertrand:Troubleshooting Error 18456
Error: 18456, Severity: 14, State: 38.
Login failed for user ''.
Reason: Failed to open the database specified in the login properties.
Reason:
The database specified in the connection string, or selected in the Options > Connection Properties tab of the SSMS connection dialog, is no longer valid or online (it might be set to AutoClose or the user may simply not have permission).
Note that this could also be a symptom of an orphaned login. In this situation, you will need to synchronize the login and user information
Can SQL limit access to a specific IP/client, but continue to allow access to all other users?
SQL will not and won't deny access to a specific client,it must fall into one of the above cases

SQL IIS application login fails for user

I am scratching my head here and I need a hand with this. Please save my sanity!
1
I can log into SSMS with the username and it works.
I can open the ODBC/System DSN and test the connection using the same username and it works.
3
I have the vtimecard.ini configured with the username and password IDENTICAL to the login for SQL and that used for the 2 logins that work...
[ODBC]
DSN=
Driver=SQL Server
Server=MLAERP01\VTIMECARD
Database=vTimeCard
UID=vtc2
PWD=
BUT once I try to access the website, it fails.
Details: Global database error Open (global): 'Login failed for user 'vtc2'.' (D=, D=SQL Server, S=MLAERP01\VTIMECARD, D=vTimeCard, U=vtc2)
and when I check the SQL server log it gives:
Login failed for user 'vtc2'. Reason: Password did not match that for the login provided. [CLIENT: ] Error: 18456, Severity: 14, State: 8
Please direct me what I need to look at with this. I am not that versed in SQL and webApps. Any help is good help!

Error message: (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)

I am trying to deploy my website on windows server 2003.
Am i missing something or what is wrong from the following error message, how can I correct it? Thank
I am having the error message:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: A connection
was successfully established with the server, but then an error
occurred during the login process. (provider: Shared Memory Provider,
error: 0 - No process is on the other end of the pipe.)
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): A connection was successfully established
with the server, but then an error occurred during the login process.
(provider: Shared Memory Provider, error: 0 - No process is on the
other end of the pipe.)]
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject) +1019
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection) +108
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.SqlClient.SqlConnection.Open() +125
NHibernate.Connection.DriverConnectionProvider.GetConnection() +104
NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare()
+15 NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect
dialect, IConnectionHelper connectionHelper) +89
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory
sessionFactory) +80
NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping
mapping, Settings settings, EventListeners listeners) +599
NHibernate.Cfg.Configuration.BuildSessionFactory() +104
MyProject.API.Data.SessionManager..cctor() in
C:\Dev\Code\API\Data\SessionManager.cs:27
Typically, to troubleshoot this, you go to SQL Server Configuration Manager (SSCM) and:
ensure Shared Memory protocol is enabled
ensure Named Pipes protocol is enabled
ensure TCP/IP is enabled, and is ahead of the Named Pipes in the settings
Maybe it can help: Could not open a connection to SQL Server
Note : If this is a new instance of SQL Server be sure SQL Server and Windows Authentication is enabled
Right Click the Server in SSMS and pull up server properties
Go to Security--> Select 'SQL Server and Windows Authentication Mode'
Restart the Server and Login with the credentials
Check if your connection string has "Trusted_Connection=true" added.
I had this same error message, turns out it was because I didn't have mixed mode auth enabled. I was on Windows Auth only. This is common in default MSSQL deployments for vSphere, and becomes an issue when upgrading to vSphere 5.1.
To change to mixed mode auth you can follow the instructions at http://support.webecs.com/kb/a374/how-do-i-configure-sql-server-express-to-enable-mixed-mode-authentication.aspx.
I had the same error by in SQL Server Management Studio.
I found that to look at the more specific error, look at the log file created by the SQL Server. When I opened the log file, I found this error
Could not connect because the maximum number of ’2′ user connections
has already been reached. The system administrator can use
sp_configure to increase the maximum value. The connection has been
closed
I spend quite some time figuring this out. Finally running the following code fixed my problem.
sp_configure 'show advanced options', 1;
go
reconfigure
go
sp_configure 'user connections', 0
go
reconfigure
go
More on here and here
Edit
To view logs search for "logs" on windows startup button, click "view events logs". From there go to Applications under "Windows Logs". You can also choose "System" logs to see system wise errors. You can use filter on current logs by clicking "Filter Current Logs" on right side and then select "Error checkbox".
Just another possibility. I had to restart the sql server service to fix this issue for me.
The "real" error was in the SQL error log:
C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\log\ERRORLOG
Path will depend on your version of SQL Server
You should enable the Server authentication mode to mixed mode as following:
In SQL Studio, select YourServer -> Property -> Security -> Select SqlServer and Window Authentication mode.
Goto to SQL server using windows Credentials - > Logins - > Select the Login - > in the Properties -> Check if the Log in is enabled/disabled.
If Disabled, make it enable, this solution worked for me.
Adding this to my connection string worked for me:
Trusted_Connection=true
In C# and SQL SERVER, we can fix the error by adding Integrated Security = true to the connection string.
Please find the full connection string:
constr = #"Data Source=<Data-Source-Server-Name>;Initial Catalog=<DB-Name>;Integrated Security=true";
By looking into SQL SERVER log file in "C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log\ERRORLOG", it says
"Login failed for user 'XXXXX'. Reason: An attempt to login using SQL authentication failed. Server is configured for Windows authentication only. [CLIENT: ]"
The fixing method is to open "Microsoft SQL Server Management Studio" -> Right click the SQL server and then select "Properties" -> Security -> Change the authentication to mixed mode. -> Restart SQL server.
I was getting this error today. In my case, looking at the ERRORLOG file on the SQL server gave me this error:
Login failed for user ''. Reason: Failed to open the
database '' specified in the login properties.
This was because I had deleted the "Default database" of this user a few days ago. Setting the default database to my new database fixed the problem.
Hope this helps someone else.
I forgot to add the "Password=xxx;" in the connection string in my case.
I had the same error, Fixed it by ensuring that SQL server had SQL authentication mode enabled.
see images below.
To enable, go to server properties.
Click on the Security tab and select the SQL server and window server auth mode and press ok
You will need to restart the server for the changes to reflect, should be fine now.
Enable Mixed authentication mode while installing MSSQL server. Also provide password for sa user.
Hi Just enable both for server authentication as per screen shot attached below.
All good and valid courses of investigation especially the logs for more info.
For those hitting this it might be a simple gotcha where when you have created the DB User you may have enforced a password policy and left the user to change the password on first login (i.e. left the checkboxes around the password field at their default values).
Very easily done in SQL Management Studio and can of course cause authentication issues off the bat that are masked unless you look into the logs.
Check that the server name you're logging into with SQL Management Studio matches your connection string.
I was getting this error today.
It turned out that I hadn't realised the machine with SQL Server installed had multiples servers running. I had in fact put my database in a totally different server to the one I thought I was using. (So my connection string was pointing to a server with no database)
Hence, When .net tried to access the database it couldn't find anything and gave only a misleading error message about pipes.
I opened the correct server in SQL Management Studio, added my database to and then all worked fine.
(If the correct server isn't available in the dropdown, try browsing for it.)
In my case it was a spelling mistake in the database name in connection string.
This is old but I had the problem in the connect dialog that it was still defaulting to a database I had removed. And by running those commands the default database in the prompt wasn't changing.
I read somewhere I can't find now, that if you open the "Connect to Server" dialog and then select "Options" and select "Connection Properties" tab by typing the default database (no by selecting from the drop down) the database will then stay on that new value entered. This sounds like a flaw to me but in case someone was wondering about that, that should fix the issue, at least on SQL Server 2012
I know i am probably the only one that will have this problem in this way. but if you deleted the mdf files in the C:/{user}/ directory, you will get this error too. restore it and you are golden
I ran across this in a code-first application which expected the database to be there:
Make sure the database is created / the name in the connection string is correct.
I had the same problem. I tried all the suggested answers in this page but to no avail! Finally, I tried the steps below and it worked for me:
In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
On the Security page, under Server authentication, select the new
server authentication mode, and then click OK.
In the SQL Server Management Studio dialog box, click OK to
acknowledge the requirement to restart SQL Server.
In Object Explorer, right-click your server, and then click Restart.
If SQL Server Agent is running, it must also be restarted.
Then try this in your Package Manager Console:
Scaffold-DbContext "Server=YourServer;Database=YourDB;Persist Security Info=False;User=YourUserName; Password=YourPassword; MultipleActiveResultSets=False;Encrypt=False; TrustServerCertificate=False; Connection Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context DatabaseContext -f
In my case, my situation was a little different.
1. My Mistake: I was missing a ";" in stringConnection. I know this is a newbie bug, but I am new to C # and SQL Server. I have one day :)
private string connectionString = "Data Source=localhost;Initial Catalog=FundamentalsCSharp"
+ "User=sa;Password=123456";
2. My Solution: Put a ";" it was missing after the phrase "FundamentalsCSharp" and it worked.
private string connectionString = "Data Source=localhost;Initial Catalog=FundamentalsCSharp;"
+ "User=sa;Password=123456";
3. Note: Change "FundamentalsCSharp" for your owned Initial Catalog.
I hope this can be of use to someone. Thanks!
In my case, my project is Asp.net Core 3.1 and this is my connection string
"ConnectionString": "Data Source=.; Initial Catalog=WebDB; user Id=sa; Password=123"
And database name in sql server webdb (lower case in sql server).
After many time change database name webdb in connecion string and worked fine.
For those doing entityframework code first, also check to enture you have done your migrations.
The best place to look for the root cause is the sql server error log
In my case My disk was full 99%, It worked after I freed up to 80% of the disk.