viernes, 21 de junio de 2013

Performance Tuning for SQL Server | Brent Ozar Unlimited

Performance Tuning for SQL Server | Brent Ozar Unlimited:

'via Blog this'

The Mega Guide to Free SQL Server Tools | Database Performance Tuning content from SQL Server Pro

The Mega Guide to Free SQL Server Tools | Database Performance Tuning content from SQL Server Pro:

'via Blog this'

SQL Server Task Management Best Practices

SQL Server Task Management Best Practices:

'via Blog this'

Identify SQL Server Hardware Bottlenecks - SQL Server Performance

Identify SQL Server Hardware Bottlenecks - SQL Server Performance:

'via Blog this'

Performance Monitor Counters

Performance Monitor Counters:

'via Blog this'

Understanding Performance Counters data while troubleshooting Performance issues | "…a cook, exploring a technicians' world!"

Understanding Performance Counters data while troubleshooting Performance issues | "…a cook, exploring a technicians' world!":

'via Blog this'

SQL Server Reference Guide | Using SQL Server as a Web Service | InformIT

SQL Server Reference Guide | Using SQL Server as a Web Service | InformIT:

'via Blog this'

Transactional Replication Snapshot Issues in SQL Server

Transactional Replication Snapshot Issues in SQL Server:

'via Blog this'

SQL Server Code Review Checklist

SQL Server Code Review Checklist:

'via Blog this'

SQL Server Code Deployment Best Practices

SQL Server Code Deployment Best Practices:

'via Blog this'

SQL Server Index Checklist

SQL Server Index Checklist:

'via Blog this'

SQL Server Index Basics

SQL Server Index Basics:

'via Blog this'

martes, 11 de junio de 2013

The Mega Guide to Free SQL Server Tools | Database Performance Tuning content from SQL Server Pro

The Mega Guide to Free SQL Server Tools | Database Performance Tuning content from SQL Server Pro:

'via Blog this'

How to use the SQLIOSim utility to simulate SQL Server activity on a disk subsystem

How to use the SQLIOSim utility to simulate SQL Server activity on a disk subsystem:

'via Blog this'

Log Activity with sp_whoisactive | Brent Ozar Unlimited

Log Activity with sp_whoisactive | Brent Ozar Unlimited:

'via Blog this'

SQL Server Customer Advisory Team - SQL Server Best Practices

SQL Server Customer Advisory Team - SQL Server Best Practices:

'via Blog this'

Performance Tuning for SQL Server | Brent Ozar Unlimited

Performance Tuning for SQL Server | Brent Ozar Unlimited:

'via Blog this'

Be Prepared: Collecting Data from sp_WhoIsActive in a Table | LittleKendra.com

Be Prepared: Collecting Data from sp_WhoIsActive in a Table | LittleKendra.com:

'via Blog this'

Best Practices + Table Partitioning: Merging Boundary Points | Brent Ozar Unlimited

Best Practices + Table Partitioning: Merging Boundary Points | Brent Ozar Unlimited: "Best Practices + Table Partitioning: Merging Boundary Points"

'via Blog this'

miércoles, 15 de mayo de 2013

Resource Governor States

Resource Governor States:

'via Blog this'

Part 1: Anatomy of SQL Server 2008 Resource Governor CPU Demo - SQL Server SQLOS team blog - Site Home - TechNet Blogs

Part 1: Anatomy of SQL Server 2008 Resource Governor CPU Demo - SQL Server SQLOS team blog - Site Home - TechNet Blogs:

'via Blog this'

Using the Resource Governor

Using the Resource Governor:

'via Blog this'

Handling workloads on SQL Server 2008 with Resource Governor

Handling workloads on SQL Server 2008 with Resource Governor:

'via Blog this'

Using DMVs to Adjust SQL Server Resource Governor Settings

Using DMVs to Adjust SQL Server Resource Governor Settings:

'via Blog this'

Part 2: Resource Governor CPU Demo on multiple CPUs - SQL Server SQLOS team blog - Site Home - TechNet Blogs

Part 2: Resource Governor CPU Demo on multiple CPUs - SQL Server SQLOS team blog - Site Home - TechNet Blogs: "select scheduler_id, cpu_id, status, is_online from sys.dm_os_schedulers"

'via Blog this'

lunes, 13 de mayo de 2013

SQL Consolidation Planning and recommended practices - Team blog of MCS @ Middle East and Africa - Site Home - TechNet Blogs

