Cannot Get DBMail to Work. Worked in the Past - sql-server-2005

SQL Server 2005 DBMail.
I had all of this working, but then it just stopped. I tried starting over from scratch to no avail
The surface area configuration tool has been used to make sure the procs in msdb are active.
I've tried stopping and starting the mail service with sysmail_stop_sp and sysmail_start_sp.
I made sure that the Mail Profile is enabled in the ALert System section of SQL Server Agent. I did change the profile being used some time ago and have NOT cycled the server up and down - it would be a big deal to do this.
I've tried stopping and starting SQL Server agent.
I've confirmed that the user belongs to the msdb database and has the role DatabaseMailUserRole.
SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb'
1
dbo.sysmail_help_status_sp;
STARTED
sysmail_help_queue_sp #queue_type = 'Mail'
mail 258 NOTIFIED 2011-08-19 16:51:34.500 2011-08-19 16:51:34.500
The state used to be RECEIVES_OCCURRING when it was working.
All email queues up with a sent_status of Unsent.
I've triple checked my email credentials and they're all good. I've tried ports 25 and 2525, both of which are accepted by my provider.
I've verified that the credentials are good by setting them up in another mail client ans successfully using them to send mail.
Am at wit's end. Anyone know what could be going on?

i had this problem before, it’s the dbmail setup within sql that’s corrupted or as Microsoft told me "stalled" are you sending HTML over the dbmail from say a job within sql using cast?
If so check the job and make sure there isn’t a problem inside first but what i did was delete the dbmail profile and then just re made it and then it just decided to start working again.
Have you also looked with the administrate tools as usually it will post an application error on why it failed (inside control panel)
Let me know if the deletion of the profile worked and i can maybe take you through a couple of things i was told to try first.

Related

Creating listeners with SQL Server AlwaysOn suddenly stopped working

Problem: I created 10 AlwaysOn Availability Groups with SQL Server without a problem. Suddenly, it stopped worked and I kept getting this ONLY on the "create the listener" part:
Msg 19471, Level 16, State 0, Line 9
The WSFC cluster could not bring the Network Name resource with DNS name 'L_MyListener' online. The DNS name may have been taken or have a conflict with existing name services, or the WSFC cluster service may not be running or may be inaccessible. Use a different DNS name to resolve name conflicts, or check the WSFC cluster log for more information.
Sometimes I also got Msg 19476. This was all maddening because one moment I was creating listeners and availability groups, feeling like a guru, and then everything stopped and I lost hours of time.
So how do you solve this? Of course, Microsoft's own suggested text in the above error description was NOT helpful.
Apparently, each listener is really creating a mini "computer" in Active Directory if you look. And... here's the kicker, a domain user can only join a computer to a domain a limited number of times and that default is 10. Who would have thought that adding listeners equates with joining users to a domain!???! Microsoft really should have made this listener thing more intuitive, at least in their description text of possible problems.
Well, on your Domain Controller, open ADSI Edit, configure it the first time to look at your default naming context of your domain, like "DC=yourname..." with the CN= rows below that. Now, right click on the "DC=" line, choose Properties and navigate down to ms-DS-MachineAccountQuota and increase the limit from 10 to something else like 100.
You may need to run "GPUPDATE /FORCE" on the SQL Servers where you want to try again to add the listener. You may also have to clean up the mess it left (i.e. delete and restore the bad attempt at setting up your group and listener) before you try again.
With SQL Server 2016 supposedly going to require each database be in its own group, with its own listener, people will hit this limit of 10 quite easily!
I hope this helps you. If so, please mark this as the answer on the left. Of course, there are other reasons why people may get this error, as in the Microsoft error now but this whole post is for people who had it working just fine and then suddenly it stopped.

Overloaded EC2 Instance?

A developer has made me a script to connect my CRM infusionsoft to a Google calendar. When I put through a specific form on my CRM its then added to my Google calendar. The script checks every two minutes for any updates. I set-up a EC2 Amazon Linux instance and put the script on it. The server has gone down twice. The first time it came back again but now I cant access it via SSH. I get this error message:
ssh_exchange_identification: read: Connection reset by peer
​After trying out lots of different fixes, not of which were successful I came to the conclusion that ​maybe the server was being overloaded? I was going to create a new instance and pop the script on their. Can anyone tell me if this is correct? If it is how can I stop the server being overloaded again? Could I increase the MaxStartups value? Will this help? Is there a different value I can increase. I would really appreciate some help with this.
Start with the Monitoring tab of your instance in the console. This will show you what is going on with your instance.
Once you figure out what the problem is, you can set up Cloudwatch alerts to let you know when certain events have occurred.

Risks of using SQL trigger to run an exe

