sql server - Dropping an unindexed table with over 1.7 Billion rows on live database (SQL Admin Nightmare) -
a recent employee of our company had stored procedure has gone haywire, , caused mass inserts debug table of his. table unindexed, @ close 1.7 billion rows, , taking space backup no longer fits on backup drive (backups reach close 250gb).
i haven't seen this, i'm seeking advice mssql gurus out here.
i know nibble away @ table, being unindexed, delete [table] id in (select top 10000 [id] [table])
locks server searching them.
i don't want log file massive, it's sitting @ 480gb on 1tb drive. if delete table, able shrink down? (my recovery mode simple)
we index id field on table, though have around 9 hours downtime day, , during business hours can't locking database.
just looking advice here, , point in right direction.
thanks.
you may want consider truncate
msdn reference: http://technet.microsoft.com/en-us/library/aa260621(v=sql.80).aspx
removes rows table without logging individual row deletes.
syntax:
truncate table [your_table]
as @rahul suggests in comments, use drop table [your_table]
if no longer plan use table in question. truncate
option empty table leave in place if wanted continue use it.
with regards space issue, both of these operations comparatively quick , space reclaimed, won't happen instantly. when using truncate
, data still has deleted, sql server deallocate data pages used table , use background process perform clean afterwards.
this post should provide useful information.
Comments
Post a Comment