SQL Consolidation Planning and recommended practices - Team blog of MCS @ Middle East and Africa - Site Home - TechNet Blogs: "Consolidation strategies
SQL server consolidation can be achieved mainly through one of the below strategies:

Virtualization: using a single physical machine to host multiple virtual machines (VMs) running Microsoft® SQL Server® data management software
Multiple Instances: using a single machine to host multiple SQL Server instances,
Multiple databases: using a single instance of SQL Server to host multiple databases
Each of these strategies has different advantages and disadvantages related to security and compliance requirements, high availability and disaster recovery requirements, resource management benefits, level of consolidation density, and manageability tradeoffs"

'via Blog this'

Using DMVs to Adjust SQL Server Resource Governor Settings

Using DMVs to Adjust SQL Server Resource Governor Settings:

'via Blog this'

Stored procedure: master dbo sp_RG, Created: Mar 8 2013 6:47PM, Modified: May 12 2013 12:55AM

Stored procedure: master dbo sp_RG, Created: Mar 8 2013 6:47PM, Modified: May 12 2013 12:55AM:

'via Blog this'

Resource Governor Workload Management Scenarios

Resource Governor Workload Management Scenarios: "Monitor the Resource Governor performance counters and query the DMVs that will return information about resource usage for a workload group."

'via Blog this'

Considerations for Writing a Classifier Function

Considerations for Writing a Classifier Function:

'via Blog this'

viernes, 10 de mayo de 2013

execution plan - SQL Server 2008 R2 sys.dm_exec_sql_text question - Database Administrators Stack Exchange

execution plan - SQL Server 2008 R2 sys.dm_exec_sql_text question - Database Administrators Stack Exchange:

'via Blog this'

Redistributing DTS with your program

Redistributing DTS with your program:

'via Blog this'

INF: How to Run a DTS Package as a Scheduled Job

INF: How to Run a DTS Package as a Scheduled Job:

'via Blog this'

Using fn_dblog, fn_dump_dblog, and restoring with STOPBEFOREMARK to an LSN - Paul S. Randal

Using fn_dblog, fn_dump_dblog, and restoring with STOPBEFOREMARK to an LSN - Paul S. Randal:

'via Blog this'

Reading database transaction log with fn_dump_dblog() - Data, Design, and SQL Server - Site Home - MSDN Blogs

Reading database transaction log with fn_dump_dblog() - Data, Design, and SQL Server - Site Home - MSDN Blogs:

'via Blog this'

Stanley Johns's Database Blog | SQL server and MySQL tips | Page 3

Stanley Johns's Database Blog | SQL server and MySQL tips | Page 3:

'via Blog this'

sql server 2008 - How to print out the query SQL text of a transaction by querying the "fn_dblog" or DBCC LOG('DataBaseName')? - Database Administrators Stack Exchange

sql server 2008 - How to print out the query SQL text of a transaction by querying the "fn_dblog" or DBCC LOG('DataBaseName')? - Database Administrators Stack Exchange:

'via Blog this'

Tracking Transaction Log Records With SQL Server 2012 Extended Events | DBA Journey

Tracking Transaction Log Records With SQL Server 2012 Extended Events | DBA Journey:

'via Blog this'

transaction - How to find out who deleted some data SQL Server - Database Administrators Stack Exchange

transaction - How to find out who deleted some data SQL Server - Database Administrators Stack Exchange:

'via Blog this'

Truncate » John Huang's Blog

Truncate » John Huang's Blog: "sys.system_internals_allocation_units"

'via Blog this'

How to recover deleted data from SQL Server | SQL Server Portal

How to recover deleted data from SQL Server | SQL Server Portal:

'via Blog this'

SQL 2000 ::fn_dblog vs DBCC LOG: The good, the bad and the ugly. | Art of SQL

SQL 2000 ::fn_dblog vs DBCC LOG: The good, the bad and the ugly. | Art of SQL:

'via Blog this'

SQLskills Immersion Event Internals and Performance | Tracy Boggiano's SQL Server Blog

SQLskills Immersion Event Internals and Performance | Tracy Boggiano's SQL Server Blog:

'via Blog this'

Interpreting Tran Log Page Splits - SQL Server Q&A from the SQL Server Central community

Interpreting Tran Log Page Splits - SQL Server Q&A from the SQL Server Central community:

'via Blog this'

Killspid's blog: Using fn_dblog

