This question doesn’t make very much sense because ordinarily in a solar power system if you have grid power, your panels will feed your battery bank through a solar management device, and battery charger. And then any excess from charging would be turned into AC for your home and grid. If you are pulling enough the net flow of power is out of solar, into your home, and out of street, into your home, that’s all there is to it. You would be consuming power. Your battery system will not turn on if you have grid power and your solar will turn off, typically, when you lose grid power. How you have solar connected to battery, whether they are in line or disjoint systems, dictates whether you will have solar powering your home in a power outage. In a power outage to prevent back feeding to the street and endangering line workers, a manual or auto transfer switch must be thrown before your battery bank can energize your home’s power.
Another reason you almost certainly don’t want to have your battery feeding the grid, other than it being a bad and cost inefficient way of handing power, is that very few if any consumer grade inverter systems have the ability to perfectly sync phase, output clean sine wave (less of a big deal than the previous and next point), and also be aware of when the power goes out, so you can protect yourself and others in that event.
For lack of ground in UPS units, I’m also not understanding your question. Why would you lack a ground for a UPS? Even when the internal transfer switch is thrown into battery backup your ground will be shared and connected to your home. Ofc unless you disconnect it from the wall. Then, yeah if you care about a ground then you can always connect it to the UPS via the power plug, or also bond any connected devices to earth at home.