How to start SQL Server 2017 on Linux in single user mode/ masteronly recovery mode? - sql-server-2017

How to start SQL Server 2017 on Linux in single user mode / masteronly recovery mode?
The scenario behind this question is we can move tempdb files to a new filesystem. What if I specify a wrong filesystem and restart SQL Server on linux. SQL Server will go down. In this case how to change tempdb location in system catalog?

If SQL Server is running, stop SQL Server:
sudo systemctl stop mssql-server
Switch to the user mssql. No password is required.
sudo su mssql
Start the SQL Server binary in single-user mode:
/opt/mssql/bin/sqlservr -m
Do whatever you need to do. When finished press CTRL-C
Start SQL Server:
sudo systemctl start mssql-server

Adding the -m flag when starting the process will enable single user mode.

Related

SQL Server 2012 installing replication without a server restart

I am looking to add replication to an existing instance of SQL Server 20212. I am running it as admin. When I select add new features and point it to the cd it says I must restart the server. Can I bypass the restart? The server is my production 24/7 machine. Can I add replication without restarting my server?

Changing a root password for SQL

So i am running a linux box as well as WindowsServer2008. Right now i am trying to install barnyard to work on my linux machine, but i am stuck at a part in the process where linux asks for my SQL root password. This may be a stupid question but I am having difficulty finding where i would go to change the password for the SQL account. Both the WS2008 server and the linux are near-fresh installs with little on them but snort and MSSQL respectively. Any help would be greatly appreciated. Thank You!!
This should do the work on Linux:
#Stop mysql service
service mysql stop (RHEL based OS)
service mysqld stop (Debian based OS)
#Start mysql in safe mode:
mysqld_safe --skip-grant-tables &
#Log into mysql as root (No password is required)
mysql -uroot
#Select "mysql" database (where we need to make changes)
use mysql;
#Reset Password mynewpassword should be changed with password you wish to have
update user set password=PASSWORD("mynewpassword") where User='root';
#Flush privileges
flush privileges;
#Quit from mysql
quit
#Restart mysql service as normal mode
service mysql restart (RHEL based OS)
service mysqld restart (Debian based OS)

Jenkins on unix executing script on windows server

I have a CI environment set up that build my project. It creates a set of sql server files, that i want to to send to my windows server. For that im looking into using scp, by installing copssh.
scp -r /file_in_unix/ user#windows_hostname:/cygdrive/c/
I want to execute a batch file on the windows server, but dont know how to do this?
any ideas?
Quite fast workaround is just to connect your Windows machine to Jenkins as another node. Your current unix job can trigger this job after successful execution.

Where is SQL Server Express service?

I've installed SQL Server 2012 Express advanced edition on a clean (just OS without any third-party soft) w7x64 residing on VirtualBox 4.1.18. I’ve chosen every needed option to install, but after installation there is no SQL Server Express service running on guest OS on virtual machine. Also I have the same edition of SQL Server installed on my host OS which is also w7x64. Please give me any clues to what may be the cause of this issue.
Steps to diagnose:
Check in Control Panel -> Services that the SQL service is running
Try to connect from the local machine, type osql -E -S localhost\sqlexpress in a command prompt.

SQL Server 2005 mixed mode authentication

just wondering is it possible to use mixed mode on sql server 2005 for user sa? I know how to do this in management studio but this isn't enough for user "sa". I think it needs done else where.
I am trying to connect to the database via a console app but keep getting the error "The account is disabled"
Cheers
Louis
Yes
http://msdn.microsoft.com/en-us/library/ms144284(v=SQL.90).aspx
How to:
http://msdn.microsoft.com/en-us/library/ms188670(v=SQL.90).aspx
If you didn't enable Mixed Mode Authentication during setup then you will need to do so in server properties > Security (you can use Management Studio - see above link). You will also need to enable the sa login and set an appropriate password.
Be sure to restart the SQL Service after changing the authentication mode for the changes to take effect.
If you are using SQL Express 2005 or you do not have SQL Server Management Studio installed you will need to update a registry key to enable Mixed Mode Authentication:
Open registry editor (launch
application %WINDIR%\regedit.exe) and
go to
HKLM\Software\Microsoft\Microsoft SQL
Server\MSSQL.1\MSSQLServer in the tree
on the left.
On the right, look for an entry named
LoginMode. The default value, when
installed is 1. Update it to 2. The
next step is to restart the service.
Launch your Service Manager (Start ->
Run -> Type services.msc) and look for
a service named MSSQL Server
(SQLEXPRESS). Restart the service.
Once the SQL Server service is restarted you then need to enable the sa account. Use the OSQL command line tool from an Administrator Command Prompt:
osql -E -S .\SQLEXPRESS
ALTER LOGIN sa ENABLE ;
GO
ALTER LOGIN sa WITH PASSWORD = '<password>' ;
GO
You should then be able to test the login using:
osql -U sa -S .\SQLEXPRESS
If you SQL Server is already configured for Mixed Mode Authentication, then you just need to enable the sa user. You can find it in the Security->Logins folder.