For simple harmonic motion, the equation is of the form:
\[
\frac{d^2 y}{dt^2} + \omega^2 y = 0
\]
Comparing with the given equation \( \frac{d^2 y}{dt^2} + 2y = 0 \), we find \( \omega^2 = 2 \). The time period \( T \) is given by:
\[
T = \frac{2\pi}{\omega} = \frac{\pi}{\sqrt{2}}
\]
Final Answer:
\[
\boxed{\frac{\pi}{\sqrt{2}} \, \text{sec}}
\]