This is just a homework problem on classical mechanics with respect to the lagrangian perspective. Below I quote the problem.
Two masses $m_1$ and $m_2$ are conected by an ideal string $l$ that passes through a hole in a table. The mass $m_1$ is above the table (so $m_2$ is hang on the other extreme of the string) and there are no friction in the problem. We have that $m_2$ moves only vertically. $(a)$ What is the initial velocity of $m_1$ such that $m_2$ keep hold still a distance $z$ from the table. $(b)$ If $m_2$ varies vertically in small changes there will be small oscillations effects. Using Euler-Lagrange equations determine the small oscillations period.
For the first part I just note that the tension is the same in the entire string then $mg = F_{cp}$ where this $F_{cp}$ is the so called centripetal force then $m_2g = m_1v^2/(l-z)$. So $v^2 = (m_2/m_1)g(l-z)$. This is the initial velocity such that the system maintains in an equilibrium. But the second part is of some trouble. To construct the lagrangian in a classical way ($T-U$ for all classical-mechanical systems) we will have the kinetic energies
$$T_1 = \frac{m_1\dot{z}^2}{2}+\frac{m_1(l-z)^2\dot{\theta}^2}{2}$$
$$T_2 = \frac{m_2\dot{z}^2}{2}$$
and the potential energy with respect to the table
$$U_2 = -m_2gz$$
Then we construct the lagrangian function
$$\mathcal{L} = \frac{(m_1+m_2)}{2}\dot{z}^2 + \frac{m_1(l-z)^2}{2}\dot{\theta}^2 + m_2gz$$
and the part of the small oscilations I could not get because it is clear that we will have something with the $\dot \theta = $ constant. But then I'm having trouble with the effective potential because the second derivative is becoming zero. Can someone help me with any hints? Thanks!
[This is based on your Lagrangian, which I did not verify.]
Find first the equations of motion for $z$ and $\theta$. In particular: $$ \frac{d}{dt}\frac{\partial L}{\partial \dot\theta}-\frac{\partial L}{\partial \theta}=\frac{d}{dt}\frac{\partial L}{\partial \dot\theta}=0 $$ so that $$ p_\theta=\frac{\partial L}{\partial \dot\theta}= m_1(l-z)^2\dot\theta\, .\tag{1} $$ is constant. Insert (1) into the EOM for $z$: \begin{align} (m_1+m_2)\ddot{z}+m_1(l-z)\dot{\theta}^2-m_2g&=0\, ,\\ (m_1+m_2)\ddot{z}-\left(m_2g-\frac{p_\theta^2}{m_1(l-z)^3}\right)&=0\, . \tag{2} \end{align} The equilibrium position occurs when $$ -\frac{dV_{eff}}{dz}\vert _{z=z_0}=0=m_2g-\frac{p_\theta^2}{m_1(l-z_0)^3} $$ from which you can find $z_0$ and recover the small oscillation by expanding (2) about this point to leading order in $\Delta z=z-z_0$.