Ergodic system has a.e. dense orbits One more question:
Let $X$ be a metric space with probability measure $\mu$ and $T\colon X \to X$ ergodic.
$\Rightarrow f$.a.e. $x$ the orbit  $O_x=\{T^n(x) : n \in Z\}$ is dense in $X$.
So I have to show that the set $B$ containing all x for which $O_x$ is not dense has measure 0. Obviously $B$ is $T$-invariant, since $O_x$ is $T$-invariant for all $x$.
A set is dense in $X$, if it has nonempty intersection with all open sets of $X$ (maybe I can use here the special structure of $X$ as a metric space?). Poincare's theorem is given as a hint.
Since the system is ergodic I know that $\mu(B)$ and $\mu(B^c) \in \{0,1\}$.  
 A: If the space has a countable basis and for the measure $\mu$ any open set has positive measure we can have this result as proved below, in other case there may be counterexample.
Since $X$ is a metric space, we can find countable basis $\{U_j\}_{j=1}^{\infty}$. Not that if for $x\in X$, the orbit of $x$ is not dense, then there exists some $U_j$ such that $\{T^n(x):n\in \mathbb{Z}\}\cap U_j=\emptyset$ so $$x\in A_j=X-\cup_{i=0}^{\infty}T^{-i}U_j.$$ So the set of $X$ such that the orbit of $x$ is not dense is contained in the set $\cup_{j=1}^{\infty} A_j$. Note that $A_j$ is $T$-invariant and has a empty intersection with $U_j$ so $\mu(A_j)=0$ since $U_j$ has positive measure. And so $\mu(\cup_{j=1}^{\infty} A_j)=0$ and the proof is completed.
A: The claimed property does not hold in general, even for $X$ compact metric (which would have a countable base). Just take $T$ to be a rational rotation of the circle, i.e. $T(x)=x+p/q \mod 1$ (with $p,q\in\mathbb N$), then clearly all points are periodic and the measure of the set of points having dense orbits is zero (because there are none at all). Here an ergodic measure would be the uniform measure in a single periodic orbit.
Denseness of orbits is a topological property, so you would either need an additional topological assumption or something stronger on the measure to conclude this.
Poincare's recurrence theorem only gives that almost every point returns to a neighborhood of itself (and this happens infinitely many times along the forward orbit). By the way Poincare recurrence also only holds for compact metric spaces. Think of a transformation like $x\mapsto x+1$ on the (non-compact) real line and take Lebesgue measure. No point returns close to itself, the system is not recurrent.
