SQL Server error 917 means a batch in an upgrade script failed to execute, which usually happens when the database engine is partway through applying an upgrade and one batch cannot run. The fastest fix is to read the SQL Server error log and the upgrade log for the exact batch and error number, correct the underlying cause, and then rerun the upgrade or restore from a backup and retry. Do not keep rerunning the upgrade blindly; each attempt can leave the instance in a partially upgraded state.

What You'll Need

  • Administrative access to the Windows server or Linux host running SQL Server.
  • Membership in the sysadmin fixed server role, or an account that can read the error log and start the service.
  • A current full backup of every user database plus the system databases, taken before any upgrade attempt.
  • Access to the SQL Server error log and the setup or upgrade summary log.
  • The original installation media or setup bootstrap folder used for the upgrade.

Step-by-Step

  1. Stop and do not retry yet. A failed upgrade script batch means the instance may be partially upgraded. Rerunning setup immediately can make the state harder to recover, so pause and gather information first.
  2. Open the SQL Server error log. In SQL Server Management Studio, connect to the instance and expand Management > SQL Server Logs, then open the current log. The exact menu labels can differ slightly by version and by whether you use SSMS or Azure Data Studio. On Linux, read the error log file in the SQL Server log directory instead.
  3. Find the batch that failed. Search the log for error 917 and for the message that follows it. Note the error number, the batch text if it is included, and the database context. The error log usually records the underlying error (for example a permission problem, a missing object, or a file growth failure) next to the 917 message.
  4. Check the setup or upgrade summary log. SQL Server setup writes a summary log in the setup bootstrap log folder, typically under Program Files\Microsoft SQL Server\<version>\Setup Bootstrap\Log. Open the most recent Summary.txt and the detail log it references. These logs name the script file and batch that failed, which is more precise than the error log alone.
  5. Identify the cause from the underlying error. Common causes include the service account lacking permission to a directory, insufficient disk space for the transaction log or tempdb, a database in a state that blocks the script (offline, suspect, read-only, or restoring), or a schema object that conflicts with the upgrade script. Match the error number to the cause before changing anything.
  6. Fix the specific cause. Free disk space, correct NTFS or file permissions for the SQL Server service account, bring any offline or suspect database online if it is safe to do so, or resolve the conflicting object. Do not drop or alter system objects to force the script through; that can break the instance.
  7. Confirm the instance state. Check the SQL Server error log for the startup messages and confirm the instance starts and accepts connections. Query the version and edition to see whether the upgrade completed or stopped partway. If the instance will not start, do not attempt further upgrades until it does.
  8. Rerun setup or restore, depending on state. If the upgrade did not complete and you have a verified backup, restore the system and user databases to the pre-upgrade state and rerun setup from the original media. If the upgrade completed except for one non-critical batch, follow the vendor guidance in the setup log rather than improvising. When in doubt, restoring and retrying from a clean state is safer than patching a half-upgraded instance.
  9. Verify after the upgrade. Once setup reports success, check the error log again for new errors, run DBCC CHECKDB on user databases, and confirm that applications connect and run their normal queries. Keep the setup logs until you are satisfied the instance is healthy.

Common Mistakes

  • Rerunning the upgrade repeatedly without reading the logs, which can leave the instance in a worse partial state.
  • Ignoring the underlying error number and treating 917 as the root cause; 917 is a wrapper that points to a real failure.
  • Skipping a backup before the upgrade, which removes the safest recovery option.
  • Changing or dropping system objects to make a script pass, which can corrupt the instance metadata.
  • Running setup under a different account than the one that owns the instance, which can create permission problems mid-upgrade.

Tips

  • Read the setup summary log first; it names the exact script and batch, which saves time over searching the error log.
  • Check free space on every drive that holds data, log, tempdb, and backup files before starting an upgrade.
  • Take a full backup plus a tail-log backup of any database in full recovery model before upgrading.
  • Run the upgrade during a maintenance window so a failure does not overlap with production traffic.
  • Keep the setup bootstrap logs after a successful upgrade; they are the first place to look if a later patch fails.

Troubleshooting

If the instance will not start after the failed batch, check the error log for startup errors before doing anything else. A common cause is a database that cannot be recovered; bringing it online or restoring it may be required. If the error log does not name the batch, the setup detail log usually does. If the underlying error is a permission problem, confirm the SQL Server service account has full control on the data, log, and backup directories, then retry. If disk space was the cause, free space and rerun setup; do not delete files from the SQL Server directories to make room. If the upgrade is stuck and you cannot determine the state, restore the pre-upgrade backup and start over from a known-good point. If the instance is a cluster or an availability group, follow the vendor's guidance for patching in a rolling manner rather than upgrading a single node in isolation.

Frequently Asked Questions

What does SQL Server error 917 actually mean?

It means a batch in an upgrade script failed to execute. The message is a wrapper; the real cause is the error number reported alongside it in the log.

Can I just rerun the upgrade to fix it?

Only after you have read the logs and fixed the underlying cause. Rerunning without a fix usually reproduces the same failure and can leave the instance more partially upgraded.

Where are the upgrade logs?

Setup writes a summary and detail log in the setup bootstrap log folder, usually under Program Files\Microsoft SQL Server\<version>\Setup Bootstrap\Log. The SQL Server error log is separate and is read through SSMS or the log directory.

Do I need a backup before retrying?

Yes. A full backup of user and system databases gives you a clean restore point if the retry fails or leaves the instance in an inconsistent state.

Will error 917 corrupt my data?

Not by itself. The risk comes from a partially applied upgrade or from improvised fixes. Restoring from backup and retrying from a clean state is the safest path.

Does this apply to Azure SQL Database?

No. Error 917 is an on-premises or IaaS SQL Server upgrade error. Managed cloud databases handle upgrades internally and do not expose this setup process.