Different backup name of the SQL database to store different path reduction method

Different backup name of the SQL database to store different path to restore the collection / * ————————————- ——————————- Author: htl258 (Tony) – Date: 2010-04-15 22:07: 01 – Version: Microsoft SQL Server 2008 (RTM) – 10.0.1600.22 (Intel X86) Jul 9 2008 14:43:34 Copyright (c) 1988-2008 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 3 instance) – Subject: SQL backup and restore (restore backup file path and backup different when available) ————————— ————————————— * / – backup BACKUP DATABASE mydb TO DISK = ‘c :/ olddb.bak’ WITH INIT – In order to test the backup file is moved from the C drive to D :/ tempdb file folder – restore – 1. logical file name of the backup file with this statement: RESTORE the FILELISTONLY FROM Disk = N’d :/ tempdb / olddb.bak ‘- backup file storage path – see LogicalName general there will be two files, such as: – OLDDB – the main logical file name – olddb_log – log logical file name – with the following statement to restore the database RESTORE DATABASE new_db FROM DISK = ‘d :/ tempdb / olddb.bak’ WITH MOVE ‘OLDDB’ TO ‘d :/ tempdb / newdb.mdf’ the MOVE ‘olddb_log’ to ‘d :/ tempdb / newdb_log.ldf’ / * – the supplementary explanation of the above code: the RESTORE DATABASE restore after the database name FROM DISK = ‘path of the backup file / backup database name. bak’ WITH MOVE ‘main logical file name’ TO ‘the restored path / restore after data file name mdf’, the MOVE ‘log logical file name’ TO ‘the restored path / restore log file name _log.ldf in’ * / – if you encounter a page fault and even can not be restored, can be mistaken sentence mandatory reduction skip a page fault: RESTORE DATABASE dbname FROM DISK = ‘backupset_file’ WITH the CONTINUE_AFTER_ERROR – restore DBCC CHECKDB repair the database. – Note: there will be some loss of data, restore original backup set page fault.