Ms sql restoration from backup to another database
Restoring an MS SQL Server database from a backup to another database can be useful if you want to create a duplicate or test environment for your primary database. Here are the steps to follow:
1. Create a new empty database:
"`sql
CREATE DATABASE NewDatabase;
“`
2. Close all connections to this new database.
3. Open Microsoft SQL Server Management Studio (SSMS) and connect to the MSSQL server.
4. Right-click on the "Database" section and select "Recovery...".
5. In the window that appears, select the "From device" option, and then click the "..." button. Select the backup file (.bak) that you would like to use for the restore.
6. Check the list of available restore points. If there are several versions of backups, choose the most recent current point in time.
7. Found data will be displayed to the left of the list of established points - this is the content of the bak file
8. A list of all tables/presented/stored procedures/etc., found when scanning this file, will be displayed
9. Select the database you want to restore (NewDatabase) and specify the path for the data (.mdf) and transaction log (.ldf) files. This will usually be something like “C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Data\”.
10. Configure the recovery parameters of your choice: overwriting the existing database or creating a new copy, access security options, and other settings.
11. Click the "OK" button to start the backup recovery process.
12. At the end of the operation, check the status of the task - it should be successful
Now you have a copied version of the original MS SQL Server database!