久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

Ubuntu下如何部署SQL Server 2017

248次閱讀
沒有評論

共計 5519 個字符,預(yù)計需要花費 14 分鐘才能閱讀完成。

這篇文章將為大家詳細(xì)講解有關(guān) Ubuntu 下如何部署 SQL Server 2017,丸趣 TV 小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

SQL Server 2017 最近已正式發(fā)布。這是 SQL Server 歷史上 *** 同時發(fā)布 Windows 和 Linux   版。此外,微軟還發(fā)布了能使用 Docker 部署的容器版本。對 SQL Server 而言,這是其歷史上具有里程碑意義的一步,因為這是跨出 Windows   的 *** 個版本,標(biāo)志著 SQL Server 在 Linux 平臺上 *** 可用。

SQL Server 2017 新版本成為 *** 個云端、跨不同操作系統(tǒng)的版本,包括 Linux、Docker。SQL Server 2017 目前支持的  Linux 發(fā)行版包括:Red Hat Enterprise Linux(RHEL), SUSE Linux Enterprise Server 和  Ubuntu。SQL Server 2017 支持 Docker 企業(yè)版,Kubernetes 和 OpenShift 這三大容器平臺。

SQL Server 2017 新特性

SQL Server 2017 支持使用 R 和 Python 的分析方法,來做資料庫內(nèi)的機器學(xué)習(xí),意味著不必遷移資料,省下不少時間。

圖數(shù)據(jù)分析功能將使客戶能夠使用圖形數(shù)據(jù)存儲和查詢語言擴展來使用原生的圖形查詢語法,以便在高度互連的數(shù)據(jù)中發(fā)現(xiàn)新的關(guān)系。

自適應(yīng)查詢處理可為數(shù)據(jù)庫帶來更智能的體驗。例如,SQL Server 中的 Adaptive Memory Grants   跟蹤并了解對給定的查詢使用了多少內(nèi)存,以調(diào)整內(nèi)存的使用。

Automatic Plan Correction 通過查找和修正性能的回歸來確保持續(xù)的性能。

SQL Server 2017 的核心功能在 Windows 和 Linux 上保持一致,但有少部分依賴于 Windows 功能的特性沒有提供給  Linux (例如集群支持和集成 Windows 身份驗證)。

本文將介紹如何在 Ubuntu 下部署 SQL Server 2017。

安裝 SQL Server 2017

在 Linux 上 安裝 SQL Server 2017 的先決條件

設(shè)備類型設(shè)備要求內(nèi)存 3.25 GB 及以上文件系統(tǒng) XFS 或 EXT4 (其他文件系統(tǒng),如 BTRFS,不支持) 磁盤空間 6 GB 處理器速度 2 GHz 處理器核心 2 核處理器類型僅 x64 兼容

安裝 SQL Server 2017 服務(wù)端

導(dǎo)入公共存儲庫 GPG 密鑰

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

增加 Microsoft SQL Server Ubuntu 倉庫

$ add-apt-repository  $(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)

安裝 SQL Server 服務(wù)端

$ apt-get update $ apt-get install -y mssql-server

設(shè)置 SA 密碼,并選擇要安裝的版本

$ /opt/mssql/bin/mssql-conf setup 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) Enterprise Core (PAID) 8) 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-8): 1 The license terms for this product can be found in /usr/share/doc/mssql-server or downloaded from: https://go.microsoft.com/fwlink/?LinkId=855864 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 Enter the SQL Server system administrator password: Confirm the SQL Server system administrator password: Configuring SQL Server... The licensing PID was successfully processed. The new edition is [Enterprise Evaluation Edition]. Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /lib/systemd/system/mssql-server.service. Setup has completed successfully. SQL Server is now starting.

一共提供了 8 個版本供選擇,其中自由授予許可版本有:評估、開發(fā)人員和快速。

SA 帳戶必須為強密碼 (最少 8 個字符,包括大寫和小寫字母、十進(jìn)制數(shù)字和 / 或非字母數(shù)字符號)。

驗證服務(wù)是否正在運行

$ systemctl status mssql-server ● mssql-server.service - Microsoft SQL Server Database Engine Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2017-10-12 11:50:29 CST; 1min 22s ago Docs: https://docs.microsoft.com/en-us/sql/linux Main PID: 20776 (sqlservr) CGroup: /system.slice/mssql-server.service ├─20776 /opt/mssql/bin/sqlservr └─20796 /opt/mssql/bin/sqlservr

安裝 SQL Server 2017 命令行工具

如果要創(chuàng)建數(shù)據(jù)庫,需要使用客戶端工具 sqlcmd 和 bcp。

導(dǎo)入公共存儲庫 GPG 密鑰

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

增加 Microsoft Ubuntu 倉庫

$ add-apt-repository  $(curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list)

