I don't know if this will solve your actual issue. Since you haven't shown us the actual input file, I have no idea if what you are attempting will even work. In any case, to fix the error you're getting, use this:
awk '/CREATE DATABASE/{x="F"++i;}(x){print > x;}' file2
That modifies the script to only attempt to print to file x if the variable x is set. The error you were getting was because it was attempting to print all lines, some of which apparently are before the CREATE DATABASE string at which point x was unset. The script above is equivalent to writing:
awk '{
if(/CREATE DATABASE/){i=i+1; x="F"i;}
if(x!=NULL){print > x }
}' file2