TITLE: Is there a connected non-affine scheme $S$ such that it is the union of rings of integers of number fields?
QUESTION [9 upvotes]: I was woolgathering about the notion of a scheme, and it occurred to me that I know of no non-affine scheme $S$ that is the union of $Spec(O_K)$'s of some number field $K$ (I allow $K$ to vary - so that $S$ might be $Spec(O_K)\cup Spec(O_L)$ for example).
It would an interesting notion if one could patch rings of integers together to form some non-affine $1$-dimensional normal scheme $S$. The fact that I've never seen an example makes me think it's impossible.
Question
Is there a connected non-affine scheme $S$ such that it is the union of open subschemes of it that are $Spec$'s of rings of integers of number fields?
More pointedly, if $Spec(O_K)$ (the ring of integers of some number field $K$) is an open subscheme of a normal scheme $S$ then is it equal to it?

REPLY [28 votes]: If $i: \mathrm{Spec}(O_K)\to S$ is an open immersion into a connected separate scheme $S$, then $i$ is an isomorphism. Indeed, the canonical morphism $\pi : \mathrm{Spec}(O_K)\to \mathrm{Spec}(\mathbb Z)$ is finite (hence proper) and can be decomposed into $i$ followed by the canonical morphism $S\to \mathrm{Spec}(\mathbb Z)$. As the latter is separated, this implies that $i$ is also proper, hence closed. The connectedness of $S$ implies that $i$ is onto.