Otherwise, master must be backed up more frequently. Use Data Protection for SQL to restore the master. Back up the master database as soon as possible after the following operations: Creating, modifying, or dropping any database Changing server or database configuration values Modifying or adding logon accounts Do not create user objects in master. Start the SQL Server in single-user mode. USE master isn't always necessary, but sometimes it is, and it doesn't hurt to always execute server-level commands from that database. Run the SQL Server setup program to rebuild the master database. Certain types of certificate, server audit, and Availability Group operations.Starting with SQL Server 2005, these objects are stored in the resource database, which is a hidden, read-only system database. Marking a module as a system object ( sp_MS_marksystemobject) or as a startup procedure Well, while in older versions of SQL Server, such as SQL Server 2000, the master database contained the system objects, in newer versions this data is no longer stored in the master database.Granting server-level permissions like CREATE DATABASE.Preventing errors when a script has a USE command but that user database may be offline or otherwise inaccessible.Setting a database to a different state, like single_user USE master GO CREATE DATABASE Sales ON ( NAME Salesdat, FILENAME 'C:\Program Files\.\saledat.mdf', SIZE 10, MAXSIZE 50, FILEGROWTH 5 ) LOG ON ( NAME Saleslog, FILENAME 'C:\Program Files\.\salelog.There are plenty of other scenarios outside of database creation that also require either (a) not being in the context of the current database, or (b) being in the context of master specifically (or at least not a specific database), and many of these things you may be doing during or around creating databases: If you're creating a database called Sales, and you arelady have a database called Sales, you'll need to change your database context before you: It is absolutely not a requirement in this very specific case, but it is a requirement in many other scenarios. Hi Thinktank, Welcome to Microsoft Q
0 Comments
Leave a Reply. |