Skip to content

Commit ae1babd

Browse files
author
AbhishekMallick01
committed
minor changes
1 parent 29334f6 commit ae1babd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

articles/backup/restore-sql-database-azure-vm.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,29 +197,28 @@ To restore the database files to the *original path on the source server*, remov
197197
198198
**Example**
199199

200-
201-
```azurecli-interactive
200+
```azurecli-interactive
202201
USE [master]
203202
RESTORE DATABASE [<DBName>] FROM  DISK = N'<.bak file path>'
204-
```
203+
```
205204

206205
>[!Note]
207206
>You shouldn’t have the same database files on the target server (restore with replace).  Also you can [enable instant file initialization on the target server to reduce the file initialization time overhead]( /sql/relational-databases/databases/database-instant-file-initialization?view=sql-server-ver16).
208207
209208
To relocate the database files from the target restore server, you can frame a TSQL command using the `MOVE` clauses.
210209

211-
```azurecli
210+
```azurecli
212211
USE [master]
213212
RESTORE DATABASE [<DBName>] FROM  DISK = N'<.bak file path>'  MOVE N'<LogicalName1>' TO N'<TargetFilePath1OnDisk>',  MOVE N'<LogicalName2>' TO N'<TargetFilePath2OnDisk>' GO
214-
```
213+
```
215214

216215
**Example**
217216

218-
```azurecli
217+
```azurecli
219218
USE [master]
220219
RESTORE DATABASE [test] FROM  DISK = N'J:\dbBackupFiles\test.bak' WITH  FILE = 1,  MOVE N'test' TO N'F:\data\test.mdf',  MOVE N'test_log' TO N'G:\log\test_log.ldf',  NOUNLOAD,  STATS = 5
221220
GO
222-
```
221+
```
223222

224223
If there are more than two files for the database, you can add additional move clauses to the restore query. You can also use SSMS for database recovery using `.bak` files. Learn more on [restoring an SQL database backup using SSMS]( /sql/relational-databases/backup-restore/restore-a-database-backup-using-ssms?view=sql-server-ver16).
225224

0 commit comments

Comments
 (0)