Killspid's blog: Using fn_dblog:

'via Blog this'

Finding out who dropped a table using the transaction log - Paul S. Randal

Finding out who dropped a table using the transaction log - Paul S. Randal:

'via Blog this'

miércoles, 8 de mayo de 2013

Wait Types - SQLServerPedia

Wait Types - SQLServerPedia:

'via Blog this'

Hacking SQL Server

Hacking SQL Server:

'via Blog this'

Introducing SQL Server Extended Events

Introducing SQL Server Extended Events:

'via Blog this'

SQL Server 2005 Index Best Practices

SQL Server 2005 Index Best Practices:

'via Blog this'

SQL Server: Revelar datos ocultos para optimizar el rendimiento de las aplicaciones

SQL Server: Revelar datos ocultos para optimizar el rendimiento de las aplicaciones:

'via Blog this'

Using XEvents (Extended Events) in SQL Server 2008 to detect which queries are causing Page Splits - Eladio Rincón y SQL Server

Using XEvents (Extended Events) in SQL Server 2008 to detect which queries are causing Page Splits - Eladio Rincón y SQL Server:

'via Blog this'

Investigating SQL Server 2008 Wait Events with XEVENTS

Investigating SQL Server 2008 Wait Events with XEVENTS:

'via Blog this'

SQL Server: Revelar datos ocultos para optimizar el rendimiento de las aplicaciones

SQL Server: Revelar datos ocultos para optimizar el rendimiento de las aplicaciones:

'via Blog this'

SQL Server Tempdb Usage and Bottlenecks tracked with Extended Events

SQL Server Tempdb Usage and Bottlenecks tracked with Extended Events:

'via Blog this'

Query Hints (Transact-SQL)

Query Hints (Transact-SQL):

'via Blog this'

SQL SERVER – MAXDOP Settings to Limit Query to Run on Specific CPU | SQL Server Journey with SQL Authority

SQL SERVER – MAXDOP Settings to Limit Query to Run on Specific CPU | SQL Server Journey with SQL Authority:

'via Blog this'

2012 June | Brent Ozar Unlimited

2012 June | Brent Ozar Unlimited:

'via Blog this'

SQL Server Reference Guide | Performance Tuning SQL Server: Tools Overview | InformIT

SQL Server Reference Guide | Performance Tuning SQL Server: Tools Overview | InformIT:

'via Blog this'

SQL Server Performance Tuning Links

SQL Server Performance Tuning Links:

'via Blog this'

Black Belt Administration: Performance Dashboard for Microsoft SQL Server, Part II - Page 2 — DatabaseJournal.com

Black Belt Administration: Performance Dashboard for Microsoft SQL Server, Part II - Page 2 — DatabaseJournal.com:

'via Blog this'

Database Mail set up in SQL Server 2008 - SQLServerCentral

Database Mail set up in SQL Server 2008 - SQLServerCentral:

'via Blog this'

Using Policy Based Management in SQL Server 2008

Using Policy Based Management in SQL Server 2008:

'via Blog this'

Using Policy Based Management for checking SQL Server database file extensions

Using Policy Based Management for checking SQL Server database file extensions:

'via Blog this'

SQL Server OLEDB Wait Type | Logical Read

SQL Server OLEDB Wait Type | Logical Read:

'via Blog this'

Troubleshooting Performance Problems in SQL Server 2005

Troubleshooting Performance Problems in SQL Server 2005:

'via Blog this'

Description of the Replay Markup Language (RML) Utilities for SQL Server

Description of the Replay Markup Language (RML) Utilities for SQL Server:

'via Blog this'

miércoles, 1 de mayo de 2013

TSQL Tuning: How to Measure Performance Improvements (Video) | Brent Ozar Unlimited

TSQL Tuning: How to Measure Performance Improvements (Video) | Brent Ozar Unlimited:

'via Blog this'

Free SQL Server Tools Software and Utilities

Free SQL Server Tools Software and Utilities:

'via Blog this'

2012 June | Brent Ozar Unlimited

2012 June | Brent Ozar Unlimited:

'via Blog this'


'via Blog this'

Blog - Brent Ozar | Brent Ozar Unlimited - Part 16

Blog - Brent Ozar | Brent Ozar Unlimited - Part 16:

'via Blog this'

N Microsoft Press - Microsoft SQL Server 7. 0 System Administration Training Kit / Lesson 2: Tools for Monitoring SQL Server

