Any riemannian manifold with holonony contained in $SU(n) \subset SO(2n)$, $Sp(n) \subset SO(4n)$, $G_2 \subset SO(7)$ and $Spin(7) \subset SO(8)$ are Ricci-flat. There are plenty of non-flat examples; e.g., those with holonomy precisely those groups.
In the Lorentzian setting, you could consider a subclass of lorentzian symmetric spaces with solvable transvection group, the so-called Cahen-Wallach spacetimes. They are pp-waves with metric given in local coordinates by $$ 2 dudv + \sum_{i=1}^{n-2} dx_i^2 + \sum_{i,j=1}^{n-2} A_{ij} x^i x^j du^2 $$ where $A_{ij}$ are the entries of a symmetric matrix. If $A$ is traceless, the metric is Ricci flat, but if $A \neq 0$ then it is non-flat.