Does the relative discriminator always exist? We know that if $\mathbb{Q}\subset K \subset L$ with $[L:K]=n$, then  $O_{L}=a_{1}O_{K}+\cdots + a_{n}O_{K}$    if and only if $O_{K}$ has class number $1$. But what happens if there is no relative integral basis 
1.- How can I calculate the relative discriminant if there is no relative integral basis?.
2.- Does the relative discriminator always exist?
3.- What does it mean that the relative discriminant is generated by an unit?, Does it mean that there is no relative integral basis?.
See the following example
sage: alpha=sqrt(-17/2 + sqrt(17^2-4(17))/2)
sage: f=alpha.minpoly()
sage: K.<a>=NumberField(x^4+17*x^2+17)
sage: R<y>=PolynomialRing(K)
sage: R(f).factor()
(y-a)(y+a)(y^2+a^2+17)

sage: g=y^2+a^2+17
sage: L.<b>=K.extension(g)
sage: L.relative_discriminant()
Fractional ideal (1)

 A: In this context, the relative discriminant exists as an ideal of $O_K$,
but this ideal is not necessarily principal. If $\newcommand{\gp}{\mathfrak{p}}\gp$
is a prime ideal of $O_K$, then the $\gp$-adic localisation $O_{L,\gp}=O_L\otimes
O_{K,\gp}$ is a free module over the local ring $O_{K,\gp}$. It has a discriminant,
$\Delta_\gp$. Let $e_\gp$ denote the highest power of the maximal ideal of $O_{K,\gp}$ dividing $\Delta_\gp$. Then $e_\gp$ is zero save for finitely
many primes (the ramified primes) and the product of the $\gp^{e_p}$ is an ideal
of $O_K$. When $O_L$ is free, this ideal is generated by the discriminant, so
in general serves as a discriminant ideal for the extension $L/K$.
A: Your first question is answered in Wikipedia – the relative disciminant is the ideal of $\mathcal{O}_K$ generated by all the discriminant like quantities coming from all the $K$-bases $\subseteq\mathcal{O}_L$ of $L$. Observe that in the WP-article $K$ is the bigger field, so we need to adjust the notation to match with that.
Let me describe an IMO interesting example of $K=\Bbb{Q}(\sqrt{-5}), L=K(i)$, chosen because in this case you surely know that $\mathcal{O}_K$ is not a PID. It is not too difficult to show that this time $\mathcal{O}_L$ is the $\Bbb{Z}$-span of $1,i,(1+\sqrt5)/2$ and $i(1+\sqrt5)/2$. Here $L/K$ is Galois, the non-trivial $K$-automorphism $\sigma$ determined by $\sigma(i)=-i$ and hence also $\sigma(\sqrt5)=-\sqrt5$.
We see that $\mathcal{B}_1=\{1,i\}$ is $K$-basis of $L$ consisting of algebraic integers. To $\mathcal{B}_1$ we associate the element
$$
\Delta_{\mathcal{B}_1}=\left|\begin{array}{cc}1&i\\\sigma(1)&\sigma(i)\end{array}\right|^2=\left|\begin{array}{cc}1&i\\1&-i\end{array}\right|^2.
$$
We calculate that $\Delta_{\mathcal{B}_1}=(-2i)^2=-4$, so $-4$ is an element of the relative discriminant ideal $\Delta_{L/K}$.
Let's see what happens with another $K$-basis $\mathcal{B}_2=\{1,(1+\sqrt5)/2\}$ of $L$ consisting algebraic integers. This time the discriminant-like element is
$$
\Delta_{\mathcal{B}_2}=\left|\begin{array}{cc}1&\frac{1+\sqrt5}2\\\sigma(1)&\sigma(\frac{1+\sqrt5}2)\end{array}\right|^2=\left|\begin{array}{cc}1&\frac{1+\sqrt5}2\\1&\frac{1-\sqrt5}2\end{array}\right|^2=(-\sqrt5)^2=5.
$$
So $5\in\Delta_{L/K}$ also. Obviously $1=5+(-4)$ is then in the ideal $\Delta_{L/K}$ also. Because $\Delta_{L/K}\subseteq \mathcal{O}_K$ we can deduce that $\Delta_{L/K}$ is the entire ring of integers, as an ideal generated by $1$.
I don't think the ideal $\Delta_{L/K}$ is always principal, but I cannot give a simple example right away, so leaving the second question for other answerers.
The above example extension turned out to be an example of the situation in your third question. Whenever $\Delta_{L/K}$ is generated by $1$, it follows that the extension $L/K$ is unramified. Really, the relative discriminant contains the information about the ideals of $\mathcal{O}_K$ that ramify in $L$. To make this theory complete, we need a way of defining a ramification for infinite primes. See books on class field theory for more. I learned quite a bit from J.S.Milne's lecture notes, but I'm sad to say I'm anything but conversant with this beautiful theory. Anyway, in our example case it turns out that $L$ is the maximal abelian unramified extension of $K$ (aka the Hilbert class field of $K$). And the fact that $[L:K]=2=h(K)$ is equal to the order of the class group of $K$ is not a coincidence, but rather an instance of one of the main results of class field theory.
