All layers referencing an enterprise geodatabase or database must share a single connection to that database. This error may trigger even though the source database is the same. For example, if you have multiple connections to the same database and used different connections to add layers to the data frame, this error will result when you analyze.
Make sure that you use a single, common connection to the geodatabase when adding the data to your map or setting the data source for an existing layer.
Learn more about connecting to an enterprise geodatabase
and
database connections in
ArcGIS Desktop