Database mail not working / Nothing in queue or log - sql-server

After configuring database mail on one server and sending a test email, I am finding nothing in the queue or the log. The mail id, however, keeps incrementing with each retry. I have checked the following:
I am sysadmin on the box, so I do have permissions to send mail
EXEC msdb.dbo.sysmail_help_status_sp; reports STARTED
There are no records in the queue: SELECT sent_account_id, sent_date FROM msdb.dbo.sysmail_sentitems;
There are no records in the event log: SELECT * FROM msdb.dbo.sysmail_event_log;
Service broker is enabled. This returns "1": SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb';
I have configured this successfully on 4 other instances, it's just one that is giving me grief. Any other pointers would be appreciated.

Looks like this issue is with a bug in the version of sql that I am running on this instance as explained here: https://support.microsoft.com/en-us/help/3186435/fix-sql-server-2016-database-mail-does-not-work-on-a-computer-that-doe
Installing CU2 will fix it:
Note This issue also affects instances that are running SQL Server
2016 SP1 CU1. This issue occurs because of a bug in SQL Server 2016
SP1 CU1 setup. The setup for SQL Server 2016 SP1 CU1 deletes the
config file DatabaseMail.exe.config without replacing it with a new
one. This causes the Database Mail to break in the absence of .Net
framework 3.5 SP1. The fix in SQL Server 2016 SP1 CU2 is meant to
address this issue and prevent the DatabaseMail.exe.config file from
getting deleted from the machine after installing a CU. So if you
install SQL Server 2016 SP1 + CU2, the Database Mail will not be
impacted by the setup. However, if the Database Mail is broken by the
installation of SQL Server 2016 SP1 CU1, you can use any one of the
workarounds mentioned below.

Related

MS Access on Windows 10 drops connection to SQL Server randomly

We have a MS Access 2010 app, using SQL Server 2008 R2 as its database. All workstations were running on Windows 7 with no problems.
Our customer started to upgrade the workstations to Windows 10, and now we see connection to the server drops at a random occasions. Not related to any specific action, query, report or form.
The application is using ODBC connection to access the tables.
When this happens, all connections to all tables are dropped, and the app is unusable.
To resolve this, we need to restart the application and everything is working fine again, until the next time.
We opened up a table when this error occurs and see all the records showing #Name as the data.
Please help
Tested the network connection - no problems or errors
Upgraded SQL Server Service Pack to the latest (thought it might related to TLS version)

The version of the report server database is either in a format that is not valid, or it cannot be read

I had an SQL Server 2012 database instance installed on server A.
I then installed SSRS 2016 only (not the the complete SQL Server 2016) on server B but pointed the SSRS instance to host its ReportServer database on the SQL Server 2012 instance installed on server A.
At this point all worked well.
I then had a requirement to upgrade SSRS 2016 to SSRS 2017.
I used the Microsoft SQL Server 2017 Reporting Services stand alone installer from https://www.microsoft.com/en-us/download/details.aspx?id=55252
In SSRS 2017 configuration manager, i selected to use an existing database and pointed to ReportServer database i have in the SQL Server 2012 instance i have on Server A.
In SSRS 2017 configuration manager, i have deleted all encrypted data.
I can browse to the reports web portal url, see data sources and the deployed test report files but when i try to open a report, i get the error blow.
The version of the report server database is either in a format that is not valid, or it cannot be read. The found version is '2017'. The expected version is '173'. (rsInvalidReportServerDatabase)
i have tried to run delete from ReportServer.dbo.ServerUpgradeHistory where ServerVersion = 173 but i still get the same error.
Looks like the old version value is still being stored somehwere in a config file.
Where else should i look, what else should i try?
I resolved the issue by
1- Taking backup of ReportServer databases, then deleting them
2- stopping all report services' windows services. Made them Manual startup.
3- Opened the Reporting Services Configuration form Start Menu > SQL Server {Version}
4- Starting the service from the Configuration application
5- Recreating database from Database tab
Solution is to upgrade SQL Server 2016 to Service Pack 2: SQLServer2016SP2-KB4052908-x64-ENU
https://www.microsoft.com/en-us/download/details.aspx?id=56836
The least intrusive solution I found was this:
USE [ReportServer]
DELETE FROM ServerUpgradeHistory WHERE ServerVersion > 173
Thanks to #Henrik H in the following post:
https://serverfault.com/a/893739

SQL Server 2014 - Windows could not start SQL server on local computer

