I accidentally deleted a table manually from my Azure SQL Server database in an ASP.NET Web API & Entity Framework project.
How can I restore it?
Migrations won’t update because it thinks the database is up to date, unaware of the deleted table.
I accidentally deleted a table manually from my Azure SQL Server database in an ASP.NET Web API & Entity Framework project.
How can I restore it?
Migrations won’t update because it thinks the database is up to date, unaware of the deleted table.
2
Answers
Agreed with @T N Azure SQL databases are backed up automatically. store it for some retaintion period in which you can restore it further if you need.
Azure SQL databases creates below backups:.
You can get it in your Azure SQL databases >> Data Management >> Backups >> automatically created database backup you will see here:
You can restore it to another database and you can generate the script for table using SSMS or Azure Data studio (ADS) check this document or you can use Data factory to create and move data to table from this backed up database.
The way I have done this before, I perform point-in-time restores to new databases selecting different point in time close to the time the table was deleted. You can do that using Azure Portal or PowerShell.
Once you find the table on one of the newly created databases as result of the restore operations, you can use Azure Elastic Queries or Azure Data Factory to move the data in the table to the Production or original database.