N Microsoft Press - Microsoft SQL Server 7. 0 System Administration Training Kit / Lesson 2: Tools for Monitoring SQL Server:

'via Blog this'

Tip (SQL Server): List of all the DBCC commands with their syntax

Tip (SQL Server): List of all the DBCC commands with their syntax: "dbcc freeze_io"

'via Blog this'

What to do if your SQL Server system is slow | SQL Server Performance Forums

What to do if your SQL Server system is slow | SQL Server Performance Forums:

'via Blog this'

Ten SQL Server DBA Tools to Make the Life of Database Administrator Easier - SQL Password Recovery

Ten SQL Server DBA Tools to Make the Life of Database Administrator Easier - SQL Password Recovery: "http://opendbiff.codeplex.com"

'via Blog this'

Open DBDiff - Home

Open DBDiff - Home:

'via Blog this'

dta Utility

dta Utility:

'via Blog this'

Introduction to SQLDIAG for SQL Server Performance Monitoring and Tuning

Introduction to SQLDIAG for SQL Server Performance Monitoring and Tuning:

'via Blog this'

SQL Query Optimization FAQ Part 1 (With video explanation) - CodeProject

SQL Query Optimization FAQ Part 1 (With video explanation) - CodeProject:

'via Blog this'

Execution Plan Basics

Execution Plan Basics:

'via Blog this'

SET STATISTICS IO (Transact-SQL)

SET STATISTICS IO (Transact-SQL):

'via Blog this'

Sql Server 2005 – Twelve Tips For Optimizing Query Performance by Tony Wright | Business Application Development for Strategic Advantage Melbourne | Hazaa

Sql Server 2005 – Twelve Tips For Optimizing Query Performance by Tony Wright | Business Application Development for Strategic Advantage Melbourne | Hazaa:

'via Blog this'

Optimizing MERGE Statement Performance

Optimizing MERGE Statement Performance: "CREATE TABLE dbo.Stock (StockName nvarchar(50) PRIMARY KEY, Qty int CHECK (Qty > 0));
"

'via Blog this'

index tuning - SQL server indexing foreign keys, covering indexes included columns - Database Administrators Stack Exchange

index tuning - SQL server indexing foreign keys, covering indexes included columns - Database Administrators Stack Exchange: "dm_db_index_usage_stats "

'via Blog this'

Monitor Disk Usage

Monitor Disk Usage:

'via Blog this'

Policy-Based Management How-to Topics

Policy-Based Management How-to Topics:

'via Blog this'

domingo, 21 de abril de 2013

Finding and Tuning Similar Queries by Using Query and Query Plan Hashes

Finding and Tuning Similar Queries by Using Query and Query Plan Hashes:

'via Blog this'

Tune Your Indexing Strategy with SQL Server DMVs

Tune Your Indexing Strategy with SQL Server DMVs:

'via Blog this'

Sql Server 2005 – Twelve Tips For Optimizing Query Performance by Tony Wright | Business Application Development for Strategic Advantage Melbourne | Hazaa

Sql Server 2005 – Twelve Tips For Optimizing Query Performance by Tony Wright | Business Application Development for Strategic Advantage Melbourne | Hazaa:

'via Blog this'

Creating a Remote Service Binding

Creating a Remote Service Binding:

'via Blog this'

Master Data Services Team Blog - Site Home - MSDN Blogs

Master Data Services Team Blog - Site Home - MSDN Blogs:

'via Blog this'

Models (Master Data Services)

Models (Master Data Services):

'via Blog this'

SQL SERVER – Simple Installation of Master Data Services (MDS) and Sample Packages – Very Easy | SQL Server Journey with SQL Authority

SQL SERVER – Simple Installation of Master Data Services (MDS) and Sample Packages – Very Easy | SQL Server Journey with SQL Authority:

'via Blog this'

sábado, 30 de marzo de 2013

Pattern Matching in Search Conditions

Pattern Matching in Search Conditions


Normalmente usamos LIKE con el símbolo % para indicar que nuestra búsqueda deberá coincidir hasta cierto punto.
El siguiente ejemplo 
SELECT  [EmployeeID]
      ,[LastName]
      ,[FirstName]
      ,[MiddleInitial]
      ,[SSN]
  FROM [Employee]
  WHERE LastName LIKE 'Ste%'
Retornará 

