This will list the site collection in a file called sites.xml, which can be used by other stsadm commands, such as mergecontentdbs
stsadm -o enumsites -url http://MySharePointSite > C:\sites.xml
Note that this can take a long time if there are many site collections - it takes 2 hours on my SharePoint system.
Edit: Added commands for websites:
For websites, you can use the enumsubwebs command, passing it the root URL of the site collection to list:
stsadm -o enumsubwebs -url http://MySharePointSite
- - , - -. - .
- enumallwebs:
stsadm -o enumallwebs -databasename MyContentDatabaseName
, .