Monday, 24 December 2018

Install SQL Server 2019 preview CTP on Ubuntu Server 18.04

Pre-requisites

  • Ubuntu Server 18.04
  • Internet Connection to update the Ubuntu and Microsoft Packages 
  • If you are going for an offline install , you can download the packages from the link https://packages.microsoft.com/
  • Admin/root access to the user
I am using an Ubuntu Server version 18.04 with latest update patches and my host name is mssql2

Install and Configure SQLServer 2019

To configure SQL Server on Ubuntu, run the following commands in a terminal/putty to install the mssql-server package.

1.    Import the public repository GPG keys:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –



1       2.   Register the Microsoft SQL Server Ubuntu repository:




           3.   Run the following commands to install SQL Server:
                Run the below command to update the packages in the server
                   sudo apt-get update
                   sudo apt-get install -y mssql-server


After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition





































To Check the MSSQL-Server Service Status

sudo systemctl status mssql-server
















Install the SQL Server command-line tools

To create a database, you need to connect with a tool that can run Transact-SQL statements on the SQL Server. The following steps install the SQL Server command-line tools: 
Use the following steps to install the mssql-tools on Ubuntu.

1    1.  Import the public repository GPG keys.

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
1   
     2. Register the Microsoft Ubuntu repository.

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

1.     3. Update the sources list and run the installation command with the unixODBC developer package.
sudo apt-get update
sudo apt-get install mssql-tools unixodbc-dev



4.Set the .bash_profile on Linux envireonment 

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

source ~/.bashrc







 To check the MSSQL Processes

  ps -ef | grep mssql








To connect Sqlserver from SQLCMD utility 

sqlcmd -S mssql2 -U SA -P "Password"






















To connect SQLServer  from SQLServer Management Studio from outside






Done!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



Wednesday, 10 January 2018

%%Failed to Create Availability Group, SQL Server 2014 error 41042 encountered%%%

Failed to Create Availability Group, SQL Server 2014 error 41042        encountered


We were moving our SQL server boxes from one domain to another domain and after successful movement to the new domain, including windows cluster, Server's ,SQLServers, we have encountered the issues in Always on  availability group while recreating .

We had encountered the error SQL Server 2014 error 41042, Failed to Create  availability group

"Microsoft SQL Server, Error: 41042".


Below are the easy steps to resolve this issue 

Go to Windows Fail over Cluster Manager console  and “delete” the Resources/Listener which you are not able to create.





Then go the below Registry path for all servers where the Availability group exists.

“ HKEY_LOCAL_MACHINE\Cluster\HadrAgNameToldMap

                           Delete the entries  which are not able to create/failed 




Then re- run the wizard!!!!!!!!!!!!!!!!!!!!