2. Given the function $y=\left(a \cos ^{2} x-3\right) \sin x$ has a minimum value of -3. Then the range of the real number $a$ is $\qquad$
2. $-\frac{3}{2} \leqslant a \leqslant 12$.

Let $\sin x=t$. Then, the original function becomes $g(t)=\left[a\left(1-t^{2}\right)-3\right] t$.
From the fact that the minimum value of $g(t)$ in $[-1,1]$ is -3, we get $a t\left(1-t^{2}\right)+3(1-t) \geqslant 0$,
which means $(1-t)[a t(1+t)+3] \geqslant 0$.
Thus, $a\left(t^{2}+t\right) \geqslant-3$.
When $t=0,-1$, inequality (1) always holds;
When $0<t \leqslant 1$, $0<t^{2}+t \leqslant 2$;
When $-1<t<0$, $-\frac{1}{4} \leqslant t^{2}+t<0$.
Therefore, $-\frac{3}{2} \leqslant a \leqslant 12$.