Skip to content

Instantly share code, notes, and snippets.

@jkordish
Created July 25, 2013 18:13
Show Gist options
  • Save jkordish/6082303 to your computer and use it in GitHub Desktop.
Save jkordish/6082303 to your computer and use it in GitHub Desktop.
Clean up the OpenStack Nova Database -- I think I found some of this somewhere else online but can't recall the source. Putting here for perpetuity
DELETE FROM security_group_instance_association WHERE id IN (SELECT id FROM instances WHERE deleted = "1");
DELETE FROM block_device_mapping WHERE instance_uuid IN (SELECT uuid FROM instances WHERE deleted = "1");
DELETE FROM instance_info_caches WHERE instance_uuid IN (SELECT uuid FROM instances WHERE deleted = "1");
DELETE FROM instance_system_metadata WHERE instance_uuid IN (SELECT uuid FROM instances WHERE deleted = "1");
DELETE FROM virtual_interfaces WHERE instance_uuid IN (SELECT uuid FROM instances WHERE deleted = "1");
UPDATE fixed_ips SET allocated = 0 WHERE instance_uuid IN (SELECT uuid FROM instances WHERE deleted = "1");
DELETE FROM instances WHERE deleted = "1";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment