Is there a service for the Linux SQL Server vNext Agent?

As at CTP 1.4, there doesn’t appear to be one visible in Linux.
 
image1
Currently the Agent appears to be tied into the SQL Server service with no separate options for stop/start/restart.
 
Interestingly, in the screen shot you can see that on this server the Agent is running under the machine account vnextvm\vnextvm$. Only SQL accounts are currently supported at this stage.

RDP to Linux VM

You wouldn’t typically have a default desktop on a Linux Production SQL server.
 
Linux offers many different desktops and newer versions of Ubuntu e.g. 16.10, allow copy/paste and folder access between the Windows host and Linux server.
 
Allow RDP TCP port 3389 using either

sudo ufw allow in 3389/tcp

or
image1
Next add xrdp and the desktop. At this point in time the Ubuntu Unity desktop shown above is not easily available to install.

sudo apt-get install -y xrdp
sudo apt-get install -y mate-core mate-desktop-environment mate-notification-daemon

Update /etc/xrdp/startwm.sh by adding mate-session. I used gksu nautilus to locate and edit the file.
image2
You should now be able to RDP.
image3

Adding SQL Server Agent to Linux

With the release of SQL Server vNext CTP 1.4 you can now add the SQL Server Agent using the following on Ubuntu:
 

sudo apt-get update 
sudo apt-get install mssql-server-agent
sudo systemctl restart mssql-server

 
Interestingly once installed, the SQL Server Agent refused to start, even after a restart and the latest SSMS showed the SQL Server Agent as inaccessible.
 
image1
Running the below allowed me to access the SQL Server Agent in SSMS but the Agent still doesn’t start.

sp_configure 'show advanced options','1'
RECONFIGURE
GO
sp_configure 'Agent XPs','1'
RECONFIGURE
GO
sp_configure 'show advanced options','0'
RECONFIGURE
GO

 
Update: Not having much luck I suspected the issue may be that the server name was more than 15 characters. This is currently a reported issue by Microsoft. Starting over, I created a new VM called vnextvm and the agent installed and started this time with no issues.
 
image2

Are you ready to support SQL Server on Linux?

If you’ve been a SQL Server DBA for the past 5,10,15 years then your exposure to Linux has likely been minimum or even non-existent.
 
Consider some of the typical methods you’d use/check when investigating a SQL Server that is no-longer responding:
 

Windows Linux
Connect using RDP
Services
Locate and view SQL Errorlogs
Windows Event Logs
SQL Server Configuration Manager
Disk Management
Device Manager
Task Manager
Registry
Firewall
Performance Monitor
Local Policies
Local Security
Folder/File Permissions
Patches

 
In the Linux column, would you know the corresponding tool?
 
It’s just a matter of time before a vendor/project/Manager hands over a SQL Server on Linux for you to support and at the end of the day when there is an issue with SQL it’ll likely end up in your lap.
 
So now, is a really good time to start getting up to speed with Linux support.

Reviewing Linux files via GUI on Ubuntu

On Linux the SQL Server vNext files are stored under C:\var\opt\mssql and you may not be able to view/access them due to lack of permissions.
 
From a terminal prompt run the following:

  • sudo apt install gksu
  • gksu nautilus

 
You will now be able to search the folders and view things like the errorlog using gedit:
image1

Installing SQL Server vNext on Ubuntu using Hyper-V

The following steps were used to create a test Hyper-V virtual machine (VM) with SQL Server vNext on Ubuntu 16.04.2 TLS Desktop.
 
Prerequisites:

  • Create a Generation 1 VM
  • Ensure the VM has at least 3.25GB of memory allocated or the install of SQL Server vNext will fail
  • Ensure the VM has an internet connection
  • Download and add the ubuntu-16.04.2-desktop-amd64.iso from https://www.ubuntu.com/download/desktop to the VM as a DVD
  • Start the VM

After the install of Ubuntu you may get a message to remove the Ubuntu media. Simply turning off/on the VM should resolve this.
 
Here were the commands to install SQL Server vNext:
 

sudo apt install curl

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-server.list

sudo apt-get update

sudo apt-get install -y mssql-server

sudo /opt/mssql/bin/mssql-conf setup

systemctl status mssql-server

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

sudo apt-get update

sudo apt-get install mssql-tools

sudo ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd

sqlcmd -S localhost -U sa -P '$trongPa55'

AKAWN_vNext_Ubuntu

Function sys.dm_os_enumerate_filesystem

While reviewing SQL Server vNext I came across the sys.dm_os_enumerate_filesystem function.
 
The function takes the following 2 parameters

  • @initial_directory nvarchar(255)
  • @search_pattern nvarchar(255)

It appears to be extremely powerful and currently outputs the following columns:

  • full_filesystem_path
  • parent_directory
  • file_or_directory_name
  • level
  • is_directory
  • is_read_only
  • is_system
  • is_hidden
  • has_integrity_stream
  • is_temporary
  • is_sparse
  • creation_time
  • last_access_time
  • last_write_time
  • size_in_bytes

Below is sample extract when using
SELECT * FROM sys.dm_os_enumerate_filesystem('c:\','*')

image1

The command doesn’t appear to work 100% at this stage on Linux. I received the following info and then it errored:
image2

Msg 3634, Level 16, State 1, Line 7
The operating system returned the error '0x80070002(The system cannot find the file specified.)' while attempting 'GetNextStream' on '(null)'.

image3