Technical posts/MS-SQL

[Preparing DBMS Benchmark] Install SQL Server 14.0.900.75-1 on CentOS 7.2

ODB 2017. 8. 4. 10:52

[Preparing DBMS Benchmark] Install SQL Server 14.0.900.75-1 on CentOS 7.2

두번째 설치이다


https://docs.microsoft.com/ko-kr/sql/linux/sql-server-linux-setup

https://docs.microsoft.com/ko-kr/sql/linux/quickstart-install-connect-red-hat


쉽다 빨리 설치하자..


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


sudo yum update 

sudo yum install -y mssql-server


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


systemctl status mssql-server



Step 1. curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server.repo


[root@localhost ~]# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/ 

7/mssql-server.repo

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed


  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0

  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0

100   220  100   220    0     0     67      0  0:00:03  0:00:03 --:--:--    67

100   220  100   220    0     0     67      0  0:00:03  0:00:03 --:--:--    67 


Step 2. yum update


[root@localhost ~]# yum update

Loaded plugins: fastestmirror


packages-microsoft-com-mssql-server                                                     | 2.9 kB  00:00:00     


packages-microsoft-com-mssql-server/prima 0% [                               ]  0.0 B/s |    0 B  --:--:-- ETA 


packages-microsoft-com-mssql-server/primary_db                                          |  12 kB  00:00:03     

Loading mirror speeds from cached hostfile

 * base: mirror.xnet.co.nz

 * extras: mirror.xnet.co.nz

 * updates: mirror.xnet.co.nz

Resolving Dependencies

--> Running transaction check

---> Package NetworkManager.x86_64 1:1.4.0-12.el7 will be updated

---> Package NetworkManager.x86_64 1:1.4.0-20.el7_3 will be an update

---> Package NetworkManager-libnm.x86_64 1:1.4.0-12.el7 will be updated

---> Package NetworkManager-libnm.x86_64 1:1.4.0-20.el7_3 w

...

...

  nspr.x86_64 0:4.13.1-1.0.el7_3                         nss.x86_64 0:3.28.4-1.2.el7_3                         

  nss-sysinit.x86_64 0:3.28.4-1.2.el7_3                  nss-tools.x86_64 0:3.28.4-1.2.el7_3                   

  nss-util.x86_64 0:3.28.4-1.0.el7_3                     open-vm-tools.x86_64 0:10.0.5-4.el7_3                 

  open-vm-tools-desktop.x86_64 0:10.0.5-4.el7_3          openssh.x86_64 0:6.6.1p1-35.el7_3                     

  openssh-clients.x86_64 0:6.6.1p1-35.el7_3              openssh-server.x86_64 0:6.6.1p1-35.el7_3              

  openssl.x86_64 1:1.0.1e-60.el7_3.1                     openssl-libs.x86_64 1:1.0.1e-60.el7_3.1               

  policycoreutils.x86_64 0:2.5-11.el7_3                  polkit.x86_64 0:0.112-12.el7_3                        

  python-firewall.noarch 0:0.4.3.2-8.1.el7_3.3           python-perf.x86_64 0:3.10.0-514.26.2.el7              

  rdma.noarch 0:7.3_4.7_rc2-6.el7_3                      selinux-policy.noarch 0:3.13.1-102.el7_3.16           

  selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.16   sudo.x86_64 0:1.8.6p7-23.el7_3                        

  systemd.x86_64 0:219-30.el7_3.9                        systemd-libs.x86_64 0:219-30.el7_3.9                  

  systemd-sysv.x86_64 0:219-30.el7_3.9                   tuned.noarch 0:2.7.1-3.el7_3.2                        

  tzdata.noarch 0:2017b-1.el7                            util-linux.x86_64 0:2.23.2-33.el7_3.2                 

  vim-minimal.x86_64 2:7.4.160-1.el7_3.1                 wpa_supplicant.x86_64 1:2.0-21.el7_3                  

  xfsprogs.x86_64 0:4.5.0-10.el7_3                      


Complete!

