SQL Server – Using Logins and Jobs for Migration via Backup/Restore

sql server

In sql server when we expand security, expand logins, there is list of logins.

Are all these stored in the master db?

If so, then when migrating to another server, if we backup this master db and restore to the new server, then will the logins get migrated to the new server?

Similarly SQL server jobs, schedules, etc are stored in the msdb? Can this be backup/restored to migrate the jobs to the new server?

If not, then what is the purpose of doing a backup of these system dbs?

Best Answer

Simply answering your questions is not the solution to your questions.

Are all these stored in the master db?

Yes. (Well sort of)

If so, then when migrating to another server, if we backup this master db and restore to the new server, then will the logins get migrated to the new server?

No. It is recommended to transfer the SQL Server Logins using the procedure documented by Microsoft. See also the Q&A Transfer logins to another server which includes various links and where they discuss in the comments, that restoring the master database can break things.

Similarly SQL server jobs, schedules, etc are stored in the msdb? Can this be backup/restored to migrate the jobs to the new server?

I would also recommend to right-click the jobs and script them out to ensure they are created correctly on the new server.

Even though the msdb is slightly less relevant for a functioning SQL Server instance, the newer versioned msdb could still contain elements (columns, tables, ...) that are not available in older versions.

If not, then what is the purpose of doing a backup of these system dbs?

When your server system crashes and you want to restore the whole SQL Server instance, then you would require the master database to restore all the databases, logins, etc. and the msdb database to have all the jobs back.