Reputation: 181
I have a BACPAC file that is being restored into a new database. Later, I realized that I don't need the DB anymore. The problem is that it has not finished to restored yet.
The question is that I can delete the DB while is restoring and be sure that nothing is going to happend to the BACPAC file.
Upvotes: 1
Views: 218
Reputation: 15688
The bacpac is just the (read-only) source of the restore and nothing can affect its structure.
In the other hand, you cannot delete a database that does not exist yet. Once the restore has finished you will be able to delete it.
Run the following query to monitor the progress of the restore operation:
SELECT * FROM sys.dm_operation_status ORDER BY start_time DESC;
To know the progress of a RESTORE operation on SQL Server On-premises I used below query:
SELECT session_id as SPID, command, a.text AS Query, start_time,
percent_complete, dateadd(second,estimated_completion_time/1000, getdate()) as
estimated_completion_time
FROM sys.dm_exec_requests r CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) a
WHERE r.command in ('RESTORE DATABASE')
Remove the WHERE clause from the query when restoring from a bacpac so you can identify which statement is doing the restore.
Upvotes: 3