Just leave databases.yml without specify the profiler option and add the following code to the ProjectConfiguration class.
if (0 == strncasecmp(PHP_SAPI, 'cli', 3) || sfConfig::get('sf_environment') == 'cli'){
sfConfig::set('sf_debug', false);
}
Now you will be able to run command line tasks with database intensive actions without worrying about PHP out of memory errors.