欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

程序员文章站 2022-06-10 19:08:31
...

azure 入门

Microsoft Azure Data Studio is a new GUI-based (vs CLI) lightweight tool for developing and managing your modern SQL databases. The tool resembles Microsoft’s lightweight code editor, the open source IDE Visual Studio Code in terms of functionalities and the UI in general. If you’ve used Visual Studio Code (or VS Code), you’d feel at home with Azure Data Studio. Azure Data Studio also integrates really well other products like Azure SQL Database and Data Warehouse has been made very simple. Azure Data Studio is a cross-platform tool available for Linux, Windows, and Mac to manage the SQL Server databases. You can go ahead and download Microsoft Azure Data Studio to try it out!

Microsoft Azure Data Studio是一个新的基于GUI(vs CLI)的轻量级工具,用于开发和管理现代SQL数据库。 该工具在功能和总体上类似于Microsoft的轻量级代码编辑器,开源的IDE Visual Studio Code和UI。 如果您使用过Visual Studio Code(或VS Code),那么Azure Data Studio会让您感到宾至如归。 Azure Data Studio还可以很好地集成其他产品,例如Azure SQL数据库,并且Data Warehouse变得非常简单。 Azure Data Studio是可用于Linux,Windows和Mac的跨平台工具,用于管理SQL Server数据库。 您可以继续下载Microsoft Azure Data Studio进行试用!

In this article, we’re going to touch a few points on Microsoft’s new tool, called, Azure Data Studio:

在本文中,我们将谈谈Microsoft的新工具Azure Data Studio的几点:

  • Installation of Azure Data Studio on Windows and Linux distributions (CentOS, for example)

    在Windows和Linux发行版上安装Azure Data Studio(例如,CentOS)
  • Discussion on the Integrated terminals—Windows and Linux

    关于集成终端的讨论-Windows和Linux
  • A short tour of the CMD and PowerShell terminals on Windows

    Windows上的CMD和PowerShell终端简短浏览
  • Installation and configuration of PowerShell on the integrated terminal on Linux

    在Linux上的集成终端上安装和配置PowerShell
  • And more…

    和更多…

适用于Windows的Azure Data Studio(ADS) (Azure Data Studio (ADS) for Windows)

Installing Azure Data Studio is straightforward in Windows. You just have to download the installer and run it. Follow the on-screen instructions and you’re good to go. To launch it, you can either launch it from the Start Menu, or search for sqlops, or simply run the command sqlops on the cmd window.

在Windows中安装Azure Data Studio很简单。 您只需要下载安装程序并运行它。 按照屏幕上的说明进行操作,一切顺利。 要启动它,您可以从“开始”菜单中启动它,或者搜索sqlops,或者直接在cmd窗口中运行sqlops命令。

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

Here is what you will see of Microsoft Azure Data Studio at first

这是您首先会看到的Microsoft Azure Data Studio

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

适用于Linux的Azure Data Studio(ADS) (Azure Data Studio (ADS) for Linux)

To install Azure Data Studio follow the steps below.

若要安装Azure Data Studio,请按照以下步骤操作。

  1. Check whether the dependency package, libXScrnSaver is installed or not

    #yum info libXScrnSaver
    

    检查是否安装了依赖包libXScrnSaver

    #yum info libXScrnSaver

  2. In case of absence of this package, install it using the following command:

    #yum install libXScrnSaver
    

    如果没有此软件包,请使用以下命令进行安装:

  3. Download Azure Data Studio (ADS) for Linux.

    azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

    下载适用于Linux的Azure Data Studio(ADS)

  4. Extract the files from the archive using the tar -xvf command

    #cd ~
    #cp /home/thanVitha/Downloads/sqlops-linux-0.24.1.tar.gz ~
    tar -xvf ~/sqlops-linux0.24.1.tar.gz
    

    使用tar -xvf命令从存档中提取文件

    #cd ~
     #cp /home/thanVitha/Downloads/sqlops-linux-0.24.1.tar.gz ~
     tar -xvf ~/sqlops-linux0.24.1.tar.gz

  5. Launch Azure Data Studio. Set the environment variables using the .bashrc script file. Use the source command to load the configuration information into the current shell.

    #echo 'export PATH="$PATH:~/sqlops-linux-x64"' >> ~/.bashrc
    #source ~/.bashrc
    #sqlops
    

    启动Azure Data Studio。 使用.bashrc脚本文件设置环境变量。 使用source命令将配置信息加载到当前shell中。

    #echo 'export PATH="$PATH:~/sqlops-linux-x64"' >> ~/.bashrc
     #source ~/.bashrc
     #sqlops

  6. Now, run the sqlops command to invoke Azure Data Studio

    现在,运行sqlops命令以调用Azure Data Studio

综合终端 (Integrated terminal)

As administrators, it is quite common for us to use the terminal, be it PowerShell or CMD on Windows, or Terminal on Linux. However, it’s inconvenient for us to have to switch windows while working on something on sqlops to go to the terminal. Worry not, sqlops has the terminal built right in. It’s also flexible enough to let you configure your own terminals into sqlops. In other words, if you’re used to PowerShell, you can configure the terminal to be the PowerShell one by default. You can even create your own terminal configurations and map them into sqlops to have a completely customized experience.

作为管理员,使用终端非常普遍,无论是Windows上的PowerShell或CMD,还是Linux上的Terminal。 但是,对我们来说,在使用slops进行终端操作时必须切换窗口是很不方便的。 不用担心,sqlops内置有终端。它也足够灵活,可以让您将自己的终端配置为sqlops。 换句话说,如果您习惯使用PowerShell,则可以将终端默认配置为PowerShell之一。 您甚至可以创建自己的终端配置并将其映射到sqlop中,以获得完全自定义的体验。

