Microsoft Database Mac
- Microsoft Access
- Microsoft Database Management System
- Microsoft Database Management Studio
- Free Download Microsoft Database
IDatabase is the Mac app that simplifies the creation of databases, inventories, collections and lists of items. IDatabase is the best there is for those who want to manage, store and quickly find any information for their passions and for everyday work.
2015-12-23 OpenOffice.org is a database management tool that has been designed to function in a way that it replaces the need of Microsoft office for Mac users. Thisfree database software for Macsupports multiple languages and is found to be compatible with most office suites, which makes it possible to alter documents created through Word. Below then is our list of the best Microsoft Access alternatives for Mac that database software for Mac in order of ranking that make great alternatives to Microsoft Access. Knack is the best database software for Mac users by some distance.
本教程演示如何将 SQL Server 备份文件移动和还原到在 Docker 上运行的 SQL Server 2017 Linux 容器映像。This tutorial demonstrates how to move and restore a SQL Server backup file into a SQL Server 2017 Linux container image running on Docker.
本教程演示如何将 SQL Server 备份文件移动和还原到在 Docker 上运行的 SQL Server 2019 Linux 容器映像。This tutorial demonstrates how to move and restore a SQL Server backup file into a SQL Server 2019 Linux container image running on Docker.
- 拉取并运行最新的 SQL Server Linux 容器映像。Pull and run the latest SQL Server Linux container image.
- 将 Wide World Importers 数据库文件复制到容器中。Copy the Wide World Importers database file into the container.
- 还原容器中的数据库。Restore the database in the container.
- 运行 Transact-SQL 语句来查看和修改数据库。Run Transact-SQL statements to view and modify the database.
- 备份修改后的数据库。Backup the modified database.
先决条件Prerequisites
- 任何受支持的 Linux 分发或用于 Mac/Windows 的 Docker 上的 Docker 引擎 1.8+。Docker Engine 1.8+ on any supported Linux distribution or Docker for Mac/Windows.有关详细信息,请参阅 Install Docker(安装 Docker)。For more information, see Install Docker.
- 至少 2 GB 的磁盘空间Minimum of 2 GB of disk space
- 至少 2 GB 的 RAMMinimum of 2 GB of RAM
- Linux 上的 SQL Server 的系统要求。System requirements for SQL Server on Linux.
拉取并运行容器映像Pull and run the container image
在 Linux/Mac 上打开 bash 终端,或在 Windows 上打开提升的 PowerShell 会话。Open a bash terminal on Linux/Mac or an elevated PowerShell session on Windows.
从 Docker 中心请求 SQL Server 2017 Linux 容器映像。Pull the SQL Server 2017 Linux container image from Docker Hub.
提示
本教程中提供了分别适用于 bash shell (Linux/Mac) 和 PowerShell (Windows) 的 docker 命令示例。Throughout this tutorial, docker command examples are given for both the bash shell (Linux/Mac) and PowerShell (Windows).
要通过 Docker 运行容器映像,可使用下列命令:To run the container image with Docker, you can use the following command:
此命令使用开发人员版本创建 SQL Server 2017 容器(默认)。This command creates a SQL Server 2017 container with the Developer edition (default).SQL Server 端口 1433 在主机上公开为端口 1401 。SQL Server port 1433 is exposed on the host as port 1401.可选的
-v sql1data:/var/opt/mssql
参数创建名为 sql1ddata 的数据卷容器。The optional-v sql1data:/var/opt/mssql
parameter creates a data volume container named sql1ddata.这用于保留 SQL Server 创建的数据。This is used to persist the data created by SQL Server.重要
该示例在 Docker 中使用数据卷容器。This example uses a data volume container within Docker.如果改为选择映射主机目录,请注意,在用于 Mac 和 Windows 的 Docker 上此方法存在一些限制。If you instead chose to map a host directory, note that there are limitations for this approach on Docker for Mac and Windows.有关详细信息,请参阅 在 Docker 上配置 SQL Server 容器映像。For more information, see Configure SQL Server container images on Docker.
要查看 Docker 容器,请使用
docker ps
命令。To view your Docker containers, use thedocker ps
command.如果“状态”列显示“正常运行”,则 SQL Server 将在容器中运行,并侦听“端口”列中指定的端口 。If the STATUS column shows a status of Up, then SQL Server is running in the container and listening on the port specified in the PORTS column.如果 SQL Server 容器的“状态”列显示“已退出”,则参阅配置指南的疑难解答部分 。If the STATUS column for your SQL Server container shows Exited, see the Troubleshooting section of the configuration guide.
在 Linux/Mac 上打开 bash 终端,或在 Windows 上打开提升的 PowerShell 会话。Open a bash terminal on Linux/Mac or an elevated PowerShell session on Windows.
从 Docker Hub 拉取 SQL Server 2019 Linux 容器映像。Pull the SQL Server 2019 Linux container image from Docker Hub.
提示
本教程中提供了分别适用于 bash shell (Linux/Mac) 和 PowerShell (Windows) 的 docker 命令示例。Throughout this tutorial, docker command examples are given for both the bash shell (Linux/Mac) and PowerShell (Windows).
要通过 Docker 运行容器映像,可使用下列命令:To run the container image with Docker, you can use the following command:
此命令使用开发人员版本创建 SQL Server 2019 容器(默认)。This command creates a SQL Server 2019 container with the Developer edition (default).SQL Server 端口 1433 在主机上公开为端口 1401 。SQL Server port 1433 is exposed on the host as port 1401.可选的
-v sql1data:/var/opt/mssql
参数创建名为 sql1ddata 的数据卷容器。The optional-v sql1data:/var/opt/mssql
parameter creates a data volume container named sql1ddata.这用于保留 SQL Server 创建的数据。This is used to persist the data created by SQL Server.要查看 Docker 容器,请使用
docker ps
命令。To view your Docker containers, use thedocker ps
command.如果“状态”列显示“正常运行”,则 SQL Server 将在容器中运行,并侦听“端口”列中指定的端口 。If the STATUS column shows a status of Up, then SQL Server is running in the container and listening on the port specified in the PORTS column.如果 SQL Server 容器的“状态”列显示“已退出”,则参阅配置指南的疑难解答部分 。If the STATUS column for your SQL Server container shows Exited, see the Troubleshooting section of the configuration guide.
更改 SA 密码Change the SA password
SA 帐户是在安装期间创建的 SQL Server 实例上的系统管理员。The SA account is a system administrator on the SQL Server instance that's created during setup.创建 SQL Server 容器后,可以通过在容器中运行 MSSQL_SA_PASSWORD
来发现指定的 echo $MSSQL_SA_PASSWORD
环境变量。After you create your SQL Server container, the MSSQL_SA_PASSWORD
environment variable you specified is discoverable by running echo $MSSQL_SA_PASSWORD
in the container.出于安全考虑,请考虑更改 SA 密码:For security purposes, change your SA password:
选择 SA 用户要使用的强密码。Choose a strong password to use for the SA user.
使用
docker exec
运行 sqlcmd 实用工具,以通过 Transact-SQL 语句来更改密码。Usedocker exec
to run the sqlcmd utility to change the password through a Transact-SQL statement.将<YourStrong!Passw0rd>
和<YourNewStrong!Passw0rd>
替换为你自己的密码值:Replace<YourStrong!Passw0rd>
and<YourNewStrong!Passw0rd>
with your own password values:
将备份文件复制到容器中Copy a backup file into the container
本教程使用 Wide World Importers 示例数据库。This tutorial uses the Wide World Importers sample database.使用以下步骤下载 Wide World Importers 数据库备份文件并将其复制到 SQL Server 容器。Use the following steps to download and copy the Wide World Importers database backup file into your SQL Server container.
首先,使用 docker exec 来创建备份文件夹。First, use docker exec to create a backup folder.以下命令在 SQL Server 容器中创建 /var/opt/mssql/backup 目录 。The following command creates a /var/opt/mssql/backup directory inside the SQL Server container.
接下来,将 WideWorldImporters-Full.bak 文件下载到主机。Next, download the WideWorldImporters-Full.bak file to your host machine.以下命令导航到主页/用户目录,并将备份文件下载为 wwi.bak 。The following commands navigate to the home/user directory and downloads the backup file as wwi.bak.
使用 docker cp 将备份文件复制到 /var/opt/mssql/backup 目录的容器中 。Use docker cp to copy the backup file into the container in the /var/opt/mssql/backup directory.
还原数据库Restore the database
备份文件现在位于容器内。The backup file is now located inside the container.在还原备份之前,请务必了解备份中的逻辑文件名和文件类型。Before restoring the backup, it is important to know the logical file names and file types inside the backup.以下 Transact-SQL 命令使用容器中的 sqlcmd 检查备份并执行还原 。The following Transact-SQL commands inspect the backup and perform the restore using sqlcmd in the container.
提示
本教程在容器中使用 sqlcmd,因为容器内预安装了该工具 。This tutorial uses sqlcmd inside the container, because the container comes with this tool pre-installed.不过,也可以使用容器外的其他客户端工具,如 Visual Studio Code 或 SQL Server Management Studio,来运行 Transact-SQL 语句。However, you can also run Transact-SQL statements with other client tools outside of the container, such as Visual Studio Code or SQL Server Management Studio.若要连接,请使用映射到容器中的 1433 端口的主机端口。To connect, use the host port that was mapped to port 1433 in the container.在此示例中,为主机上的“localhost,1401”和远程的“Host_IP_Address,1401” 。In this example, that is localhost,1401 on the host machine and Host_IP_Address,1401 remotely.
在容器中运行 sqlcmd,列出备份中的逻辑文件名和路径 。Run sqlcmd inside the container to list out logical file names and paths inside the backup.这是通过“RESTORE FILELISTONLY”Transact-SQL 语句实现的 。This is done with the RESTORE FILELISTONLY Transact-SQL statement.
会得到类似于下面的输出:You should see output similar to the following:
调用 RESTORE DATABASE 命令,还原容器中的数据库 。Call the RESTORE DATABASE command to restore the database inside the container.为上一步中的每个文件指定新路径。Specify new paths for each of the files in the previous step.
会得到类似于下面的输出:You should see output similar to the following:
验证还原的数据库Verify the restored database
运行以下查询以在容器中显示数据库名称的列表:Run the following query to display a list of database names in your container:
数据库列表中应会显示 WideWorldImporters 。You should see WideWorldImporters in the list of databases.
做出更改Make a change
以下步骤在数据库做出更改。The following steps make a change in the database.
运行查询,查看 Warehouse.StockItems 表中的前 10 项 。Run a query to view the top 10 items in the Warehouse.StockItems table.
The new language will appear in the list of editing languages.If the Keyboard Layout shows as Enabled you're all set for editing. Microsoft office excel 2016 for mac. Otherwise select the language from the Add additional editing languages list then press the Add button.
应会看到项标识符和名称的列表:You should see a list of item identifiers and names:
用以下 UPDATE 语句更新第一项的说明 :Update the description of the first item with the following UPDATE statement:
会得到类似于下面文本的输出:You should see output similar to the following text:
新建备份Create a new backup
Microsoft Access
将数据库还原到容器后,可能还需要定期在正在运行的容器中创建数据库备份。After you've restored your database into a container, you might also want to regularly create database backups inside the running container.步骤与之前步骤的模式类似,但顺序相反。The steps follow a similar pattern to the previous steps but in reverse.
使用“BACKUP DATABASE”Transact-SQL 命令在容器中创建数据库备份 。Use the BACKUP DATABASE Transact-SQL command to create a database backup in the container.本教程在之前创建的 /var/opt/mssql/backup 目录中创建新的备份文件 wwi_2.bak 。This tutorial creates a new backup file, wwi_2.bak, in the previously created /var/opt/mssql/backup directory.
会得到类似于下面的输出:You should see output similar to the following:
接下来,将备份文件从容器中复制到主计算机上。Next, copy the backup file out of the container and onto your host machine.
使用持久化数据Use the persisted data
除了获取数据库备份来保护数据外,还可以使用数据卷容器。In addition to taking database backups for protecting your data, you can also use data volume containers.本教程的开头使用 -v sql1data:/var/opt/mssql
参数创建了 sql1 容器 。The beginning of this tutorial created the sql1 container with the -v sql1data:/var/opt/mssql
parameter.即使已删除了容器,sql1data 数据卷容器仍会保留 /var/opt/mssql 数据 。The sql1data data volume container persists the /var/opt/mssql data even after the container is removed.以下步骤完全删除 sql1 容器 ,然后使用保存的数据创建新的容器 sql2 。The following steps completely remove the sql1 container and then create a new container, sql2, with the persisted data.
Microsoft Database Management System
停止 sql1 容器 。Stop the sql1 container.
删除容器。Remove the container.这不会删除以前创建的 sql1data 数据卷容器和其中保存的数据 。This does not delete the previously created sql1data data volume container and the persisted data in it.
创建新的容器 sql2,并重新使用 sql1data 数据卷容器。Create a new container, sql2, and reuse the sql1data data volume container.
Wide World Importers 数据库现在位于新容器中。The Wide World Importers database is now in the new container.运行查询以验证以前所做的更改。Run a query to verify the previous change you made.
备注
SA 密码不是你为 sql2 容器指定的密码
MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>
。The SA password is not the password you specified for the sql2 container,MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>
.所有 SQL Server 数据都是从 sql1 还原的,其中包括本教程前面部分中已更改的密码 。All of the SQL Server data was restored from sql1, including the changed password from earlier in the tutorial.实际上,由于在 /var/opt/mssql. 中还原数据,与此类似的某些选项会被忽略。In effect, some options like this are ignored due to restoring the data in /var/opt/mssql.出于此原因,密码是<YourNewStrong!Passw0rd>
,如下所示。For this reason, the password is<YourNewStrong!Passw0rd>
as shown here.
停止 sql1 容器 。Stop the sql1 container.
删除容器。Remove the container.这不会删除以前创建的 sql1data 数据卷容器和其中保存的数据 。This does not delete the previously created sql1data data volume container and the persisted data in it.
创建新的容器 sql2,并重新使用 sql1data 数据卷容器。Create a new container, sql2, and reuse the sql1data data volume container.
Wide World Importers 数据库现在位于新容器中。The Wide World Importers database is now in the new container.运行查询以验证以前所做的更改。Run a query to verify the previous change you made.
备注
SA 密码不是你为 sql2 容器指定的密码
MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>
。The SA password is not the password you specified for the sql2 container,MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>
.所有 SQL Server 数据都是从 sql1 还原的,其中包括本教程前面部分中已更改的密码 。All of the SQL Server data was restored from sql1, including the changed password from earlier in the tutorial.实际上,由于在 /var/opt/mssql. 中还原数据,与此类似的某些选项会被忽略。In effect, some options like this are ignored due to restoring the data in /var/opt/mssql.出于此原因,密码是<YourNewStrong!Passw0rd>
,如下所示。For this reason, the password is<YourNewStrong!Passw0rd>
as shown here.
后续步骤Next steps
Microsoft Database Management Studio
在本教程中,已学习如何在 Windows 上备份数据库,并将其移动到运行 SQL Server 的 Linux 服务器 2017。In this tutorial, you learned how to back up a database on Windows and move it to a Linux server running SQL Server 2017.你已了解如何执行以下操作:You learned how to:
Free Download Microsoft Database
在本教程中,了解了如何在 Windows 上备份数据库,以及如何将其移动到运行 SQL Server 2019 的 Linux 服务器。In this tutorial, you learned how to back up a database on Windows and move it to a Linux server running SQL Server 2019.你已了解如何执行以下操作:You learned how to:
- 创建 SQL Server Linux 容器映像。Create SQL Server Linux container images.
- 将 SQL Server 数据库备份复制到容器中。Copy SQL Server database backups into a container.
- 在容器中使用 sqlcmd 运行 Transact-SQL 语句 。Run Transact-SQL statements inside the container with sqlcmd.
- 创建和从容器中提取备份文件。Create and extract backup files from a container.
- 使用 Docker 中的数据卷容器来持久保存 SQL Server 数据。Use data volume containers in Docker to persist SQL Server data.
接下来,查看其他 Docker 配置和故障排除方案:Next, review other Docker configuration and troubleshooting scenarios: