The theory of standard bases in polynomial rings with coefficients in a ring with respect to local orderings is developed. Then the generalization of F4-Algorithm for polynomial rings with coefficients in Euclidean rings is given. This algorithm computes successively a Gröbner basis replacing the reduction of one single s-polynomial in Buchberger's algorithm by the simultaneous reduction of several polynomials. And finally we present an algorithm to compute a primary decomposition of an ideal in a polynomial ring over the rings. For this purpose we use algorithms for primary decomposition in polynomial rings over the rationals resp. over finite fields, and the idea of Shimoyama--Yokoyama resp. Eisenbud--Hunecke--Vasconcelos to extract primary ideals from pseudo-primary ideals.