I have an AWS instance, on which SQL Server 2014 has been running for more than 3 years.
But a few days ago, suddenly the SQL Server stopped running.
I checked the server and tried to start SQL Server service from services, from SQL Server Configuration Manager etc. but I'm not able to start the server and got following error:
So I checked event viewer entries and I found these two errors:
I started some research work over web to overcome on this issue and I found that I can start SQL service using below command using T902:
net start MSSQL$REVCORD /T902
And SQL Server service started successfully.
But I want to make SQL Server / services back to normal as before so I can start / stop services normally.
I found on web that this cause is due to corruption in master SQL Server database, I don't have backup of master SQL Server database so I cannot restore it back.
I checked multiple threads over web and tried multiple things to overcome this issue but no luck.
So finally I decided to reinstall/recover SQL Server 2014, but I am getting another error while reinstalling:
Based on finding over web, all threads showing that I have to uninstall and reinstall SQL Server to make it normal again.
Please help! It's a live server with multiple calls continously so I cannot uninstall/reinstall SQL Server there due to possible data loss.
The first thing:
select * from sys.sysmessages where error = 5833
The message:
The affinity mask specified is greater than the number of CPUs supported or licensed on this edition of SQL Server.
Check your edition, and fix the affinity mask so that the number of CPUs satisfy the number which is supported by your edition.
You can fix it in SSMS on the Processors tab in your server properties, or using sp_configure

SQL Server Replication Local Subscription Properties returns "Cannot apply value ‘null’ to property ServerInstance: Value cannot be null."

I am replicating a SQL 2008 R2 database to a SQL 2016 database.
When I connect to the SQL 2016 database using SSMS, and in Object Explorer
select Replication->Local Subscription->MySubscription then right click and select Properties I get the error "Cannot apply value ‘null’ to property ServerInstance: Value cannot be null.".
What does it mean and how can I fix it? I am logged in using my Windows domain user which is a sysadmin on both systems.
Starting SQL 2016, change has been introduced to support memory-optimized subscribers for Tran Replication. This bug in SSMS is a regression from that change.
In the subscription properties form, a new entry has been added to show whether it is memory-optimized subscription or not. This information is fetched from Distributor server.
So, for a push subscription, if the subscriber is SQL 2016 or above, if you try to look at the subscription properties from the subscriber server, the distributor server is returned as NULL since it can not access/connect to distributor server. This is the reason why you get this error.
Until this is fixed, you can view the subscription properties from the publisher side.
I just had the same issue, my replication publisher and distributor is on SQL Server 2014 and my subscriber is SQL Server 2016. When I tried using SSMS 2016 I had the same issue but when I use SSMS 2014 everything worked fine, so this is very likely to be because of the version of SSMS. Try using the SSMS Version that the publisher(source) is using.
I have had this issue when all servers were on the same version of SQL. I read somewhere that Replication won't work if there are more than three versions of SQL between the distributor and publisher (and subscriber depending on the type of replication), but I worked around this by using a lower compatibility level for the databases.
In my current setup everything is SQL 2016. I had this same issue and fixed it by creating a linked server for the distributor and publisher on the subscriber. These should be creating during set-up so I'm not sure why they weren't.
From the distributor I scripted the linked server repl_distributor and also the linked server for the publisher and then ran these scripts on the subscriber. This then fixed the issue.
I hope this works for you too (although your question was ages ago so you're probably alright now!).
Check the linked server "Server Options" Tab. Here you speicify distributor, Publisher and Subscriber. Ensure these are set to true where appropriate for the setup you have. If these options are all set to false as was the case for me using all SQL 2016 you can get this error as it fails to connect to the distributor.
According to the change log for SSMS 17.4 (released 14th December 2017), this error has now been fixed for PULL subscriptions.
From This Connect item,Workaround seems to be..
1.Add the user as local admin on windows box
2.Run SSMS as admin..

SQL Server 2005 SP2 or SP3 not updating Management Studio?

I applied SQL Server 2005 SP2 and marked all the components to be updated, including Client tools, but the version in the Help -> About box still has version 1399, while the server does indeed had 3042.
I then re-applied SP2 to only Client tools, and everything ran successfully (again, first time did too) but still, no version update for management studio.
Now, I just applied SP3 with everything successfully, but still management studio version did not get updated.
How can I update it? Or at least how can I uninstall just Management studio so I can install it from a newer DVD?
Thanks.
If you go to Control Panel > Add Remove programs and then choose the appropriate SQL Server installation, this will start the typical install wizard for SQL Server.
You can then select the specific components that you wish to uninstall.
If you are having difficulties with SQL Server 2005 Service Pack 3 may I suggest that you visit the SQL Server Central forums as there are a wealth of resources for SQL Server SP3. It was actually due to user demand from this forum that resulted in there even being an SP3 release.
http://www.sqlservercentral.com/Forums/Forum146-1.aspx
Let me know how you get on.
Cheers, John
I got the Error in sql server sp3 installation log which caused this:
Error Number : 29538
Error Description : MSP Error: 29538 SQL Server Setup did not have the administrator permissions required to rename a file: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mssqlsystemresource1.ldf. To continue, verify that the file exists, and either grant administrator permissions to the account currently running Setup or log in with an administrator account. Then run SQL Server Setup again.
Hate to answer my own question, but I had to manually un-install Client Tools, re-install them using SQL Server 2005 setup, and THEN apply the updates.
It wasn't working by just trying to apply updates over the existing original installation.
And i mention un-installing using the SQL Server 2005 Setup because trying to do it from the Add/Remove Programs dialog won't let you or will give you trouble.

Resources