[root@localhost ~]# 



Step 3. yum install -y mssql-server


[root@localhost ~]# yum install -y mssql-server

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirror.xnet.co.nz

 * extras: mirror.xnet.co.nz

 * updates: mirror.xnet.co.nz

Resolving Dependencies

--> Running transaction check

---> Package mssql-server.x86_64 0:14.0.900.75-1 will be installed

--> Processing Dependency: bzip2 for package: mssql-server-14.0.900.75-1.x86_64

--> Processing Dependency: gdb for package: mssql-server-14.0.900.75-1.x86_64

--> Processing Dependency: libsss_nss_idmap for  

...

...

  Verifying  : gdb-7.6.1-94.el7.x86_64                                                                     2/4 

  Verifying  : libsss_nss_idmap-1.14.0-43.el7_3.18.x86_64                                                  3/4 

  Verifying  : bzip2-1.0.6-13.el7.x86_64                                                                   4/4 


Installed:

  mssql-server.x86_64 0:14.0.900.75-1                                                                          


Dependency Installed:

  bzip2.x86_64 0:1.0.6-13.el7    gdb.x86_64 0:7.6.1-94.el7    libsss_nss_idmap.x86_64 0:1.14.0-43.el7_3.18   


Complete!



Step 4. /opt/mssql/bin/mssql-conf setup


[root@localhost ~]# /opt/mssql/bin/mssql-conf setup

The license terms for this product can be found in

/usr/share/doc/mssql-server or downloaded from:

https://go.microsoft.com/fwlink/?LinkId=852741&clcid=0x409


The privacy statement can be viewed at:

https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409


Do you accept the license terms? [Yes/No]:yes


Choose an edition of SQL Server:

  1) Evaluation (free, no production use rights, 180-day limit)

  2) Developer (free, no production use rights)

  3) Express (free)

  4) Web (PAID)

  5) Standard (PAID)

  6) Enterprise (PAID)

  7) I bought a license through a retail sales channel and have a product key to enter.


Details about editions can be found at

https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x409


Use of PAID editions of this software requires separate licensing through a

Microsoft Volume Licensing program.

By choosing a PAID edition, you are verifying that you have the appropriate

number of licenses in place to install and run this software.


Enter your edition(1-7): 3

Enter the SQL Server system administrator password: 

Confirm the SQL Server system administrator password: 

Configuring SQL Server...


This is an evaluation version.  There are [173] days left in the evaluation period.

The licensing PID was successfully processed. The new edition is [Express Edition].


Setup has completed successfully. SQL Server is now starting.


Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.

Setup has completed successfully. SQL Server is now starting.

[root@localhost ~]# /opt/mssql/bin/mssql-conf setup

The license terms for this product can be found in

/usr/share/doc/mssql-server or downloaded from:

https://go.microsoft.com/fwlink/?LinkId=852741&clcid=0x409


The privacy statement can be viewed at:

https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409


An instance of SQL Server is running. Please stop the SQL Server service

using the following command


    sudo systemctl stop mssql-server

[root@localhost ~]# systemctl stop mssql-server




Step 5. systemctl status mssql-server


[root@localhost ~]# systemctl status mssql-server

?? mssql-server.service - Microsoft SQL Server Database Engine

   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)

   Active: active (running) since Thu 2017-08-03 21:02:34 EDT; 7min ago

     Docs: https://docs.microsoft.com/en-us/sql/linux

 Main PID: 998 (sqlservr)

   CGroup: /system.slice/mssql-server.service

           ???€ 998 /opt/mssql/bin/sqlservr

           ???€3752 /opt/mssql/bin/sqlservr


Aug 03 21:02:47 localhost.localdomain sqlservr[998]: 2017-08-03 21:02:47.05 spid18s     SQL Server is now ready for client connections. This is an informational message; no user action is required.

Aug 03 21:02:47 localhost.localdomain sqlservr[998]: 2017-08-03 21:02:47.22 spid11s     Polybase feature disabled.

