I installed SQL Server 2019 Docker container by referring to https://learn.microsoft.com/en-us/sql/linux/tutorial-restore-backup-in-sql-server-container?view=sql-server-linux-ver15. After the installation, I need to enable change data capture, so I tried to set sqlagent enabled in the container with the command:
/opt/mssql/bin/mssql-conf set sqlagent.enabled true
But I got a warning:
Warning: could not create log file for mssql-conf at /var/opt/mssql/log/mssql-conf/mssql-conf.log.
This program must be run as superuser or as a user with membership in the SQL Server.
And when I opened the config file /etc/ld.so.conf.d/mssql.conf, I couldn't find the relative config.
# mssql libs
/opt/mssql/lib
When I entered whoami , the result is
mssql
When I entered top , the result is
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9 mssql 20 0 10.0g 680964 20764 S 17.3 8.5 26:38.68 sqlservr
1 mssql 20 0 57016 8516 1308 S 0.0 0.1 0:00.87 sqlservr
I'm wondering why sqlsgent.enabled ended with the warning.
Related
The environment is a single machine trying to connect to SQL Server 2019 in a Docker image (mcr.microsoft.com/mssql/server:2019-latest). The first time I tried this was with this tutorial:
tomssl and the connection using SSMS worked. But I need SQL Server 2019, so I tried the 2019-latest image, and the connection closed issue is now permanent.
If I remove the port number then the password error appears.
The docker image:
docker pull mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04
The run command from docker:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Simp$on9432' -p 1405:1433 --name sql19-25 -v D:\Docker:/sql -d mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04 sleep infinity
The sleep infinity was added to keep the image running.
I have tried to do the 2017 version again, but the same error appears.
The command was run in PowerShell 7.1.0.
OS Name Microsoft Windows 10 Pro, version 10.0.19042 Build 19042
Docker version 20.10.0, build 7287ab3
WSL 2 installed
Storage Driver: overlay2
Through SSMS (v18.8), I can connect to SQLEXPRESS. Also I have tried stopping the SQLEXPRESS, but still get the same error message.
Suggestions?
I am using below batch command for ExpressMaint. I know it has worked with a Windows account.
When I disable the Windows account on the SQL Server instance, it doesn't work correctly.
D:\ExpressMaint\ExpressMaint.exe -S . -D TEST -T CHECKDB -R D:\ExpressMaint\Report -RU WEEKS -RV 4
I get this message
Failed to connect to server ..
Login failed for user 'DPY\gw.lee'. Reason: The account is disabled.
ExpressMaint finished unsuccessfully at 2020-03-09 오후 3:47:32 with Return Code(-3)
Can I have option for specifying ID/PW of SQL Server instance?
My Docker linux SQL Server is not working today at my machine.
I am not sure if this is firewall (I have off them all), or Docker settings (as I just upgraded to the latest Docker version), or a Docker SQL Server issue (but this was working fine on the same machine earlier).
Could anyone help?
I have tried using bash,
/opt/mssql-tools/bin/sqlcmd -S localhost,8010 -U SA -P Test123!
Error:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
The docker compose file
version: '3'
services:
mssql:
network_mode: lsvc
image: microsoft/mssql-server-linux:2017-latest
container_name: mssql
hostname: mssql
volumes:
- ./.db:/var/opt/mssql/
- /var/opt/mssql/data
- ./sqlinit.sql:/scripts/sqlinit.sql
ports:
- 8010:1433
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=Test123!
command:
- /bin/bash
- -c
- |
# Launch MSSQL and send to background
/opt/mssql/bin/sqlservr &
# Wait for it to be available
echo "Waiting for MS SQL to be available"
/opt/mssql-tools/bin/sqlcmd -l 30 -S mssql -h-1 -V1 -U sa -P Test123! -Q "SET NOCOUNT ON SELECT \"YAY WE ARE UP\" , ##servername"
is_up=$$?
while [ $$is_up -ne 0 ] ; do
echo -e $$(date)
/opt/mssql-tools/bin/sqlcmd -l 30 -S mssql -h-1 -V1 -U sa -P Test123! -Q "SET NOCOUNT ON SELECT \"YAY WE ARE UP\" , ##servername"
is_up=$$?
sleep 1
done
# Run every script in /scripts
# TODO set a flag so that this is only done once on creation,
# and not every time the container runs
#for foo in /scripts/*.sql
/opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P Test123! -l 30 -e -i /scripts/sqlinit.sql
#done
# So that the container doesn't shut down, sleep this thread
sleep infinity
I would suspect that the mssql instance had failed to start.
Looking at your docker file when the server fail to start it runs into in infinite loop. I would advice you to limit the number of retries on the loop so you will have an indication that the server is failing on startup.
Or better consider the use of the HEALTHCHECK option and not the loop script
see https://blog.couchbase.com/docker-health-check-keeping-containers-healthy/
To troubleshooting the problem try
docker logs <mssql-container-id>
if this doesn't provide enough information try connecting to the container as this was a simple machine.
docker exec -it <mssql-container-id> bash
Look for errors in /var/opt/mssql/log/errorlog
See https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-troubleshooting-guide?view=sql-server-ver15
i found the root cause, it is not due to docker mssql linux
but the latest Docker Desktop Community 2.2.0.0
after uninstall it then downgrade to old version, Docker Desktop Community 2.1.0.5.
it is working now, connect to mssql success.
not sure what is new in latest docker desktop, anyway...i will use old version now.
also one important point to take note, the ".db" folder (windows path where the yml file reside), must deleted before build the docker image.
This is my first time trying to setup mssql server under linux server.
This is my error
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed.
The login is from an untrusted domain and cannot be used with
Integrated authentication..
I could login using "sa" and password
Once I use sqlcmd -E -S linuxsqlserver or sqlcmd -S linuxsqlserver I received the error above.
I followed 2 guide in the link
https://www.mssqltips.com/sqlservertip/5075/configure-sql-server-on-linux-to-use-windows-authentication/
https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-active-directory-authentication?view=sql-server-2017
My current system
Ubuntu 18.04
MSSQL
Window Server 2016
AD
What I have done:
join domain (the domain name is Test1)
Creating the Service Principal Name
setspn -a MSSQLSvc/linuxsqlserver.TEST1.COM:1433 sqllinux
Creating the Keytab File for the SQL Server Service
kinit sqllinux#TEST1.COM
kvno MSSQLSvc/linuxsqlserver.TEST1.COM:1433#TEST1.COM (returned 2)
sudo ktutil
addent -password -p MSSQLSvc/linuxsqlserver.Test1.COM:1433#Test1.COM -k 2 -e aes256-cts-hmac-sha1-96
addent -password -p MSSQLSvc/linuxsqlserver.Test1.COM:1433#Test1.COM -k 2 -e rc4-hmac
wkt /var/opt/mssql/secrets/mssql.keytab
quit
Setting up Active Directory Authentication for SQL Server
/opt/mssql/bin/mssql-conf set network.kerberoskeytabfile /var/opt/mssql/secrets/mssql.keytab
systemctl restart mssql-server
Thank you in advance.
I installed postgres on Mac OS X 10.6.x.
When I ran for postgres database version:
psql --versionpsql (PostgreSQL) 9.1.1
contains support for command-line editing
When I checked for the version of the server:
psql -c "select version();" version
--------------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.0.5 on x86_64-apple-darwin10.8.0, compiled by GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3), 64-bit
(1 row)
So when I run
bash-3.2$ psql
psql (9.1.1, server 9.0.5)
WARNING: psql version 9.1, server version 9.0.
Some psql features might not work.
I am not sure what those features are. These versions are conflicting. I am new to using postgres so I dont know how to upgrade just the postgres server. I tried to search for something online but did not find much help. I don't want to uninstall and reinstall postgres. Is there anyway I could use them both together without them conflicting? Or just upgrade the server to the same version as database?
Edit:
which psql
/opt/local/lib/postgresql91/bin//psql
which postgres
/opt/local/lib/postgresql91/bin//postgres
ps -eaf|grep postgres
0 60 1 0 0:00.07 ?? 0:00.09 /opt/local/bin/daemondo --label=postgresql90-server --start-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql90-server/postgresql90-server.wrapper restart ; --pid=none
103 3971 3967 0 0:00.69 ?? 0:01.17 postgres: writer process
103 3972 3967 0 0:00.67 ?? 0:00.88 postgres: wal writer process
103 3973 3967 0 0:00.18 ?? 0:00.23 postgres: autovacuum launcher process
103 3974 3967 0 0:00.19 ?? 0:00.21 postgres: stats collector process
0 3616 2726 0 0:00.04 ttys000 0:00.06 su postgres
103 3967 3619 0 0:00.23 ttys000 0:00.34 postgres -D /usr/local/pgsql/data
0 4559 4055 0 0:00.03 ttys001 0:00.05 su postgres
103 5922 4560 0 0:00.01 ttys001 0:00.01 grep postgres
Thank you.
I suppose that you've already had PostgreSQL installed before. Please, confirm this, 'cos in this case you will have to upgrade your database. This is important step, it is not possible to just upgrade the software.
Please, try stopping currently running server. First, check the source of currently running PostgreSQL:
sudo launchctl list | grep -Ei "macports|postgres"
Then perform:
sudo launchctl unload -w <OldPostgreSQL.plist>
and start a new server like this:
sudo launchctl load -w <NewPostgreSQL.plist>
I would expect new plist to be /Library/LaunchDaemons/org.macports.postgresql91-server.plist.
In case you need to upgrade:
Make sure you do a full dump of the database first with the new version of pg_dump.
Execute new version of the initdb in the new PGDATA folder.
Start a new server as outlined above.
Upload the full dump.
Here's a small description I've came across on the subject. And this is the official PostgreSQL documentation on upgrading between major releases.
Mine was a homebrew install and here's what I did (brought me to a functioning psql with no version issues) -- I'm trying to install KyngChaos's mac build of postgresql
step 0 (already did):
brew uninstall postgresql
step1
which psql
=> "locationpath" (in my case, /usr/bin/psql)
sudo rm "locationpath"
step2
#inside ~/.bash_profile
export PATH=/usr/local/pgsql-9.3/bin:$PATH
step3
psql
#works
This may happen if you already had a version of PostgreSQL before new installation.
Since you have two versions of PostgreSQL, you need two versions of psql. Basically, now when you type psql, your system may not be certain to which version of database you are trying to connect.
Remove the previous version. Or install new psql along with new version of the server.