Upload
grsrik
View
217
Download
0
Embed Size (px)
Citation preview
8/10/2019 Database Propertices
1/4
master Database
The master database records all the system-level information for a SQL Server system. This includesinstance-wide metadata such as logon accounts, endpoints, linked servers, and system configurationsettings. In SQL Server, system objects are no longer stored in the master database; instead, they arestored in the Resource database . Also, master is the database that records the existence of all otherdatabases and the location of those database files and records the initialization information for SQLServer. Therefore, SQL Server cannot start if the master database is unavailable.Physical Properties of masterThe following table lists the initial configuration values of the master data and log files. The sizes of thesefiles may vary slightly for different editions of SQL Server.
File Logical name Physical name File growth
Primary data master master.mdf Autogrow by 10 percent until the disk is full.
Log mastlog mastlog.ldf Autogrow by 10 percent to a maximum of 2 terab
For information about how to move the master data and log files, see Move System Databases . The Resource database depends on the location of the master database. If you movethe master database, you must also move the Resource database to the same location.Database OptionsThe following table lists the default value for each database option in the master database and whetherthe option can be modified. To view the current settings for these options, use the sys.databases catalogview.
Database option Default value Can b
ALLOW_SNAPSHOT_ISOLATION ON No
ANSI_NULL_DEFAULT OFF Yes
ANSI_NULLS OFF Ye
ANSI_PADDING OFF Ye
ANSI_WARNINGS OFF Ye
ARITHABORT OFF Ye
AUTO_CLOSE OFF No
AUTO_CREATE_STATISTICS ON Yes
AUTO_SHRINK OFF No
AUTO_UPDATE_STATISTICS ON Yes
AUTO_UPDATE_STATISTICS_ASYNC OFF Yes
CHANGE_TRACKING OFF No
http://msdn.microsoft.com/en-IN/library/ms190940.aspxhttp://msdn.microsoft.com/en-IN/library/ms190940.aspxhttp://msdn.microsoft.com/en-IN/library/ms190940.aspxhttp://void%280%29/http://msdn.microsoft.com/en-IN/library/ms345408.aspxhttp://msdn.microsoft.com/en-IN/library/ms345408.aspxhttp://msdn.microsoft.com/en-IN/library/ms345408.aspxhttp://msdn.microsoft.com/en-IN/library/ms178534.aspxhttp://msdn.microsoft.com/en-IN/library/ms178534.aspxhttp://msdn.microsoft.com/en-IN/library/ms178534.aspxhttp://msdn.microsoft.com/en-IN/library/ms178534.aspxhttp://msdn.microsoft.com/en-IN/library/ms345408.aspxhttp://void%280%29/http://msdn.microsoft.com/en-IN/library/ms190940.aspx8/10/2019 Database Propertices
2/4
CONCAT_NULL_YIELDS_NULL OFF Yes
CURSOR_CLOSE_ON_COMMIT OFF Yes
CURSOR_DEFAULT GLOBAL Yes
Database Availability Options ONLINEMULTI_USERREAD_WRITE
DATE_CORRELATION_OPTIMIZATION OFF Yes
DB_CHAINING ON No
ENCRYPTION OFF No
NUMERIC_ROUNDABORT OFF Yes
PAGE_VERIFY CHECKSUM Yes
PARAMETERIZATION SIMPLE Yes
QUOTED_IDENTIFIER OFF Yes
READ_COMMITTED_SNAPSHOT OFF No
RECOVERY SIMPLE Ye
RECURSIVE_TRIGGERS OFF Yes
Service Broker Options DISABLE_BROKER No
TRUSTWORTHY OFF Ye
For a description of these database options, see ALTER DATABASE (Transact-SQL). RestrictionsThe following operations cannot be performed on the master database:
Adding files or filegroups. Changing collation. The default collation is the server collation. Changing the database owner. master is owned by sa . Creating a full-text catalog or full-text index. Creating triggers on system tables in the database. Dropping the database. Dropping the guest user from the database. Enabling change data capture. Participating in database mirroring. Removing the primary filegroup, primary data file, or log file. Renaming the database or primary filegroup. Setting the database to OFFLINE. Setting the database or primary filegroup to READ_ONLY.
Recommendations
http://msdn.microsoft.com/en-IN/library/ms174269.aspxhttp://msdn.microsoft.com/en-IN/library/ms174269.aspxhttp://msdn.microsoft.com/en-IN/library/ms174269.aspxhttp://void%280%29/http://void%280%29/http://void%280%29/http://void%280%29/http://msdn.microsoft.com/en-IN/library/ms174269.aspx8/10/2019 Database Propertices
3/4
When you work with the master database, consider the following recommendations: Always have a current backup of the master database available. Back up the master database as soon as possible after the following operations:
o Creating, modifying, or dropping any databaseo Changing server or database configuration valueso Modifying or adding logon accounts
Do not create user objects in master . If you do, master must be backed up more frequently. Do not set the TRUSTWORTHY option to ON for the master database.
What to Do If master Becomes UnusableIf master becomes unusable, you can return the database to a usable state in either of the following ways:
Restore master from a current database backup.If you can start the server instance, you should be able to restore master from a full databasebackup. For more information, see Restore the master Database (Transact-SQL) .
Rebuild master completely.If severe damage to master prevents you from starting SQL Server, you must rebuild master . Formore information, see Rebuild System Databases .
Restore the master Database (Transact-SQL)
This topic explains how to restore the master database from a full database backup.
To restore the master database
1. Start the server instance in single-user mode.
For information about how to specify the single-user startup parameter ( -m ), see Configure Server StartupOptions (SQL Server Configuration Manager) .
2. To restore a full database backup of master , use the following RESTORE DATABASE Transact-SQL statement:
RESTORE DATABASE master FROM WITH REPLACE
The REPLACE option instructs SQL Server to restore the specified database even when a database of thesame name already exists. The existing database, if any, is deleted. In single-user mode, we recommendthat you enter the RESTORE DATABASE statement in the sqlcmd utility . For more information, see Usethe sqlcmd Utility .
Important
After master is restored, the instance of SQL Server shuts down and terminates the sqlcmd process. Beforeyou restart the server instance, remove the single-user startup parameter. For more information, seeConfigure Server Startup Options (SQL Server Configuration Manager) .
3. Restart the server instance and continue other recovery steps such as restoring other databases, attachingdatabases, and correcting user mismatches.
Example
http://void%280%29/http://msdn.microsoft.com/en-IN/library/ms190679.aspxhttp://msdn.microsoft.com/en-IN/library/ms190679.aspxhttp://msdn.microsoft.com/en-IN/library/ms190679.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://msdn.microsoft.com/en-IN/library/ms186858.aspxhttp://msdn.microsoft.com/en-IN/library/ms186858.aspxhttp://msdn.microsoft.com/en-IN/library/ms186858.aspxhttp://msdn.microsoft.com/en-IN/library/ms162773.aspxhttp://msdn.microsoft.com/en-IN/library/ms162773.aspxhttp://msdn.microsoft.com/en-IN/library/ms162773.aspxhttp://msdn.microsoft.com/en-IN/library/ms180944.aspxhttp://msdn.microsoft.com/en-IN/library/ms180944.aspxhttp://msdn.microsoft.com/en-IN/library/ms180944.aspxhttp://msdn.microsoft.com/en-IN/library/ms180944.aspxhttp://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://void%280%29/http://void%280%29/http://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://msdn.microsoft.com/en-IN/library/ms180944.aspxhttp://msdn.microsoft.com/en-IN/library/ms180944.aspxhttp://msdn.microsoft.com/en-IN/library/ms162773.aspxhttp://msdn.microsoft.com/en-IN/library/ms186858.aspxhttp://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://msdn.microsoft.com/en-IN/library/ms345416.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/ms190679.aspxhttp://void%280%29/8/10/2019 Database Propertices
4/4
The following example restores the master database on the default server instance. The example assumes that theserver instance is already running in single-user mode. The example starts sqlcmd and executes a RESTOREDATABASE statement that restores a full database backup of master from a disk device:Z:\SQLServerBackups\master.bak.
Note
For a named instance, the sqlcmd command must specify the -S\ option.C:\> sqlcmd1> RESTORE DATABASE master FROM DISK = 'Z:\SQLServerBackups\master.bak' WITHREPLACE;2> GO
See Also
ReferenceRESTORE (Transact-SQL)
ConceptsComplete Database Restores (Simple Recovery Model)
Complete Database Restores (Full Recovery Model)
Troubleshoot Orphaned Users (SQL Server)
Database Detach and Attach (SQL Server)
Rebuild System Databases
Database Engine Service Startup Options
SQL Server Configuration Manager
Back Up and Restore of System Databases (SQL Server)
Start SQL Server in Single-User Mode
Important
Rebuilding master rebuilds all of the system databases.
Related ContentRebuild System Databases System Databases sys.databases (Transact-SQL) sys.master_files (Transact-SQL) Move Database Files
http://void%280%29/http://msdn.microsoft.com/en-IN/library/ms186858.aspxhttp://msdn.microsoft.com/en-IN/library/ms186858.aspxhttp://msdn.microsoft.com/en-IN/library/ms186216.aspxhttp://msdn.microsoft.com/en-IN/library/ms186216.aspxhttp://msdn.microsoft.com/en-IN/library/ms187495.aspxhttp://msdn.microsoft.com/en-IN/library/ms187495.aspxhttp://msdn.microsoft.com/en-IN/library/ms175475.aspxhttp://msdn.microsoft.com/en-IN/library/ms175475.aspxhttp://msdn.microsoft.com/en-IN/library/ms190794.aspxhttp://msdn.microsoft.com/en-IN/library/ms190794.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/ms190737.aspxhttp://msdn.microsoft.com/en-IN/library/ms190737.aspxhttp://msdn.microsoft.com/en-IN/library/ms174212.aspxhttp://msdn.microsoft.com/en-IN/library/ms174212.aspxhttp://msdn.microsoft.com/en-IN/library/ms190190.aspxhttp://msdn.microsoft.com/en-IN/library/ms190190.aspxhttp://msdn.microsoft.com/en-IN/library/ms188236.aspxhttp://msdn.microsoft.com/en-IN/library/ms188236.aspxhttp://void%280%29/http://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/ms178028.aspxhttp://msdn.microsoft.com/en-IN/library/ms178028.aspxhttp://msdn.microsoft.com/en-IN/library/ms178534.aspxhttp://msdn.microsoft.com/en-IN/library/ms178534.aspxhttp://msdn.microsoft.com/en-IN/library/ms186782.aspxhttp://msdn.microsoft.com/en-IN/library/ms186782.aspxhttp://msdn.microsoft.com/en-IN/library/ms189133.aspxhttp://msdn.microsoft.com/en-IN/library/ms189133.aspxhttp://msdn.microsoft.com/en-IN/library/ms189133.aspxhttp://msdn.microsoft.com/en-IN/library/ms186782.aspxhttp://msdn.microsoft.com/en-IN/library/ms178534.aspxhttp://msdn.microsoft.com/en-IN/library/ms178028.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://void%280%29/http://msdn.microsoft.com/en-IN/library/ms188236.aspxhttp://msdn.microsoft.com/en-IN/library/ms190190.aspxhttp://msdn.microsoft.com/en-IN/library/ms174212.aspxhttp://msdn.microsoft.com/en-IN/library/ms190737.aspxhttp://msdn.microsoft.com/en-IN/library/dd207003.aspxhttp://msdn.microsoft.com/en-IN/library/ms190794.aspxhttp://msdn.microsoft.com/en-IN/library/ms175475.aspxhttp://msdn.microsoft.com/en-IN/library/ms187495.aspxhttp://msdn.microsoft.com/en-IN/library/ms186216.aspxhttp://msdn.microsoft.com/en-IN/library/ms186858.aspxhttp://void%280%29/