Skip to content

Commit f415c08

Browse files
author
AbhishekMallick01
committed
minor changes
1 parent 09d6f51 commit f415c08

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

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

200-
```
201-
USE [master]
202-
RESTORE DATABASE [<DBName>] FROM  DISK = N'<.bak file path>'
203-
``` 
200+
```
201+
USE [master]
202+
RESTORE DATABASE [<DBName>] FROM  DISK = N'<.bak file path>'
203+
```
204204
205205
>[!Note]
206206
>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).
207207
208208
To relocate the database files from the target restore server, you can frame a TSQL command using the `MOVE` clauses.
209209
210-
```
211-
USE [master]
212-
RESTORE DATABASE [<DBName>] FROM  DISK = N'<.bak file path>'  MOVE N'<LogicalName1>' TO N'<TargetFilePath1OnDisk>',  MOVE N'<LogicalName2>' TO N'<TargetFilePath2OnDisk>' GO
213-
```
210+
```
211+
USE [master]
212+
RESTORE DATABASE [<DBName>] FROM  DISK = N'<.bak file path>'  MOVE N'<LogicalName1>' TO N'<TargetFilePath1OnDisk>',  MOVE N'<LogicalName2>' TO N'<TargetFilePath2OnDisk>' GO
213+
```
214214
215215
**Example**
216216
217-
``` 
218-
USE [master]
219-
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
220-
GO
221-
```
217+
``` 
218+
USE [master]
219+
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
220+
GO
221+
```
222222

223223
If there are more than t wo 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 a SQL database backup using SSMS]( /sql/relational-databases/backup-restore/restore-a-database-backup-using-ssms?view=sql-server-ver16).
224224

0 commit comments

Comments
 (0)