I start a Windows SQL Server in a Docker Container on a Windows Server 2016 virtual machine with this command:
docker container run --name mssql-server --detach --publish 1433:1433 --memory 2048mb --volume C:\_Data:C:\_Data --env sa_password=myPassword --env ACCEPT_EULA=Y microsoft/mssql-server-windows-developer
Afterwards I want to start the SQL Agent with this command:
docker container exec mssql-server cmd.exe /C "net start sqlserveragent"
Unfortunately I get this Output:
The SQL Server Agent (MSSQLSERVER) service is starting.
The SQL Server Agent (MSSQLSERVER) service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534
When I type NET HELPMSG 3534 I get:
The service did not report an error.
I am completely out of ideas. On my local machine this works fine, but not on the build server.
Any help appreciated.
Edit:
I opened the SQL Server Management Studio and noticed the SQL Server Agent (Agent XPs disabled) node.
So I went through everything in https://www.mssqltips.com/sqlservertip/2729/how-to-start-sql-server-agent-when-agent-xps-show-disabled/. Afterwards I executed
exec sp_configure 'Agent XPs'
and the result was:
But when I tried to start the agent, I got the exact same error message from above (service ist starting... service could not be started... no error reported).
The interesting thing is, when I run
exec sp_configure 'Agent XPs'
again, I get this:
How is it possible, that the start-agent-command disables the Agent XPs?
Edit2: I just learned from a comment at https://community.spiceworks.com/topic/293771-sql-server-agent-agent-xps-disabled-sql-server-2008 that the agent configures this values automatically when it is started and stopped. So I shouldn't enabled it manually.
Edit3:
After a comment from Jeroen Mostert I looked into the EventLog.
I used the following command:
docker container exec mssql-server powershell.exe "Get-EventLog Application -Newest 100"
This is the result from the Application-Log
Time EntryType Source InstanceID Message
---- --------- ------ ---------- -------
Jun 25 10:37 Information SQLSERVERAGENT 1073741926 SQLServerAgent service successfully stopped.
Jun 25 10:37 Information MSSQLSERVER 1073757281 Configuration option 'Agent XPs' changed from 1 to 0. Run the RECONFIGURE statement to install.
Jun 25 10:36 Information MSSQLSERVER 1073757281 Configuration option 'Agent XPs' changed from 0 to 1. Run the RECONFIGURE statement to install.
You can see, that I have manually enabled the Agent XPs. Then I ran the command from above to start the agent, which gave me the next two lines
The System-EventLog gave me:
Time EntryType Source InstanceID Message
---- --------- ------ ---------- -------
Jun 25 10:37 Information Service Control Manager 1073748860 The SQL Server Agent (MSSQLSERVER) service entered the stopped state.
Edit 4:
As per the comment from Dan Guzman: this is the content of SQLAGENT.OUT:
2019-07-09 11:03:44 - ? [000]
2019-07-09 11:03:44 - ? [098] SQLServerAgent terminated (normally)
Edit 5:
The version is (select ##version) is:
Microsoft SQL Server 2017 (RTM-CU3-GDR) (KB4052987) - 14.0.3015.40 (X64) Dec 22 2017 16:13:22 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)
My solution was to upgrade the build-server to Windows Server 2019. That's it. Then everything worked without any further change.
Hi you need to start SQL Server Agent Service, How to start service you can follow this link: Start Service
Step 1: First, you have to click on the start menu and search for the SQL Server Configuration Manager and click on the SQL Server Configuration Manager option from the search result.
Step 2: Then you have to select the SQL Server Services from the left menu and you can see the service SQL Server (SQLEXPRESS) is not running and it is stopped.
Step 3: Now, you have to start the service SQL Server (SQLEXPRESS) and for that, you have to press mouse right click on SQL Server (Agent) service and select Start option to start the service.
Step 4: You can see the state of service is running, Now you should try again to connect SQL server database engine.
Because you are running in a docker container, i am assuming you are also using some form of environmental management (chef, puppet, jenkins) etc. Carefully review all the actors in your environment. maybe one of these is detecting the agents status and whether agent xp's should be allowed. Further you may need to check SQL Policy and AD Policies if you are in a domain. But the speed at which the reversal occurs suggests that an agent in the docker instance is too blame.
I managed to solve this getting into the docker container using "cmd" and then run a specific command to start windows services.
1) docker exec -it YourSQLServerContainerName cmd
2) net start sqlserveragent
You can stop and start your container and it preserve the running status.
I had the same issue, here how I fix my problem.
First, I install the SQL Server as a Docker container using the mcr.microsoft.com/mssql/server:2019-CU3-ubuntu-16.04 image, and I use host network_mode for the Database container.
Next, after I view the SQL Agent log, I notice it wasn't able to connect to the server.
$ tail -100f /var/opt/mssql/log/sqlagent.1 # read agent's logs
...
2020-10-03 21:25:01 - ! [000] Unable to connect to server '(local),1433'; SQLServerAgent cannot start
2020-10-03 21:25:01 - ! [103] SQLServerAgent could not be started (reason: Unable to connect to server '(local),1433'; SQLServerAgent cannot start)
2020-10-03 21:25:06 - ! [298] SQLServer Error: 11001, TCP Provider: No such host is known. [SQLSTATE 08001]
...
Finally, I found from logs that the SQL Agent was trying to connect with instance '(local),1433', so my solution was to resolve the local and sqlserver host with the local IP. I accomplish it by adding the following records to the /etc/hosts file of the server.
127.0.0.1 local
127.0.0.1 sqlserver
I found from logs that the SQL Agent was trying to connect with instance '(local),1433' in /var/opt/mssql/log/sqlagent.out
I'm using Amazon Linux 2 with Sql Server 2017 updated.
Edit the local and sqlserver host with the local I by adding the following record (first line) to the /etc/hosts file of the server.
172.31.1.200 ip-172-31-1-200
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost6 localhost6.localdomain6
Related
I want to use machine learning services in SQL Server database, and now I install machine learning services(In-database) and python successfully, but I cannot run python in SSMS, when I run:
>```SQL
EXEC sp_execute_external_script #language =N'Python',
#script=N'
OutputDataSet = InputDataSet;
',
#input_data_1 =N'SELECT 1 AS hello'
WITH RESULT SETS (([hello] int not null));
GO```
it displays the error as below:
>SQL Server was unable to communicate with the LaunchPad service. Please verify the configuration of
the service.
So I need to start the SQL Server Launchpad in SQL Server Configuration Manager, but fail with the error messages:
>The request failed or the services did not respond in a timely fashion.Consult the event log or
other applicable error logs for details.
I don't know where the error log is, but I have check the Event Viewer it just shown a similar info:
>The service did not respond in a timely fashion.
>A timeout was reached (30000 milliseconds) while waiting for the SQL Server Launchpad service to connect.
What I have try:
1. Restart the SQL Server multiple times.
2. Make sure the account "NT SERVICE\MSSQLLaunchpad$SQLEXPRESS" that log on Launchpad has the necessary permission:
- Adjust memory quotas for a process (SeIncreaseQuotaPrivilege)
- Bypass traverse checking (SeChangeNotifyPrivilege)
- Log on as a service (SeServiceLogonRight)
- Replace a process-level token (SeAssignPrimaryTokenPrivilege)
- Allow log on locally
My SQL Server Version is :
SQL Server 2017 (RTM-CU17) (KB4515579) - 14.0.3238.1 (X64)
I am trying to install SQL Server 2012 with a service account. Installation is successful but the service account gets locked. How it can be removed?
I tried using another account and tried with my my own account but same happened
Start the instance of SQL Server in single-user mode by using either the -m or -f options.
More information here: https://community.spiceworks.com/how_to/118087-how-to-gain-access-to-sql-server-when-nobody-has-access
Please how can we resolve this error for apps accessing SQL server on the same machine?
I have run through ALL the the usual suggestions both on SO and Google.. no luck.
Windows 2016 server.
SQL Server 2017
This started after running the June windows updates.
(EDIT) - Steps Taken:
1) restarted the server --- OK
2) ensure MSSQLSERVER service is running --- OK
3) ensure I can access the sql server remotely from my laptop --- OK
4) remote into the server and try to start hMailServer Administrator --- ERROR
I am setting up my development environment for TFS2018 with SQL Server 2016 , i have already installed the following :-
sql server 2016 sp1. [ServerDB]
ServerDB\MSSQLTFS2017 ===>>> Exting Instance for TFS2017
ServerDB\MSSQLTFS2018 ===>>> New Instanct for TFS2018
ServerDB\Administrator for install DB
TFS2018 [ServerApp]
ServerApp\Administrator for install TFS (connect to ServerDB\MSSQLTFS2018)
But during my TFS2018 installation i am getting the following errors:-
TF255507: The security identifier (SID) for the following SQL Server login conflicts with a specified domain or workgroup account: ServerDB\Administrator. The domain or workgroup account is: SIAM-TFD-03\Administrator. The server selected to host the databases for Team Foundation Server is: SIAM-DBS-06\MSSQLTFS2018.
You can resolve this issue by renaming the conflicting login. To do so, open a command prompt on the computer that is running SQL Server and execute the following command:
sqlcmd -E -S "ServerDB\MSSQLTFS2018" -Q "ALTER LOGIN [ServerDB\Administrator] WITH NAME = [ServerApp\Administrator]"
Result after exceute cmd above:
Msg 15401, Level 16, State 1, Server ServerDB\MSSQLTFS2018, Line 1
Windows NT user or group 'ServerApp\Administrator' not found. Check the name again.
You could login SSMS to check whether the account ServerApp\Administrator has been added to instance ServerDB\MSSQLTFS2018. Add it manually if it is not there:
Also, you could check the solutions in this blog to see whether it helps you:
https://stepbistep.net/2013/03/04/tf255507-the-security-identifier-sid-for-the-following-sql-server-login-conflicts-with-a-specified-domain-or-workgroup-account/
I try this way and it work.
On [ServerDB]
- I create user domain\tfsuser on MSSQL
On [ServerApp]
- I login with user domain\tfsuser and Reinstall TFS with user domain\tfsuser
Installation completed.
I have the following SQL Server 2017 container up and running as per -
https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
910d34ad3c3e microsoft/mssql-server-linux:2017-latest "/bin/sh -c /opt/m..." 11 minutes ago Up 11 minutes 0.0.0.0:1401->1433/tcp sql1
I can connect inside docker container with SQLCMD.
But I am not sure what to enter in SQL Operations Studio to get it to connect -
Soon as posted this, realised the port on the MAC side was on 1401 and not 1433 like in a lot of other examples I was reading.
Server Name should have been : 192.168.2.28,1401
Hope this helps someone else.