安裝 SQL Server 命令行工具 和 unixODBC 開發(fā)人員工具包

$ apt-get update $ apt-get install -y mssql-tools unixodbc-dev

Sqlcmd 工具默認(rèn)安裝到 /opt/mssql-tools/bin/ 中的,為方便使用把 /opt/mssql-tools/bin/   添加到環(huán)境變量中。

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

Sqlcmd 是用于連接到 SQL Server 以運行查詢并執(zhí)行管理和開發(fā)的一個命令行工具。如果要使用功能更強大的圖形工具,可使用 SQL Server  Management Studio 或 Visual Studio Code 的 mssql 插件。

使用 Sqlcmd 建立本地連接

Sqlcmd 連接到本地的 SQL Server 實例。密碼是在安裝過程中配置的 SA 帳戶密碼。

$ sqlcmd -S localhost -U SA -P  YourPassword

參數(shù)說明

-S 連接 SQL Server 的機器名

-U 連接 SQL Server 的用戶名

-P 連接 SQL Server 的密碼

連接成功,應(yīng)會顯示 Sqlcmd 命令提示符:1,就類似下面這樣

$ sqlcmd -S localhost -U SA Password: 1

創(chuàng)建數(shù)據(jù)庫和查詢數(shù)據(jù)

新建數(shù)據(jù)庫

創(chuàng)建一個名為 TestDB 的新數(shù)據(jù)庫

在 sqlcmd 命令提示符中,執(zhí)行 Transact-SQL 命令以創(chuàng)建測試數(shù)據(jù)庫。

1  CREATE DATABASE TestDB

在 SQL Server 中 命令并沒有立即執(zhí)行,必須在新行中鍵入 GO 才能執(zhí)行命令。

2  GO

返回服務(wù)器上所有數(shù)據(jù)庫的名稱

1  SELECT Name from sys.Databases 2  GO Name ---------------------------------------- master tempdb model msdb TestDB (5 rows affected)

插入數(shù)據(jù)

創(chuàng)建一個新表 Inventory,然后插入兩個新行。

在 sqlcmd 命令提示符中,切換到新的 TestDB 數(shù)據(jù)庫。

1  USE TestDB

創(chuàng)建名為 Inventory 的新表

2  CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)

將數(shù)據(jù)插入新表

3  INSERT INTO Inventory VALUES (1,  banana , 150); INSERT INTO Inventory VALUES (2,  orange , 154);

批量執(zhí)行上述命令

4  GO

整個執(zhí)行過程如下

1  USE TestDB 2  CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT) 3  INSERT INTO Inventory VALUES (1,  banana , 150); INSERT INTO Inventory VALUES (2,  orange , 154); 4  GO Changed database context to  TestDB . (1 rows affected) (1 rows affected)

查詢數(shù)據(jù)

通過 sqlcmd 命令查詢 Inventory 表中數(shù)量大于 152 的行

1  SELECT * FROM Inventory WHERE quantity   152; 2  GO id name quantity ------ ------------ ----------- 2 orange 154 (1 rows affected)

退出 sqlcmd

要結(jié)束 sqlcmd 會話,請鍵入 QUIT。

1  QUIT

卸載 SQL Server 2017

若要刪除 SQL Server 2017,可使用以下命令

$ apt-get remove mssql-server

刪除包不會刪除生成的數(shù)據(jù)庫文件。如果你想要刪除的數(shù)據(jù)庫文件,可使用以下命令

$ sudo rm -rf /var/opt/mssql/

*** 在推薦下微軟良心出品 Visual Studio Code 這個編輯器,功能異常強大、跨平臺并且是開源的。最最最重要的是它比 Atom   快,插件也很豐富。我已從 Atom 轉(zhuǎn)坑入 VSCode 了,感謝蝸牛大神的推薦!

下圖為 VSCode+MSSQL 插件的效果圖,有沒有很贊的~

Ubuntu 下如何部署 SQL Server 2017

Ubuntu 下如何部署 SQL Server 2017

Ubuntu 下如何部署 SQL Server 2017

關(guān)于“Ubuntu 下如何部署 SQL Server 2017”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-08-25發(fā)表,共計5519字。
轉(zhuǎn)載說明:除特殊說明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 西峡县| 敖汉旗| 长武县| 贞丰县| 区。| 突泉县| 广州市| 左贡县| 青州市| 福海县| 霸州市| 诸暨市| 屯昌县| 腾冲县| 庆城县| 南澳县| 阿拉尔市| 吕梁市| 衡山县| 乌拉特中旗| 克什克腾旗| 阳曲县| 泰宁县| 易门县| 商丘市| 旺苍县| 抚松县| 满洲里市| 靖州| 克山县| 来安县| 离岛区| 西藏| 石嘴山市| 河北省| 安西县| 华容县| 集安市| 阳山县| 临洮县| 喜德县|