If I am not mistaken, we *always* have $\mathrm{Ext}^2(\mathcal I_Z,\mathcal O_Z)=0$ for any closed subscheme $Z\subset X$, so the question is somewhat vacuous.

We have an exact sequence

$$0\to \mathcal I_Z \to \mathcal O_X \to \mathcal O_Z\to 0,$$

and applying $\mathrm{Hom}( -,\mathcal O_Z)$ gives a surjection $$\mathrm{Ext}^2(\mathcal O_X,\mathcal O_Z)\to \mathrm{Ext}^2(\mathcal I_Z,\mathcal O_Z)\to 0.$$ But $\mathrm{Ext}^2(\mathcal O_X,\mathcal O_Z) = H^2(\mathcal O_Z)$, which vanishes since the support of $\mathcal O_Z$ has dimension at most $1$.

(Edit addressing your comment below:

If $X$ is a threefold and $Z$ has dimension at most $1$, it is still true that $\mathrm{Ext}^i(\mathcal O_X,\mathcal O_Z)=0$ for $i=2,3$, so $\mathrm{Ext}^2(\mathcal I_Z,\mathcal O_Z) = \mathrm{Ext}^3( \mathcal O_Z,\mathcal O_Z)$. But $$\mathrm{Ext}^3(\mathcal O_Z,\mathcal O_Z) = \mathrm{Hom}(\mathcal O_Z , \mathcal O_Z \otimes K_X) = H^0(K_X|_Z),$$ which is typically nonzero.)