Monitoring and Managing SQL Server Flashcards
(28 cards)
VIEW SERVER STATE
enables the ability to view current activity, including user activity and recent expensive queries
db_accessadmin
fixed database role. Members of this group can grant or remove access to a database for SQL Server Logins, Windows Logins and Windows Groups
db_securityadmin
fixed database role. Members of this role can manage role membership and permissions. Care should be exercised when assigning this role because it can inadvertently lead to privilege escalation for security principles added to the role
db_ddladmin
fixed database role. This role enables users assigned the role to run any DDL Statement in the database. This includes CREATE, ALTER, DROP, ENABLE TRIGGER, DISABLE TRIGGER, TRUNCATE TABLE, and UPDATE STATISTICS
serveradmin
fixed server role. Members of this role can change server-wide configuration options. Members also have the ability to shut down the server
sysadmin
fixed server role. Members of this role can perform any activity on the server
securityadmin
fixed server role. Members of this role manage logins and their properties including the ability to change passwords for SQL Server Logins
VIEW ANY DEFINITION
Grants the ability to view server-level definitions such as server level audit views
VIEW DEFINITION
grants the ability to view database-level definitions such as database level audit views for a specific database
Role required to run DBCC
User must either be sysadmin or db_owner
REBUILD option with ONLINE = ON will not work on any table with one or more of the following:
XML indexes
Spatial indexes
Columnstore indexes
Which is an online defragmentation method?
DBCC DBREINDEX or DBCC INDEXDEFRAG
Also, why should neither be used?
DBCC INDEXDEFRAG can be used for online defragmentation. Neither should be used due to the commands being scheduled for deprecation
In order for Auto Update Statistics Asynchronously to take effect, what must also be set?
Auto Update Statistics
What does AUTO_UPDATE_STATISTICS_ASYNC do?
When enabled, the query optimizer will not wait for the update of statistics but will run the query first and update the outdated statistics afterwards. The query will run with the current statistics and a background process will start to update the statistics in a different thread.
What is a synchronous statistic update?
The query optimizer will update the outdated statistics before compiling the query therefore possibly getting a better plan based on the most current statistics
When would you use AUTO_UPDATE_STATISTICS_ASYNC?
When a statistic update due to synchronous statistics requires a significant amount of time and your query cannot wait for it to complete
When should you not use AUTO_UPDATE_STATISTICS_ASYNC?
When a sql execution will significantly change the distribution of your data such as truncating a table or running bulk updates
When are statistics considered out of date for versions up to 2014?
Threshold is based on the percent of rows changed. If table cardinality was 500 or less, then update for every 500 modifications. Above 500, for every 500 modifications plus 20%
When are statistics considered out of date for versions 2016 and beyond?
It is determined by the square root of the product of 1000 and the table cardinality. If a table has 2 million rows then sqrt(1000*2,000,000) = 44721.359. So every 44,721 modifications, the stats will update. Previously, it would have updated every 400,500 modifications.
What are the database compatibility levels for each sql server version from 2008 to 2017?
2008 (100) 2012 (110) 2014 (120) 2016 (130) 2017 (140)
Describe the difference between Server Audit, Server Audit Specification and Database Audit?
Server Audit is the outcome or output of the auditing operation. Server Audit Specifications are used to specify which objects need to be audited at the server level. Database Audit Specification is at the database level.
sys.database_query_store_options
used to set the global configuration of the query store
sys.query_store_query
shows information about the aggregated runtime execution statistics for a given query
sys.query_context_settings
show details about the query semantics, including language, date format, cursor options, and schema ID