Question

I Was able to backup using transact-sql, but I could not do a restore for some...

I Was able to backup using transact-sql, but I could not do a restore for some reason. IT says database have not been backup. But the .bak file is in the folder. Here is my code for restore:

USE master

RESTORE DATABASE [SmartHomes FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Backup\SQLTestDB.bak' WITH FILE = 1, NOUNLOAD, STATS = 5

GO

My backup file that was successful:

BACKUP DATABASE SmartHomes

TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Backup\SmartHomes.bak' WITH NOFORMAT, NOINIT,  NAME = N'SmartHomes-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10

GO

Homework Answers

Answer #1

For backup from.bak file to sql requires the following steps:

1. connect to a proper instance of Microsoft SQL Server Database Engine

2. click on object explorer next to Databases node and choose Restore Database option from contextual tab

3. Select General menu and navigate to the Source section

4. Click on Device option to get the location and hit add button to locate the backup file and open the .bak file which is highlighted

5. specify the Restore Options as Overwrite the existing database via checking the options you need

6. hit Verify Backup Media button and click OK to check if all the desired database is attached properly or not

7. you will get a pop-up that says “Database ‘Name’ restored successfully”

i hope this help for your problem

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions