Thursday, January 24, 2019

Linux basic commands for SQL SERVER DBA's

Linux basic commands for SQL SERVER DBA's


As Microsoft started supporting SQL SERVER on other operating systems like  Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), and Ubuntu.
 As a SQL SERVER DBA we must know some basics of to support other operating systems. 

Sudo -  

superuser do or switch user do. it allows a user with proper permissions to execute a command as another user, such as super user.

It is same like as our Run as administrator in windows level. or Local Admin to the box.

Example Sudo "username "

sudo -V | -h | -l | -L | -v | -k | -K | -s | [ -H ] [-P ] [-S ] [ -b ] | 
     [ -p prompt ] [ -c class|- ] [ -a auth_type ] [-r role ] [-t type ] 
     [ -u username|#uid ] command


Curl 

Curl is a free and open command line tool for transferring files on protocols like Http, Https,FTP,FTPS, SCP, SFT, LDAT, or File. 

You can refer the url
https://curl.haxx.se/


Yum 

Yum stands for "Yellodog Updater Modified". It is an interactive rpm-based package Manager. It can automatically perform system updates,including dependency analysis and obsolete processing based on "repository" Medadata. 


yum [options] [command] [package ...]





SQL SERVER 2017 Installation on Red Hat Linux Environment

SQL SERVER 2017 Installation on  Red Hat Linux Environment

To work with Microsoft Virtual Labs - Visit - https://www.microsoft.com/handsonlabs/selfpacedlabs


SQL server 2017 Installation can be performed with 5 easy steps. 

1. Download the SQL SERVER Package.
2. Install the SQL SERVER Package. 
3. Configure SQL server
4.  Install SQL SERVER Client Tools.
5.  To configure the Environment Variables. 

Steps to Install SQL SERVER 2017 
  1. Download Microsoft SQL Server 2017 Red Hat repository configuration file

sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
 for SQL SERVER 2019 download Run the following command.

sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/


2. To Install SQL SERVER 2017 run the following command. 


sudo yum install -y mssql-server

3. Configure SQL server, run the following Command.


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

4. Download and Installation of SQL SERVER Client tools.

downloading Client tools

sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo


Installation of Client tools.

sudo yum install -y mssql-tools unixODBC-devel

5. Setting up the environment variables.

 

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

source ~/.bashrc

To create  Database on Linux environment. 
  1. To connect to SQL Server, type the following command, and then press Enter:

sqlcmd -S localhost -U sa -P 'Password'

  1. Type the following command, and then press Enter:
CREATE DATABASE Worldwide1

To Check the Version of the Server. 




All Database Sizes in SQL SERVER

DB sizes  SELECT d.name, (ROUND(SUM(cast(mf.size as bigint)) * 8 / 1024, 0))/1024 Size_GB FROM sys.master_files mf ...