How to get a list of blogs with ID's?

How can you produce a list of active blogs with their ID’s ?

I need to clean out a problem database and get rid of tables from defunct blogs.