I am creating scripts of a SQL Server 2012 database because I cannot backup the database to a local drive. I understand how to create the script but at the end of the process the application seems to get stuck at the Save to file = Not Run.
The database is a huge database, but it appears that not much data is being written to the drive.
To save a query: Use the Save command in the application toolbar. In the Save File As window, choose a name and a location to save your query.
Right-click on the database that should be exported. On the "Set Scripting Options" you can choose whether to save or publish the script. Once you customize all the desired save and advanced options, click the "Next >" button. Clicking the "Advanced" button would allow you to customize the exported content.
This appears to be a bug in SQL Server 11.0.6020 tools. There is no trace in event log or server log, the script generator wizard just stops at the last step (which is writing the script to the destination, which can be a file or a new script window - either remains in status "not run" forever, with "Cancel" as the only possible user action).
Some experimenting showed that it indeed depends on script size. I was not able to reproduce the problem on any lower or newer version of Microsoft SQL Server.
The solution is annoying: click yourself through the wizard multiple times, first scripting only database definition in parts:
You can later concatenate the three resulting files if that is a requirement. This approach will not help if any of the three parts alone is bigger than the (unknown) treshold. Eventually, script the data, selecting only smaller sets of tables for each run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With