To open the integrated terminal, go to View on the menu bar and select Integrated Terminal. If you’re into keyboard shortcuts, use the Ctrl+` combination (that’s a backtick).

要打开集成终端,请转到菜单栏上的查看 ,然后选择集成终端 。 如果您喜欢键盘快捷键,请使用Ctrl +`组合键(即反引号)。

As we can see that cmd.exe is loaded by default in case of Windows. Let’s open a PowerShell console and run few SQL Server cmdlets.

我们可以看到,在Windows中,默认情况下会加载cmd.exe。 让我们打开一个PowerShell控制台并运行几个SQL Server cmdlet。

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

Tap on 1: cmd and select powershell.

点击1:cmd并选择powershell

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

To test the cross-platform functionality, connect to Linux SQL instance. By default, the SQL Server modules are loaded.

要测试跨平台功能,请连接到Linux SQL实例。 默认情况下,将加载SQL Server模块。

PS C:\Users\ccov648> Invoke-Sqlcmd -ServerInstance 10.2.6.51 -query "select @@servername" -Username sa -Password aaa@qq.com
PS C:\Users\ccov648> Invoke-Sqlcmd -ServerInstance 10.2.6.51 -query "select name from sys.databases" -Username sa -Password aaa@qq.com

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

That was all Windows. Let’s go for a test run of the tool on Linux.

就是所有的Windows。 让我们在Linux上对该工具进行测试运行。

To open a Powershell console on Azure Data Studio in Linux, you need to download the PowerShell package from the Microsoft repository and use the yum command to install or update the PowerShell package.

要在Linux上的Azure Data Studio上打开Powershell控制台,需要从Microsoft资源库下载PowerShell软件包,并使用yum命令安装或更新PowerShell软件包。

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

We download the PowerShell repository using wget

我们使用wget下载PowerShell存储库

#wget --directory-prefix=/etc/yum.repos.d/powershell.repo
https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.18/powershell-6.0.0_alpha.18-1.el7.centos.x86_64.rpm

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

Use yum command to install the PowerShell package.

使用yum命令安装PowerShell软件包。

#yum install powershell

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

Start PowerShell using the pwsh command.

使用pwsh命令启动PowerShell。

#pwsh

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

Let’s now try to query the SQL instance using the PowerShell integrated terminal on SQL Server Operations Studio on Linux.

现在,让我们尝试使用Linux上SQL Server Operations Studio上的PowerShell集成终端查询SQL实例。

Download and register the SQL Server PowerShell DLLs. The tar file is here. You can read more about installation procedures in this article: An overview of Python vs PowerShell for SQL Server Database Administration.

下载并注册SQL Server PowerShell DLL。 tar文件在这里 。 您可以在本文中阅读有关安装过程的更多信息: 适用于SQL Server数据库管理的Python与PowerShell概述

In this case the DLLs are extracted to /home/thanvitha/SQLTools/.

在这种情况下,DLL被提取到/ home / thanvitha / SQLTools /。

PS /root> cd /home/thanvitha/SQLTools/
PS /home/thanvitha/SQLTools>

Add the SQL Server assemblies to the shell so as to be able to invoke the respective objects.

将SQL Server程序集添加到外壳程序,以便能够调用相应的对象。

PS /home/thanvitha/SQLTools> Add-Type  -AssemblyName “Microsoft.SqlServer.Smo”
PS /home/thanvitha/SQLTools> Add-Type  -AssemblyName “Microsoft.SqlServer.ConnectionInfo”

Test the SQL Server module by building a connection string and printing the database information of the SQL Server instance named node2.

通过构建连接字符串并打印名为node2SQL Server实例的数据库信息来测试SQL Server模块。

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

azure 入门_Azure Data Studio(ADS)入门; 初始安装和配置

结语 (Wrapping up)

In this article we provided a high-level overview of DevOps, and listed various tools that help manage SQL Server databases on different platforms. We looked at Azure Data Studio in particular, and laid out the installation steps on Windows and Linux. Also, we configured PowerShell on CentOS and loaded the SQL Server DLLs in the Azure Data Studio integrated terminal on CentOS.

在本文中,我们提供了DevOps的高级概述,并列出了有助于在不同平台上管理SQL Server数据库的各种工具。 我们特别研究了Azure Data Studio,并列出了Windows和Linux上的安装步骤。 此外,我们在CentOS上配置了PowerShell,并在CentOS上的Azure Data Studio集成终端中加载了SQL Server DLL。

That’s not all of what Azure Data Studio can do, though; the tool has several other great features that hopefully I’ll get a chance to review in the future. But this is all for now. Stay tuned for updates on this promising tool!

不过,这还不是Azure Data Studio所能做的全部; 该工具还有其他一些很棒的功能,希望以后我能有机会回顾一下。 但这只是现在。 请继续关注此有前途的工具的更新!

目录 (Table of contents)

Getting started building applications using SQL Server DevOps Tools
Overview of SQLCMD utility in SQL Server
The BCP (Bulk Copy Program) command in action
Continuous Deployment using SQL Server Tools SqlPackage.exe
All about MSSQL-Scripter, the SQL Server cross-platform scripting Tool
Getting started with Azure Data Studio (ADS); initial installation and configuration
开始使用SQL Server DevOps工具构建应用程序
SQL Server中SQLCMD实用工具概述
运行中的BCP(大容量复制程序)命令
使用SQL Server工具SqlPackage.exe进行连续部署
有关MSSQL-Scripter(SQL Server跨平台脚本工具)的全部信息
Azure Data Studio(ADS)入门; 初始安装和配置

翻译自: https://www.sqlshack.com/getting-started-azure-data-studio-ads-initial-installation-and-configuration/

azure 入门