Package Explorer
Executing Code Packages

Executing Code Packages

Before executing a code package, please ensure that all scripts and their associated Containers are configured properly in the package. Also, if you have more than a single Environment in the Container Manager, make sure that the active Environment is set properly and that it is the Environment against which you wish to deploy the code package. Please refer to the section Configuring Code Packages for more information. The following list contains a summary of key items that should be verified prior to package deployment:

    1. Check the order of scripts in the package: Since scripts are executed according to their order in the package, make sure that all SQL object dependencies (if any) are followed throughout the package and reorder the package scripts as needed.

    2. Make sure that scripts are mapped to the correct Containers.

    3. Check the authentication type and credentials of Containers referenced in the package for your Environment in the Container Manager. The Container authentication type and credentials will be used to connect and deploy code on all target databases in the Container.

    4. Make sure that checkboxes next to all scripts that you wish to deploy are check and uncheck unwanted scripts.

Important Tip: You can simplify your packages by using folders and associating a Container with the folder. Then, only place scripts under the folder if you wish to deploy them on the databases of the Container associated with the folder and set the Container associated with each script to "Use Parent Settings" (which is also the default; See Associating a Container with Package Scripts and Folders). The code package will then become more structured and readable and will be easier to manage, and remember that you can use any number of folders in the package.

Figure 94:  Using folders to well-organize and easily configure the package.

The entire code package is executed by pressing CTRL+F5, or by selecting Package → Execute from the main menu. You can also direct Combine to return the actual execution plan for the package by selection Package → Include Actual Execution Plan from the main menu or pressing CTRL+SHIFT+M. Also note that you can return the estimated execution plan from all databases and servers in which case the steps below will still be followed however code will not be deployed on target databases and only estimated execution plans will be returned.

Figure 95:  Executing a code package.

When a package is executed, Combine performs the following actions and verifications. If any of the checks listed below are not successful, Combine will alert you and will not deploy the package.

Check that the authentication type and credentials are available for all databases. Recall that Containers can be configured to use several authentication types, namely SQL authentication, Windows authentication or Prompt (see the Static Container Wizard and Dynamic Container Wizard sections for more information). Also you are able to modify all SQL server connection options using Advanced button.

If any Containers referenced in the package are set to use the Prompt authentication type then you will be prompted to enter the authentication type to use to connect to all Container databases, for each such Container. If you choose SQL authentication type you will also be asked to provide a login name and password. These credentials will not be stored by Combine and are only used in run-time to connect and deploy the code on all databases. On the other hand, you will not be asked to provide the authentication and credentials for all referenced Containers that use SQL authentication or Windows authentication since the authentication and credentials entered in the Container Manager will be used. The image below illustrated the credentials window displayed by Combine when the Prompt authentication type is used for all Containers referenced in the package. You can choose different credentials for each Container or use the same credentials for all Containers. After you enter the credentials in this dialog you must hit the Apply button and then OK to continue.

Figure 96:  Providing the authentication type and credentials for all Containers referenced in the package that use Prompt authentication type.

Resolve all target databases, verify connection and authentication to all target databases and allow the user to deselect databases. At this point Combine has the authentication type and all connection attributes needed to resolve the target databases for all package scripts. First, Combine resolves all target databases: For Static Containers, Combine will retrieve the database and server names from the Container Manager. If Dynamic Containers are referenced in the package then Combine will run the Dynamic Container query against the Reference Static Container for each Dynamic Container to retrieve the database and server names for all target databases (please refer to Static vs. Dynamic Containers to learn more about Container types). After all database and server names are resolved, Combine will attempt to connect to all databases to verify that they indeed exist and that the authentication type provided for the Container in the Container Manager (or in the dialog in the last image) can be used successfully. The results of the connectivity test are then presented in another dialog, which also allows you to deselect Container databases. If a database is deselected for a given Container then Combine will not run the script associated with that Container on the deselected database, and will still run code on all other Container databases. Also note that databases that cannot be connected successfully (due to timeouts or wrong credentials provided in Combine) will be marked in grey and deselected automatically. You can reselect these databases to try to deploy code against them however this is highly not recommended. To demonstrate the connectivity test dialog, below are two examples of the dialog when the connectivity to all Container databases is successfully verified, and when one server is down so that its databases cannot be contacted.

Figure 97:  Database connectivity and authentication validation dialog when Combine connected to all databases in all Containers referenced in the package successfully. You can deselect databases in this dialog to not run code against the deselected databases.

Figure 98:  Database connectivity and authentication validation dialog when ProdSvr3 server is down so that not all databases of Containers referenced in the package can be contacted.

Please be aware that this Validate Databases dialog is the last dialog displayed prior to the execution of all the code in the package. If for any reason you wish to abort the code deployment then press Cancel in this dialog. If you press OK then package scripts will be executed according to their order in the package and each script will be run on all the checked databases in its associated Container. The image below demonstrated the case where Cancel is pressed after the connectivity test. Notice that the connectivity results are displayed in the Package Output window.

Figure 99:  The Package Output window and connectivity test results after execution is aborted. The Start and Finish entries in the image refer to the connectivity verification and no code is deployed after the package execution is aborted.

Deploy code on all selected databases and return execution plans and results. At this point, Combine will deploy all scripts against all target databases that were not unchecked in the last dialog. Result sets with matching schema returned from the target databases will be aggregated and displayed in the Package Results window, where results for each individual database are available as well. If you also requested to return the actual execution plans then the execution plans will be available for each individual target database. If any execution errors occur due to incorrect SQL code then package execution will pause and ask you whether you wish to continue, and you can view all steps that were taken by Combine in the Package Output window. Furthermore, error details and messages (such as row counts) returned from all servers can be found in both the aggregated messages window and the messages window for each database. The Package Output window can also be viewed during code execution to monitor the execution status. Below is an example of the aggregated results and individual results for each database when Combine was instructed to return the actual execution plans.

Figure 100:  Viewing the aggregated results returned from all target databases for each package script.

Figure 101:  Viewing the execution plans returned from each target database.

© 2001-2018 JNetDirect, Inc. All Rights Reserved.