Aug 03 21:02:47 localhost.localdomain sqlservr[998]: 2017-08-03 21:02:47.22 spid11s     Clearing tempdb database.

Aug 03 21:02:48 localhost.localdomain sqlservr[998]: 2017-08-03 21:02:48.07 spid11s     Starting up database 'tempdb'.

Aug 03 21:02:48 localhost.localdomain sqlservr[998]: 2017-08-03 21:02:48.29 spid21s     The Service Broker endpoint is in disabled or stopped state.

Aug 03 21:02:48 localhost.localdomain sqlservr[998]: 2017-08-03 21:02:48.29 spid21s     The Database Mirroring endpoint is in disabled or stopped state.

Aug 03 21:02:48 localhost.localdomain sqlservr[998]: 2017-08-03 21:02:48.30 spid21s     Service Broker manager has started.

Aug 03 21:02:48 localhost.localdomain sqlservr[998]: 2017-08-03 21:02:48.32 spid4s      Recovery is complete. This is an informational message only. No user action is required.

Aug 03 21:08:12 localhost.localdomain sqlservr[998]: 2017-08-03 21:08:12.86 spid51      Attempting to load library 'xplog70.dll' into memory. This is an informational message only. No user action is required.

Aug 03 21:08:12 localhost.localdomain sqlservr[998]: 2017-08-03 21:08:12.89 spid51      Using 'xplog70.dll' version '2017.140.900' to execute extended stored procedure 'xp_msver'. This is an informational message only...ion is required.

Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost ~]#  


Step 6. yum install mssql-tools unixODBC-devel


[root@localhost bin]# curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   193  100   193    0     0     61      0  0:00:03  0:00:03 --:--:--    61

[root@localhost bin]# yum install mssql-tools unixODBC-devel

Loaded plugins: fastestmirror

base                                                                                                                                                                                                                 | 3.6 kB  00:00:00     

extras                                                                                                                                                                                                               | 3.4 kB  00:00:00     

packages-microsoft-com-mssql-server                                                                                                                                                                                  | 2.9 kB  00:00:00     

packages-microsoft-com-prod                                                                                                                                                                                          | 2.9 kB  00:00:00     

updates                                                                                                                                                                                                              | 3.4 kB  00:00:00     

packages-microsoft-com-prod/primary_db                                                                                                                                                                               |  22 kB  00:00:03     

Loading mirror speeds from cached hostfile

 * base: mirror.xnet.co.nz

 * extras: mirror.xnet.co.nz

 * updates: mirror.xnet.co.nz

Package unixODBC-devel-2.3.1-11.el7.x86_64 already installed and latest version

Resolving Dependencies

--> Running transaction check

---> Package mssql-tools.x86_64 0:14.0.6.0-1 will be installed

--> Processing Dependency: msodbcsql < 13.2.0.0 for package: mssql-tools-14.0.6.0-1.x86_64

--> Processing Dependency: msodbcsql >= 13.1.0.0 for package: mssql-tools-14.0.6.0-1.x86_64

--> Running transaction check

---> Package msodbcsql.x86_64 0:13.1.9.0-1 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


============================================================================================================================================================================================================================================

 Package                                               Arch                                             Version                                                 Repository                                                             Size

============================================================================================================================================================================================================================================

Installing:

 mssql-tools                                           x86_64                                           14.0.6.0-1                                              packages-microsoft-com-prod                                           249 k

Installing for dependencies:

 msodbcsql                                             x86_64                                           13.1.9.0-1                                              packages-microsoft-com-prod                                           4.0 M


Transaction Summary

============================================================================================================================================================================================================================================

Install  1 Package (+1 Dependent package)


Total download size: 4.2 M

Installed size: 4.2 M

Is this ok [y/d/N]: y

Downloading packages:

(1/2): mssql-tools-14.0.6.0-1.x86_64.rpm                                                                                                                                                                             | 249 kB  00:00:03     

(2/2): msodbcsql-13.1.9.0-1.x86_64.rpm                                                                                                                                                                               | 4.0 MB  00:00:06     

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                                                                       657 kB/s | 4.2 MB  00:00:06     

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

