Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
74 Cards in this Set
- Front
- Back
sqlserv.exe -d
sqlserv.exe -l
sqlserv.exe -T |
-d switch specifies the DB file
-l switch specifies the log file
-T switch enables you to start given trace flags for all the connections for a SQL Server instance |
|
The syntax for the sqlserver runtime is as follows |
SQLServr.exe [-dmaster_file_path] [-lmaster_log_path] |
|
sqlserv.exe -f
sqlserv.exe -g |
-f switch places SQL Server in minimal mode and only enables a single connection
-g switch reserves additional memory outside SQL Server's main memory pool for use by extended stored procedures, OLE DB providers used by distributed queries, and automation objects used by T-SQL |
|
sqlserv.exe -m sqlserv.exe -k sqlserv.exe -s |
-m switch puts SQL Server in single-user mode and suspends the CHECKPOINT process
-k switch is used to influence the checkpoint frequency
-s switch starts a named instance of SQL Server |
|
By default, SQL Server does not scan for startup stored procedures |
sp_configure ‘scan for startup procs’, 1; |
|
By default, a 2012 instance does not have contained databases enabled. Use sp_configure to enable contained databases prior to migrating an existing database |
sp_configure ‘contained database authentication’, 1; |
|
Rebuilding the System Databases via cmd prompt |
setup.exe /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=instance_name /SQLSYSADMI |
|
SQL Server 2012, your server needs, at a minimum, the following: |
.NET Framework 4.0 |
|
SCC abbr & def |
System Confi guration Checker (SCC)
SCC examines the destination computer |
|
There are two tools to consider as you begin preparing for an upgrade: |
SQL Server Upgrade Advisor and |
|
SQL Server Upgrade Advisor |
SQL Server Upgrade Advisor
The rules checked by Upgrade Advisor represent conditions, situations, or known errors that might |
|
UAFS def and abbr |
Upgrade Assistant for SQL Server 2012 (UAFS)
Upgrade Assistant allows you to test the functionality of applications designed for SQL Server 2005, 2008 or 2008 R2 against Microsoft SQL Server 2012. Upgrade Assistant uses workload testing to identify potential compatibility issues that exist in application source code. These kinds of issues can’t be discovered by just looking at the database and can be difficult, if not impossible to find by just looking at the source code. |
|
SQL Server Confi guration Manager |
SQL Server Configuration Manager configures the SQL Server services much like the Services |
|
sp_confi gure |
sp_configure is a stored procedure that enables you to change many of the configuration options
When you run the stored procedure with no parameters, it shows you the options and their current
sp_configure, as shown here: |
|
Issuing the RECONFIGURE command results in a complete fl ush of the plan cache. |
This gives you an opportunity to reconsider what may have been a bad choice, such as setting a memory option to more memory than exists on the box. The following code shows you how to issue the override for the setting:
EXEC sp_configure ‘recovery interval’, 90; |
|
Activity Monitor |
Activity Monitor |
|
(NOLOCK) |
(NOLOCK) query hint should rarely, if ever, be used in a production environment. If you find that (NOLOCK) is used regularly in your application, find out why dirty reads are necessary, and if they are, address that root issue first before resorting to query hints. One option to consider as an alternative to (NOLOCK) if dirty reads are absolutely necessary is to set the transaction isolation level to SNAPSHOT. |
|
To see all the connections to your server, run |
sp_who2 without any parameters
pass in the parameter of ‘active’ to see only the active connections to your server, like so: |
|
sys.dm_exec_connections |
returns a row per session in SQL Server. Because it’s a DMV, it displays as a table and enables you to write sophisticated queries against the view to filter out what you don’t care about, as shown in the following query, which shows only user connections that have performed a write operation:
|
|
sys.dm_exec_sql_text |
retrieve the text of a particular query. |
|
sys.dm_exec_query_stats |
It shows you a line for each query plan that has been run |
|
To turn on a trace flag, use the |
DBCC TRACEON (1204)
to turn it off DBCC TRACEOFF (1204, 3625)
One method to issue the command is to interrogate whether a given trace is running, like so: |
|
If you want to see all traces that apply to the connection, run the following command with the -1 |
DBCC TRACESTATUS (-1) |
|
SQLDumper.exe |
dump of its environment after an exception occurs
If you want to create a dump fi le on demand, you need the Windows process ID for the SQL Server instance. |
|
To create a full dump, use the |
Sqldumper.exe 0 0x1100 |
|
To create a minidump, use the following command: |
Sqldumper.exe 0 0x0120 |
|
SQLDiag.exe |
This tool consolidates and collects information about your system from several sources:
Windows System Monitor (sysmon) |
|
TCP/IP is disabled by default in what SQL edition |
Developer - in order to reduce footprint
CLR is off by default on all editions |
|
SQL Server Confi guration Manager usage |
SQL Server Configuration Manager configures the SQL Server services much like the Services |
|
“Failed Virtual Allocate Bytes: FAIL_VIRTUAL_RESERVE ”
|
These messages indicate that SQL Server is trying to free up memory pool space to allocate |
|
sp_procoption |
Use the sp_procoption stored procedure to make the stored procedure a startup stored
sp_procoption @ProcName = ‘master.dbo.InsertSQLStartupLog’, |
|
sys.dm_db_uncontained_entities |
Before you migrate a database to a contained model, use the new DMO sys.dm_db_uncontained_ |
|
SET NOCOUNT |
This setting can prevent the (8 Rows Affected) |
|
SQL Server does a check for invalid or not recommended settings when you use sp_configure. If you have provided a value that fails any of these checks, SQL Server warns you with the following message: |
Msg 5807, Level 16, State 1, Line 1 |
|
SQL Server Utility |
This tool enables you |
|
To turn on a trace flag, use the ________________ command, followed by the trace you’d like to turn on, as shown here |
DBCC TRACEON (1204)
DBCC TRACEOFF (1204, 3625) -- (multiple traces can be separated by commas) |
|
After you turn on the traces, you’re probably going to want to determine whether the trace is |
DBCC TRACESTATUS |
|
SQL Nexus Tool |
available from Codeplex at http://sqlnexus.codeplex.com |
|
There are four basic components of SQL Server Agent |
Jobs Schedules Operators Alerts (error logs) |
|
alert is an automated response to an event. An event can be any of the following |
SQL Server event |
|
sp_addmessage stored procedure |
create error messages with the sp_addmessage
sp_addmessage 50001,16 ,‘MESSAGE’, @with_log = ‘TRUE’ |
|
To give other users access to SQL Agent, you must add them to one of three fi xed database roles in the msdb database |
SQLAgentUserRole |
|
SQL Server Agent Subsystems |
SQL Server Agent subsystems are objects that group similar sets of functionality that can be used by SQL Server Agent proxies. These subsystems provide a security boundary that enables a more complex security model to SQL Agent Proxies |
|
You can access mail information in the _____________
Attachments can be accessed
mail log is in _________________ |
You can access mail information in the sysmail_allitems view
Attachments can be accessed
mail log is in sysmail_eventlog
If you are using DBMail and sending mail and attachments, the mail you send and the attachments Microsoft provides stored procedures to delete items from these tables: msdb.dbo. |
|
token in SQL as pertaining to multiserver management |
token is a string literal that you use in your job steps (T-SQL scripts, CMDExec job steps, or Active Script).
PRINT ‘Job Start Date(YYYYMMDD):’ + $ESCAPE_SQUOTE(STRTDT)) |
|
All these tokens must be used with escape macros. The purpose of this |
All these tokens must be used with escape macros. The purpose of this change is to increase the security related to the use of tokens from unknown sources. Consider the following token, which you might have included in a T-SQL job step: The T-SQL job step runs as the result of a user error (raiserror). A malicious user could raise an To combat an attack such as this, you must add an escape macro |
|
To combat an attack such as this, you must add an escape macro |
Print ‘Error message: $(ESCAPE_SQUOTE(A-MSG))’ |
|
The following is a list of escape macros: |
$(ESCAPE_SQUOTE(token)): Doubles single quotes (‘) in the replacement string. |
|
asynchronous messaging |
command is sent and will be processed later when the SQL Server gets around to processing the command |
|
SQL Server Service Broker introduces three new commands that are used to send and receive |
CREATE CONVERSATION DIALOG SEND RECEIVE |
|
A variety of message queuing technologies are available. Microsoft makes two: |
SQL Server Service Broker and Microsoft Message Queue (MSMQ)
The big difference between SQL Server Service Broker and other queuing technologies is that |
|
You can also enable SQL Server Service Broker using T-SQL by using the ALTER DATABASE statement. |
NEW_BROKER flag that configures
The second is the ENABLE_BROKER flag that turns SQL Server Service Broker on if it is disabled |
|
You see if SQL Server Service Broker is enabled by looking at the values of the |
SELECT name, is_broker_enabled, service_broker_guid FROM sys.databases
1 in is_broker_enabled or the GUID represents a specific instance of the SB |
|
Message Type in SB |
Message types validate that the data within a message is the correct, expected format
NONE: Any data can be placed within the body of the message that is sent.
WELL_FORMED_XML: Only messages consisting of well-formed XML documents can be sent.
VALID_XML WITH SCHEMA COLLECTION: Only XML documents that fit with the specified |
|
The following code snippet shows the creation of a SB message type |
CREATE MESSAGE TYPE YourMessageType |
|
Contracts in SB |
Contracts define the message types that are used within a single conversation. |
|
Queues in SB |
Queues are where the messages within the SQL |
|
Services in SB |
Services can specify which contracts (and therefore which message types) can be used when sending messages to a specific queue. When messages are sent, they are sent to a specific service that then delivers the message into a specific queue. |
|
Routes in SB |
Routes control the database to which the messages should be routed |
|
SQL Server Service Broker priorities |
SQL Server Service Broker priorities assign priorities to conversations to force specific conversations to always be processed before lower priority conversations. |
|
Conversation Groups in SB |
Conversation groups control the order that messages are processed when those messages are sent to different services. |
|
View that show you all the DB-level DDL triggers
for server-level triggers |
sys.triggers
sys.server__triggers |
|
To create a trigger that would audit for nay stored procedure change, deletion, or creation, you could use a ___________________ statement such as |
CREATE TRIGGER
CREATE TRIGGER ChangeWindows ON DATABASE FOR DDL_PROCEDURE_EVENTS as -- Trigger statement here |
|
To monitor for any DROP TABLE, CREATE TABLE, or ALTER TABLE statement |
CREATE TRIGGER ChangeWindow ON DATABASE FOR CREATE _TABLE, DROP_TABLE, ALTER_TABLE AS -- Trigger statement |
|
Because SQL Server Configuration Manager is a snap-in for the Microsoft Management Console program and not a stand-alone program, SQL Server Configuration Manager not does not appear as an application when running Windows 8. To open SQL Server Configuration Manager |
in the Search charm, under Apps, type SQLServerManager11.msc (for SQL Server 2012) or SQLServerManager10.msc for (SQL Server 2008), and then press Enter. |
|
to turn a trace flag on use |
DBCC TRACEON
DBCC TRACEON (1204) DBCC TRACEON (1204,3625)
to turn trace off
DBCC TRACEOFF (1204,3625) |
|
to see the status of a trace |
DBCC TRACESTATUS (3625) |
|
SQL Service Broker |
a message queuing technology/framework
Messages can be sent between DBs. Messages can be processed on demand or on schedule or automatically. Message can bibiderectional or unidirectional |
|
dmv returns a row for each application domain in the server |
sys.dm_clr_appdomain |
|
dmv retunrs a row for each managed user assembly loaded into the server address space |
sys.dm_clr_loaded_assemblies |
|
dmv that returns a row for each property related to SQL Server CLR integration, including the version and the state of the hosted CLR |
sys.dm_clr_properties |
|
DMV that returns a row for all CLR tasks currently running |
sys.dm_clr_tasks |
|
DMV that can be used to view a cached query plan for a CLR query |
sys.dm_exec_cached_plans |
|
DMV that contains a row per query statement within the cached plan |
sys.dm_exec_query_stats |