I have an asp.net core that connects to a SQL Server. When I run it in docker on my local computer everything works as expected, but when run the docker image on a linux server (centos 8) i get a network error when trying to connect to the database. I don't know what to do, since I used the actual server's ip in the connection string and it still does not work.
Thank you a lot
You should configure the firewall correct and watch if SELinux is blocking you in some way.
Just to speed up your testing, try after these commands:
sudo su -
systemctl disable firewalld
setenforce 0
I want to launch my minecraft server on SSH on WSL (Ubuntu 18.04) on Windows.
The way I plan to do it with a phone or something: Connect to vpn, then ssh into windows, then type wsl (works fine), and finally open a session (for example screen) and launch the script for the minecraft server in there.
The problem is, when I finally get into launching the script and detaching the screen and close the ssh connection, the screen will close after some time automatically.
WSL says it was terminated. I dont know what to do.
I should also add that the script should run permanently.
The mc server is running on java and constantly gives output. So I want it to be available all the time.
linuxgsm.com is a Server manager that is also available for minecraft, it uses tmux and is a perfect alternative with many other features.
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
I was able to login to sqlplus with my credentials to do the SHUTDOWN command. It worked and the database shutdown. But now when I try to login again with the same credentials to start the server back up, it says: "ORA-01033: ORACLE initialization or shutdown in progress". How can I log in to sqlplus and use the STARTUP command?
This is on Linux Debian - Oracle 12C.
EDIT: I shutdown the database to import a copy of old oradata contents.
Login with operating system credentials that don't require the database to be open:
C:\>sqlplus / as sysdba
If things are really messed up you might need to connect using the prelim option:
C:\> sqlplus -prelim / as sysdba
If the database is hung and not shutting down properly sometimes you need to do a shutdown abort and then start it back up:
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
This is also possible with the srvctl command but in my experience it's not as reliable as a SQL*Plus shutdown abort.
Part of my job involves data collection to help size workloads that could be transferred to the cloud. An element of this is being able to enumerate SQL instances within a client's environment for insights such as "hey you have some out of support legacy SQL here that was supposed to be decommed years ago, what's the deal."
With the release of SQL Server 2017, I've just now created an instance of the SQL Server Enterprise 2017 on Linux container (using this image) that I'm running locally on Windows 10. I can connect to the instance via SSMS and SELECT ##VERSION to confirm it's legit, but my question is if it is possible to inventory the device and find the SQL instance without knowing that connection string.
Things I've tried:
-Running on Windows 10 so I believe this is supported via Hyper-V, when I try to go through the Hyper-V manager to connect to the VM Docker spun up, can't get any interface there (which I figured, since Docker emulates apps rather than full VMs)
-Tried to do a sqlcmd -L from the Win10 host device and don't see the instance (Don't have SQL installed on the Windows 10 device I'm running this from)
-I can find the docker image via a docker ps, then exec -it to bash, and use sqlcmd from there, but the sqlcmd -L isn't listed as an option within Linux.
-ipconfig from the host device shows the Docker IP address, but it wouldn't give me the port information so I would have to scan through all the ports which feels dirty.
I'm kind of at a loss at this point. If I didn't explicitly know a Docker container was running MSSQL-Linux, is there any way I could identify that from inventorying the host device? (sorry for the long post)
After banging my head on it for a bit I've found a painful workaround of:
connect to the container's bash using: docker exec -it <container_name> "bash"
then using ps aux | grep sql to list all of the sql processes. The MS image shows up as /opt/mssql/bin/sqlservr from local testing. Once SQL has been identified you can attempt to connect to it using the Docker ip from ipconfig and the port from docker ps
It's not elegant, but it should be possible to automate those steps for use across a set of unknown devices.
Leaving this open for a bit for any better alternatives.