In symfony 6 or higher, this can be handled without managing multiple doctrine connections:
$isolatedEm = new EntityManager(
conn: $entityManager->getConnection(),
config: $entityManager->getConfiguration(),
eventManager: $entityManager->getEventManager(),
);
// get original data using $isolatedEm
// do what you need with data
$isolatedEm->close();
I needed this to accurately compare normalized data before and after changes. I don't know if this will work with all DBs, I am using postgres.