SQL DBA Blog: Home

  • DBA Scripts: Generate User Mapping Script

    Part of the DBA-Tools Project. Recreating Database Users, Roles, and Role Memberships for a Migration Moving a SQL Server workload to a new instance means recreating every database user, custom role, and role membership, unless you script it. This script loops over every online, writable user database on the source and produces, in order, ALTER…

    read more

  • DBA Scripts: Generate Agent Job Script

    Part of the DBA-Tools Project. Recreating Every SQL Agent Job for a Migration, in the Right Order Moving a SQL Server workload to a new instance means recreating every SQL Agent job, unless you script it, and getting the order wrong (steps before the job header, schedule before the start step) is exactly the kind…

    read more

  • DBA Scripts: Generate Login Script

    Part of the DBA-Tools Project. SID-Preserving Login Recreation for a Migration Moving a SQL Server workload to a new instance means recreating every login, unless you script it, and doing it wrong means restored databases end up with orphaned users the moment a login’s SID doesn’t match the original database user’s SID. This script reads…

    read more

  • DBA Scripts: SQL Server Maintenance Job Framework

    Part of the DBA-Tools Project, in the Maintenance and Automation area. If you’re already running Ola Hallengren’s maintenance solution, this framework won’t replace it, but the approach might still be useful: three small, readable T-SQL generator scripts that build the same category of scheduled job framework, full and log backups, backup cleanup, DBCC CHECKDB, index…

    read more

  • DBA Scripts: Generate Index Maintenance Jobs

    Part of the DBA-Tools Project. A Readable Generator for Index Rebuilds and Statistics Updates If you’re already running Ola Hallengren’s maintenance solution, this won’t replace it, but the approach here might still be useful: a small, readable T-SQL generator that builds an index maintenance job framework as plain sp_add_job / sp_add_jobstep DDL you can review…

    read more

  • DBA Scripts: Generate Database Integrity and Housekeeping Jobs

    Part of the DBA-Tools Project. A Readable Generator for Integrity Checks and msdb Housekeeping If you’re already running Ola Hallengren’s maintenance solution, this won’t replace it, but the approach here might still be useful: a small, readable T-SQL generator that builds a housekeeping job framework as plain sp_add_job / sp_add_jobstep DDL you can review line…

    read more

  • DBA Scripts: Generate Backup Jobs

    Part of the DBA-Tools Project. A Readable Generator for Full Backups, Log Backups, and Cleanup If you’re already running Ola Hallengren’s maintenance solution, this won’t replace it, but the approach here might still be useful: a small, readable T-SQL generator that builds a backup job framework as plain sp_add_job / sp_add_jobstep DDL you can review…

    read more

  • DBA Scripts: Generate Migration Scripts

    This post has been split into a pillar and five focused posts, each generator script now has its own page with its own real bugs, Example Output, and Related Scripts, rather than five topics crammed into one long post. Start at the hub: SQL Server Migration Script Generators All five scripts, the repo links, and…

    read more

  • DBA Scripts: Generate Maintenance Jobs

    This post has been split into a pillar and three focused posts, each generator script now has its own page with its own real bugs, Example Output, and Related Scripts, rather than three topics crammed into one long post. Start at the hub: SQL Server Maintenance Job Framework All three scripts, and the repo links,…

    read more

  • DBA Scripts: Get Job Schedules and Duration Trends

    Part of the DBA-Tools Project. When Jobs Run, and Whether They’re Taking Longer to Do It SQL Agent Job Failure Summary tells you what broke. These two scripts answer two quieter but just as important questions: Get-JobScheduleSummary shows exactly when every enabled job is scheduled to run next, useful for spotting overlapping windows or confirming…

    read more