What are the risks of running an exe on an sql trigger? This is a closed server, intranet only, with limited user access to the server where the script runs from and the SQL server connection.
I store outgoing emails temporarily in a table in my database system. These are then sent out via a trigger that runs and exe. The exe simply pulls the to, from, subject, cc, and body from the DB and send the email via CDO.
I have to use an outside method of sending emails instead of simply sending from code-behind in order to avoid slwodown on the website. I asked regarding this specific issue in another post, but asking about exec risks seemed like a seperate issue. Direct any alternatives to the related post.
Related post Email from web without tying up webpage
If it's a closed server and the .exe is known, I don't see that there would be much risk if any. The only risk I could see would be if someone changed your exe for something else that would then be triggered, but that seems unlikely given the scenario you described.
We had a similar situation several years ago where we had a vendor whose product was updated via a control program. We had a trigger that hit the control program each time a user was added to the sql database, and the control program would then signal its service to add the user there as well. Never had a real problem with it.

Why can the SA account no longer access the master database?

I'm somewhat stuck. We have a database server which was set up and configured by a third party. It's for a third party product so unfortunately we're stuck with the way they've configured it.
Their brilliant configuration includes using the sa account to make a number of connections. For about a week now we've had connection failures filling up all our event logs, two every ten seconds. I have managed to identify that it is the master database this login failure is for.
It's definitely the sa account accessing the master database. It is not an incorrect password (which is good, because we don't know the sa password - and neither does the vendor, it seems. Yay...) because we're getting error state 16 so I believe the sa account has some problems with the master DB.
It's connecting to everything else without problem - I can see the connections made to all other databases successfully. I have checked the sa account permissions and I really can't see anything wrong. I'm at the point of restoring the master database from a backup two weeks old and wanted to open this up to you awesome people out there in case any of you have come across this before and have any alternative suggestions...
Yours hopefully...
Summer
Edit: added a screen shot of my error below:
Well my first suggestion would be get the third party vendor in there to reconfigure and fix. They made the mess, let them clean it up.
Restoring the backup might work but it is critcally important that you 1. change the sa password and 2. do not allow the software to connect using sa. I would make this a deal-no deal item with the vendor. The vendor though is terminally incompetent if they did this and I would seriously be looking at their competition to replace this badly designed system.

Creating a process in a non-zero session from a service in windows-2008-server?

I was wondering if there is a simple way for a service to create a process in user session?
My service is running as a user(administrator) account and not as a LocalSystem acount, therefore i can't use the WTSQueryUserToken function.
i have tried calling
OpenProcessToken(GetCurrentProcess,TOKEN_ALL_ACCESS,TokenHandle);
but when i use this token to run
CreateProcessAsUser(TokenHandle,.....)
my process is still running in session 0.
how can i resolve this issue?
I'm using an Ole automation so i don't really care on which session the process will be running on, as long it is not the session 0 - because the Ole from some reason doesn't create its processes (winword.exe for instance) in session 0, but rather it creates them in other user sessions.
Any suggestions will be welcome.
Thanks in advance.
I Have been able to resolve this issue myself, thanks for all of those who have looked at this question.
Ok, so as i mentioned above - the Token belongs to a process which is running in session 0...
so what i have done...is looked for a token of a process that is not running in session 0.
when you take it's process id as the parameter for OpenProcessToken.
than the CreateProcessAsUser will create the process in the same session (and probably with the same cridentals as the process you have chosen);
The problem was that i couldn't have get any details on most of the processes using the function: QueryFullProcessImageName - because it has a bug, and it doesn't work on proccesses that are created from a path that contains spaces (like C:\Program files for instance)
and another issue with that function i guess is that because i'm running the original process using a user cridentals i can't access the information of a process that is running using the Local-system account. which is pretty bad because i wanted to take the winlogon.exe as my process (because it indicate a new opened session).
also in order to succeeed in that trick, you must play a little bit with the security of the system, in order to allow the process to ask for elevated security:
what i have chosen to get elevated for is :
SeDebugPrivilege - for finding information on the running processes
SeAssignPrimaryTokenPrivilege - in order to run a new process with the token i extracted from the user session process(i.e explorer.exe)
SeCreateTokenPrivilege - i dont know if it is needed but i did it anyway because it sounds related.
in order to succeed in elevating this Privileges - you must add the user that run the process to the relevant users in all of this Privileges in run->gpedit.msc or run->secpol.msc (under Local Computer Policy\Computer Configuration\ Windows Settings\Security settings\ LocalPolicies\User Rights Assignments)
add your account to the following rights(compaitable with the Previleges above) :
Create a token object
Debug Programs
Replace a Process level token
and that is it! :)
it has been working Great!
Btw, you might want to disable all the UAC stuff...i dont know if it is related or not, but it has made the working with 2008 less painful - no more annoying popups.