RESTORE DATABASE database
FROM DISK | TAPE = physical_backup_device_name
[ WITH
[ REPLACE ]
[ [,] PASSWORD = password ]
[ [,] MOVE database TO file]
]
database | Name of the restored database. |
---|---|
physical_backup_device_name | Name of the physical device with the backup (file or tape). |
FROM DISK | Physical device with the backup is a file. |
FROM TAPE | Physical device with the backup is a tape. |
WITH | Clause prefaces possible accessory restore parameters. |
REPLACE | Restoring the database is performed even if the database with this name already exists. |
password | Password of the backup set (if entered on creating the database backup). |
MOVE database TO file | When restoring, the database (or log) file is moved from the location of creating the backup to the new location in another SQL Server. |
RESTORE DATABASE pm_data FROM DISK='c:\temp\pm_data.bak'
RESTORE DATABASE pm_data FROM DISK='c:\temp\pm_data.bak' WITH MOVE 'pm_data' TO 'c:\Program Files\microsoft sql server\mssql\data\pm_data.mdf', MOVE 'pm_data_log' TO 'c:\Program Files\microsoft sql server\mssql\data\pm_data_log.ldf'
RESTORE DATABASE pm_data2 FROM DISK='c:\temp\pm_data.bak' WITH MOVE 'pm_data' TO 'c:\Program Files\microsoft sql server\mssql\data\pm_data2.mdf', MOVE 'pm_data_log' TO 'c:\Program Files\microsoft sql server\mssql\data\pm_data2_log.ldf'