You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -223,18 +223,18 @@ This tutorial uses the [Wide World Importers sample databases for Microsoft SQL]
223
223
The backup file is now located inside the container. Before restoring the backup, it's important to know the logical file names and file types inside the backup. The following Transact-SQL commands inspect the backup and perform the restore using **sqlcmd** in the container.
224
224
225
225
> [!TIP]
226
-
> This tutorial uses **sqlcmd** inside the container, because the container comes with this tool pre-installed. However, you can also run Transact-SQL statements with other client tools outside of the container, such as [SQL Server extension for Visual Studio Code](../tools/visual-studio-code/sql-server-develop-use-vscode.md) or [Use SQL Server Management Studio on Windows to manage SQL Server on Linux](sql-server-linux-manage-ssms.md). To connect, use the host port that was mapped to port 1433 in the container. In this example, that is `localhost,1401` on the host machine and `Host_IP_Address,1401` remotely.
226
+
> This tutorial uses **sqlcmd** inside the container, because the container comes with this tool preinstalled. However, you can also run Transact-SQL statements with other client tools outside of the container, such as [SQL Server extension for Visual Studio Code](../tools/visual-studio-code/sql-server-develop-use-vscode.md) or [Use SQL Server Management Studio on Windows to manage SQL Server on Linux](sql-server-linux-manage-ssms.md). To connect, use the host port that was mapped to port 1433 in the container. In this example, the host and port are `localhost,1401` on the host machine, and `Host_IP_Address,1401` remotely.
227
227
228
228
1. Run **sqlcmd** inside the container to list out logical file names and paths inside the backup. This is done with the `RESTORE FILELISTONLY` Transact-SQL statement.
-Q 'RESTORE DATABASE WideWorldImporters FROM DISK = "/var/opt/mssql/backup/wwi.bak" WITH MOVE "WWI_Primary" TO "/var/opt/mssql/data/WideWorldImporters.mdf", MOVE "WWI_UserData" TO "/var/opt/mssql/data/WideWorldImporters_userdata.ndf", MOVE "WWI_Log" TO "/var/opt/mssql/data/WideWorldImporters.ldf", MOVE "WWI_InMemory_Data_1" TO "/var/opt/mssql/data/WideWorldImporters_InMemory_Data_1"'
254
254
```
255
255
256
-
You should see an output similar to the following:
256
+
The results should look similar to the following output:
257
257
258
258
```output
259
259
Processed 1464 pages for database 'WideWorldImporters', file 'WWI_Primary' on file 1.
@@ -286,7 +286,7 @@ The backup file is now located inside the container. Before restoring the backup
286
286
Run the following query to display a list of database names in your container:
-Q 'UPDATE WideWorldImporters.Warehouse.StockItems SET StockItemName="USB missile launcher (Dark Green)" WHERE StockItemID=1; SELECT StockItemID, StockItemName FROM WideWorldImporters.Warehouse.StockItems WHERE StockItemID=1'
331
331
```
@@ -341,17 +341,17 @@ Follow these steps to make a change in the database.
341
341
342
342
### Create a new backup
343
343
344
-
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.
344
+
After you restore 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.
345
345
346
346
1. Use the `BACKUP DATABASE` Transact-SQL command to create a database backup in the container. This tutorial creates a new backup file, `wwi_2.bak`, in the previously created `/var/opt/mssql/backup` directory.
-Q "BACKUP DATABASE [WideWorldImporters] TO DISK = N'/var/opt/mssql/backup/wwi_2.bak' WITH NOFORMAT, NOINIT, NAME = 'WideWorldImporters-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
352
352
```
353
353
354
-
You should see output similar to the following:
354
+
The results should look similar to the following output:
355
355
356
356
```output
357
357
10 percent processed.
@@ -442,7 +442,7 @@ In addition to taking database backups for protecting your data, you can also us
442
442
1. The Wide World Importers database is now in the new container. Run a query to verify the previous change you made.
-Q 'SELECT StockItemID, StockItemName FROM WideWorldImporters.Warehouse.StockItems WHERE StockItemID=1'
482
482
```
@@ -540,15 +540,15 @@ Follow these steps to make a change in the database.
540
540
541
541
### Create a new backup
542
542
543
-
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.
543
+
After you restore 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.
544
544
545
545
1. Use the `BACKUP DATABASE` Transact-SQL command to create a database backup in the container. This tutorial creates a new backup file, `wwi_2.bak` in the `/var/opt/mssql/backup` directory.
546
546
547
547
```bash
548
548
sqlcmd -Q "BACKUP DATABASE [WideWorldImporters-Full] TO DISK = N'/var/opt/mssql/backup/wwi_2.bak' WITH NOFORMAT, NOINIT, NAME = 'WideWorldImporters-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
549
549
```
550
550
551
-
You should see output similar to the following:
551
+
The results should look similar to the following output:
552
552
553
553
```output
554
554
10 percent processed.
@@ -571,9 +571,9 @@ After you've restored your database into a container, you might also want to reg
571
571
572
572
### Clean up
573
573
574
-
Now that the backup has been copied off the container, it can be cleaned up. The following steps completely remove the `sql1` container.
574
+
Now that the backup is copied off the container, it can be cleaned up. The following steps completely remove the `sql1` container.
575
575
576
-
1. Remove the container. **sqlcmd** has built-in safeguards to prevent deleting a container that is in use. The way it determines if a container is still in use is whether it has any user databases. For production scenarios, you should delete user databases individually after verifying they are no long in use. For development/testing we can use the `--force` parameter to delete the container without deleting the user database.
576
+
1. Remove the container. **sqlcmd** has built-in safeguards to prevent deleting a container that is in use. The way it determines if a container is still in use is whether it has any user databases. For production scenarios, you should delete user databases individually after verifying they're no long in use. For development/testing, you can use the `--force` parameter to delete the container without deleting the user database.
0 commit comments