Docker installs the sql-server database and uses navicat to import the backup database.

1. Docker installs sql-server database

Pull the image and install the container

# 拉取镜像
docker pull mcr.microsoft.com/mssql/server:2017-latest

# 创建容器
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=sqlserver123456" \
-v /sql-server/log:/var/opt/mssql/log \
-v /sql-server/data:/var/opt/mssql/data \
-v /sql-server/external:/var/opt/mssql/external \
-p 1433:1433 --name sqlserver -d mcr.microsoft.com/mssql/server:2017-latest

2. Use navicat to connect to sql-server

Click InstallFile before connectingsql-server After the installation is complete, enter relevant information to connect, user name and The password is predictable when creating the container above. msodbcsql_64.msi
Insert image description here

Username: sa Password: sqlserver123456

Insert image description here

3. Use navicat to import the backup database

1. Step 1: Select the data source to be backed up
  • Erectionsql-serverConnection
  • Create an empty databaseAERS3
  • Close the database, clickSQL Server备份 button, and click on the whiteboard on the right
  • choose从文件还原选项
  • Put the files that need to be backed up and restoredbak into the server'sexternal, which will be mapped inside the container
  • 添加设备,choicebaktext item

Insert image description here
Insert image description here
Insert image description here

2. Step 2 (Select a backup plan and set the restore file location information)
  • Choose a backup plan
  • The settings need to be restored to the corresponding database data file of the backup (AERS3.ndf: AERS3 data information; AERS3_log.ldf: AERS3 operation log information)
  • Click to generate SQL
  • Click还原button
    Insert image description here
    Insert image description here
    and the execution is successful!

Guess you like

Origin blog.csdn.net/qq_50661854/article/details/133785828