EmployeeID  LastName                       FirstName                     MiddleInitial SSN
----------- ------------------------------ ----------------------------- ------------- -----------
1           Stein                          Nidprxmvtyjnat                              123-07-9951
14          Stein                          Qfgakkjblwfbkb                              763-07-9431
27          Stein                          Ysscitlqms                                  590-07-8911
40          Stein                          Txhqy                                       437-07-8391

Pero el signo % no es el único que podemos usar. SQL server incluye los siguientes comodines.

Wildcard
Comportamiento
%
Cualquier string de cero o más caracteres.
_
Un caracter solamente.
[ ]
Un rango.
[^]
Un caracter que no este dentro del rango

 
En la siguiente condición SSN deberá no iniciarse con "1", en la siguiente posición deberá existir un número comprendido entre 0 y 9, la tercera posición deberá ser un número comprendido entre 4 y 8, en las siguientes 4 posiciones podrá ser cualquier cosa, pero a continuación deberá ser solamente un "9", el resto no nos interesa.  

SELECT  [EmployeeID]
      ,[LastName]
      ,[FirstName]
      ,[MiddleInitial]
      ,[SSN]
  FROM [Employee]
  WHERE SSN LIKE '[^1][0-9][4-8]____9%'

Este será el resultado

EmployeeID  LastName                       FirstName                     MiddleInitial SSN
----------- ------------------------------ ----------------------------- ------------- -----------
2           Eflin                          Ysgphbplbhoksy                              327-07-9911
7           Makai                          Lnudwgnbtoyvix                              467-07-9711
24          Infante                        Raluqhoqtkd                                 967-07-9031
251         Stein                          Nidprxmvtyjnat                              247-06-9951
255         Olphant                        Tqbigir                                     857-06-9791


Comparison Operators Modified by ANY, SOME, or ALL

Comparison Operators Modified by ANY, SOME, or ALL


El operador IN nos permite saber si un valor se encuentra en un conjunto de valores. Normalmente lo usamos en el WHERE. 

Por ejemplo 

  SELECT  [EmployeeID]
      ,[LastName]
      ,[FirstName]
      ,[MiddleInitial]
      ,[SSN]
  FROM [Employee]
  WHERE LastName IN ('Stein','Chen')

Nos retorna 
EmployeeID  LastName                       FirstName                     MiddleInitial SSN
----------- ------------------------------ ----------------------------- ------------- -----------
1           Stein                          Nidprxmvtyjnat                              123-07-9951
4           Chen                           Mju                                         750-07-9831
14          Stein                          Qfgakkjblwfbkb                              763-07-9431
17          Chen                           Jdjoemmumy                                  733-07-9311
27          Stein                          Ysscitlqms                                  590-07-8911
30          Chen                           Eyeqkrvwoewil                               327-07-8791

Los otro operadores de conjuntos que provee SQL son ALLSOME ANY

ANY retorna verdadero si la comparación se cumple para alguno del conjunto. Es lo mismo que IN.

   SELECT  [EmployeeID]
      ,[LastName]
      ,[FirstName]
      ,[MiddleInitial]
      ,[SSN]
  FROM [Employee]
  WHERE LastName = ANY (
SELECT 'Stein'
UNION
SELECT 'Chen')

ALL retorna verdadero si la condición se cumple para todo el conjunto

En el siguiente ejemplo ALL retornará los menores a 4, ya que los mismos son menores a 4 y a 8

   SELECT  [EmployeeID]
      ,[LastName]
      ,[FirstName]
      ,[MiddleInitial]
      ,[SSN]
  FROM [Employee]
  WHERE EmployeeID <= ALL 
SELECT 8
UNION
SELECT 4
) 


EmployeeID  LastName                       FirstName                     MiddleInitial SSN
----------- ------------------------------ ----------------------------- ------------- -----------
1           Stein                          Nidprxmvtyjnat                              123-07-9951
2           Eflin                          Ysgphbplbhoksy                              327-07-9911
3           Quint                          Ysoawvtycuwv                                593-07-9871
4           Chen                           Mju                                         750-07-9831

(4 row(s) affected)




Building a SQL Server Inventory

Building a SQL Server Inventory


User with last access


User with last access

select name, updatedate , accdate, case when sysadmin = 1 then 'sa' else '' end as rol , lastProcessfrom syslogins lleft join (select loginame, max(last_batch) lastProcess from master..sysprocesses group by loginame) a on a.loginame = l.nameorder by  lastprocess  desc, accdate desc