The license terms for this product can be downloaded from

https://aka.ms/odbc131eula and found in

/usr/share/doc/msodbcsql/LICENSE.TXT . By entering 'YES',

you indicate that you accept the license terms.


Do you accept the license terms? (Enter YES or NO)

yes

Please enter YES or NO

Do you accept the license terms? (Enter YES or NO)

YES

  Installing : msodbcsql-13.1.9.0-1.x86_64                                                                                                                                                                                              1/2 

The license terms for this product can be downloaded from

http://go.microsoft.com/fwlink/?LinkId=746949 and found in

/usr/share/doc/mssql-tools/LICENSE.txt . By entering 'YES',

you indicate that you accept the license terms.


Do you accept the license terms? (Enter YES or NO)

YES

  Installing : mssql-tools-14.0.6.0-1.x86_64                                                                                                                                                                                            2/2 

  Verifying  : mssql-tools-14.0.6.0-1.x86_64                                                                                                                                                                                            1/2 

  Verifying  : msodbcsql-13.1.9.0-1.x86_64                                                                                                                                                                                              2/2 


Installed:

  mssql-tools.x86_64 0:14.0.6.0-1                                                                                                                                                                                                           


Dependency Installed:

  msodbcsql.x86_64 0:13.1.9.0-1                                                                                                                                                                                                             


Complete!



Step 7. sqlcmd PATH 설정


[root@localhost opt]# ls

microsoft  mssql  mssql-tools

[root@localhost opt]# cd mssql-tools

[root@localhost mssql-tools]# ls

bin  share

[root@localhost mssql-tools]# cd bin

[root@localhost bin]# ls

bcp  sqlcmd

[root@localhost bin]# pwd

/opt/mssql-tools/bin

[root@localhost ~]# vi .bash_profile

# .bash_profile


# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi


# User specific environment and startup programs


PATH=$PATH:$HOME/bin:/opt/mssql-tools/bin:


export PATH

[root@localhost ~]# . ./.bash_profile 

[root@localhost ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/opt/mssql-tools/bin:



Step 8. 접속 및 확인


[root@localhost ~]# sqlcmd -Usa -p

Password: 

1> sp_helpdb

2> go

name                                                                                                                             db_size       owner                                                                                                                            dbid   created     status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   compatibility_level

-------------------------------------------------------------------------------------------------------------------------------- ------------- -------------------------------------------------------------------------------------------------------------------------------- ------ ----------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------

master                                                                                                                                 6.00 MB sa                                                                                                                                    1 Apr  8 2003 Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=869, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAutoCreateStatistics, IsAutoUpdateStatistics                                                                                                                                                                                                                                                                                                                                                                                                                                    140

model                                                                                                                                 16.00 MB sa                                                                                                                                    3 Apr  8 2003 Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=FULL, Version=869, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAutoCreateStatistics, IsAutoUpdateStatistics                                                                                                                                                                                                                                                                                                                                                                                                                                      140

msdb                                                                                                                                  14.06 MB sa                                                                                                                                    4 Jul 27 2017 Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=869, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAutoCreateStatistics, IsAutoUpdateStatistics, IsFullTextEnabled                                                                                                                                                                                                                                                                                                                                                                                                                 140

tempdb                                                                                                                                16.00 MB sa                                                                                                                                    2 Aug  3 2017 Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=869, Collation=SQL_Latin1_General_CP1_CI_AS, SQLSortOrder=52, IsAutoCreateStatistics, IsAutoUpdateStatistics                                                                                                                                                                                                                                                                                                                                                                                                                                    140


Network packet size (bytes): 4096

1 xact[s]:

Clock Time (ms.): total        31  avg   31.0 (32.3 xacts per sec.)

1> 



Step 9. 유저생성



위에서 보시다 시피 sqlcmd로 핸들링을 하면 아웃풋이 안좋다 ㅜ.ㅜ

툴들도 멀쩡하게 많으니 사용하도록 하자



"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."