July 2010


Si se está presentando el siguiente error en SQL Server

Data row does not have a matching index row in the index ‘nc1’

Unable to find index entry in index ID 1, of table 149575571, in database ‘msdb’. The indicated index is corrupt or there is a problem with the current update plan. Run DBCC CHECKDB or DBCC CHECKTABLE. If the problem persists, contact product support.

Una solución es restaurar utilizando un respaldo o recrear el índice nuevamente por medio del siguiente script

 

USE [msdb]
GO

CREATE NONCLUSTERED INDEX [nc1] ON [dbo].[sysjobhistory]
(
    [job_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO

 

Saludos,

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

image image image image

http://mswindowscr.org

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

https://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

http://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/

Note: Cross posted from Eduardo Castro.

Permalink

If you are getting the following error

Data row does not have a matching index row in the index ‘nc1’

Unable to find index entry in index ID 1, of table 149575571, in database ‘msdb’. The indicated index is corrupt or there is a problem with the current update plan. Run DBCC CHECKDB or DBCC CHECKTABLE. If the problem persists, contact product support.

One possible solution is to restore from a backup or to create the index again using the following script

 

USE [msdb]
GO

CREATE NONCLUSTERED INDEX [nc1] ON [dbo].[sysjobhistory]
(
    [job_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO

 

Regards,

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

image image image image

http://mswindowscr.org

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

https://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

http://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/

Note: Cross posted from Eduardo Castro.

Permalink

Si desea optimizar consultas en SQL Azure, el siguiente artículo provee guías generales de cómo utilizar los Dynamic Management Views que están disponibles en SQL Azure, y cómo éstas pueden ser utilizadas para optimizar las consultas o para detectar las consultas con bajo rendimiento.

 

http://www.microsoft.com/downloads/details.aspx?FamilyID=0CEB6317-0E52-4A25-8AF2-2702C9C21358&displayLang=en

 

Las siguientes son una serie de consultas sobre rendimiento en SQL Azure:

 

-- IDentificar las recompilaciones excesivas
select top 25 
    sql_text.text, 
    sql_handle, 
    plan_generation_num, 
    execution_count, 
    dbid, 
    objectid  
from  
    sys.dm_exec_query_stats a 
    cross apply sys.dm_exec_sql_text(sql_handle) as sql_text 
where  
    plan_generation_num >1 
order by plan_generation_num desc

-- Planes de ejecución ineficientes:
select  
    highest_cpu_queries.plan_handle,  
    highest_cpu_queries.total_worker_time, 
    q.dbid, 
    q.objectid, 
    q.number, 
    q.encrypted, 
    q.[text] 
from  
    (select top 50  
        qs.plan_handle,  
        qs.total_worker_time 
    from  
        sys.dm_exec_query_stats qs 
    order by qs.total_worker_time desc) as highest_cpu_queries 
    cross apply sys.dm_exec_sql_text(plan_handle) as q 
order by highest_cpu_queries.total_worker_time desc

-- Identificar cuellos de botella de I/O
select top 25  
    (total_logical_reads/execution_count) as avg_logical_reads, 
    (total_logical_writes/execution_count) as avg_logical_writes, 
    (total_physical_reads/execution_count) as avg_phys_reads, 
     Execution_count,  
    statement_start_offset as stmt_start_offset,  
    sql_handle,  
    plan_handle 
from sys.dm_exec_query_stats   
order by  
 (total_logical_reads + total_logical_writes) Desc

Regards,

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

 image image image image

http://mswindowscr.org

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

https://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

http://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/

Note: Cross posted from Eduardo Castro.

Permalink

In you want to troubleshoot queries performance in SQL Azure, the following paper provides guidelines on the Dynamic Management Views that are available in SQL Azure, and how they can be used for troubleshooting purposes.

 

http://www.microsoft.com/downloads/details.aspx?FamilyID=0CEB6317-0E52-4A25-8AF2-2702C9C21358&displayLang=en

 

The following are some examples taken from the paper:

 

-- Identity excessive recompiles
select top 25 
    sql_text.text, 
    sql_handle, 
    plan_generation_num, 
    execution_count, 
    dbid, 
    objectid  
from  
    sys.dm_exec_query_stats a 
    cross apply sys.dm_exec_sql_text(sql_handle) as sql_text 
where  
    plan_generation_num >1 
order by plan_generation_num desc

-- Inefficient query plans:
select  
    highest_cpu_queries.plan_handle,  
    highest_cpu_queries.total_worker_time, 
    q.dbid, 
    q.objectid, 
    q.number, 
    q.encrypted, 
    q.[text] 
from  
    (select top 50  
        qs.plan_handle,  
        qs.total_worker_time 
    from  
        sys.dm_exec_query_stats qs 
    order by qs.total_worker_time desc) as highest_cpu_queries 
    cross apply sys.dm_exec_sql_text(plan_handle) as q 
order by highest_cpu_queries.total_worker_time desc

-- I/O Bottlenecks
select top 25  
    (total_logical_reads/execution_count) as avg_logical_reads, 
    (total_logical_writes/execution_count) as avg_logical_writes, 
    (total_physical_reads/execution_count) as avg_phys_reads, 
     Execution_count,  
    statement_start_offset as stmt_start_offset,  
    sql_handle,  
    plan_handle 
from sys.dm_exec_query_stats   
order by  
 (total_logical_reads + total_logical_writes) Desc

Regards,

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

 image image image image

http://mswindowscr.org

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

https://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

http://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/

Note: Cross posted from Eduardo Castro.

Permalink

El siguiente artículo realiza una comparación entre SQL Azure Database y SQL Server en las áreas de adminsitración lógica, administración física, aprovisionamiento, soporte de TSQL, almacenamiento, y otras capacidades.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=86f12b41-1eba-4567-9ac8-02eaa7d12034

 

Feature

SQL Server (On-premise)

SQL Azure

Mitigation

Data Storage

No size limits as such

· Web Edition

· Business Edition

Exact size and pricing information can be obtained at Pricing Overview.

Note: When you reach the allocated level (1 GB or 10 GB), only SELECTs and DELETEs will be supported. UPDATEs and INSERTs will throw an error.

· An archival process can be created where older data can be migrated to another database in SQL Azure or on premise.

· Because of above size constraints, one of the recommendations is to partition the data across databases. Creating multiple databases will allow you take maximum advantage of the computing power of multiple nodes. The biggest value in the Azure model is the elasticity of being able to create as many databases as you need, when your demand peaks and delete/drop the databases as your demand subsides. The biggest challenge is writing the application to scale across multiple databases. Once this is achieved, the logic can be extended to scale across N number of databases.

Edition

· Express

· Workgroup

· Standard

· Enterprise

· Enterprise Edition

 

Connectivity

· SQL Server Management Studio

· SQLCMD

· SQL Server 2008 R2 Management Studio provides complete connectivity to SQL azure. Prior versions have limited support.

· SQLCMD

 

Data Migration

· SQL Server Integration Services, BCP and SqlBulkCopyAPI are supported

Authentication

· SQL Authentication

· Windows Authentication

· SQL Server Authentication only

Use SQL Server authentication

Schema

No such limitation

SQL Azure does not support heaps. ALL tables must have a clustered index before data can be inserted.

Check all scripts to make sure all table creation scripts include clustered index.

TSQL Supportability

 

Certain TSQL commands are fully supported; some are partially supported while others are unsupported.

· Supported TSQL: http://msdn.microsoft.com/en-us/library/ee336270.aspx

· Partially Supported TSQL: http://msdn.microsoft.com/en-us/library/ee336267.aspx

· Unsupported TSQL: http://msdn.microsoft.com/en-us/library/ee336253.aspx

 

“USE” command

Supported

Not supported

USE command is not supported because each of the databases created by the user may not be on the same physical server. So the application has to retrieve data separately from multiple databases and consolidate at the application level.

Transactional Replication

Supported

Not supported

You can use BCP or SSIS to get the data out on-demand into an on premise SQL Server. You can also use the SQL Data Sync tool to keep on-premise SQL Server and SQL Azure in sync.

Log Shipping

Supported

Not supported

 

Database Mirroring

Supported

Not supported

 

SQL Agent

Supported

Cannot run SQL agent/jobs on SQL Azure

You can run SQL agent on on-premise SQL Server and connect to SQL Azure

Server options

Supported

· Some system views are supported (http://msdn.microsoft.com/en-us/library/ee336238.aspx)

The idea is most system level metadata is disabled as it does not make sense in a cloud model to expose server level information

Connection Limitations

N/A

To provide fair usage experience to all tenants on the nodes, connections to service may be closed due to one of the following situations:

· Excessive resource usage

· Long running queries – (over 5 minutes)

· Long running single transactions between BEGIN TRAN and END TRAN – (over 5 minutes)

· Idle Connections – (over 30 minutes)

 

SSIS

Can run SSIS on-premise

Cannot run SSIS in SQL Azure

Run SSIS on site and connect to SQL Azure with ADO.NET provider

 

Saludos,

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

image image image image

http://mswindowscr.org

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

https://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

http://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/

Note: Cross posted from Eduardo Castro.

Permalink

The following paper compares SQL Azure Database with SQL Server in terms of logical administration vs. physical administration, provisioning, Transact-SQL support, data storage, SSIS, along with other features and capabilities.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=86f12b41-1eba-4567-9ac8-02eaa7d12034

 

Feature

SQL Server (On-premise)

SQL Azure

Mitigation

Data Storage

No size limits as such

· Web Edition

· Business Edition

Exact size and pricing information can be obtained at Pricing Overview.

Note: When you reach the allocated level (1 GB or 10 GB), only SELECTs and DELETEs will be supported. UPDATEs and INSERTs will throw an error.

· An archival process can be created where older data can be migrated to another database in SQL Azure or on premise.

· Because of above size constraints, one of the recommendations is to partition the data across databases. Creating multiple databases will allow you take maximum advantage of the computing power of multiple nodes. The biggest value in the Azure model is the elasticity of being able to create as many databases as you need, when your demand peaks and delete/drop the databases as your demand subsides. The biggest challenge is writing the application to scale across multiple databases. Once this is achieved, the logic can be extended to scale across N number of databases.

Edition

· Express

· Workgroup

· Standard

· Enterprise

· Enterprise Edition

 

Connectivity

· SQL Server Management Studio

· SQLCMD

· SQL Server 2008 R2 Management Studio provides complete connectivity to SQL azure. Prior versions have limited support.

· SQLCMD

 

Data Migration

· SQL Server Integration Services, BCP and SqlBulkCopyAPI are supported

Authentication

· SQL Authentication

· Windows Authentication

· SQL Server Authentication only

Use SQL Server authentication

Schema

No such limitation

SQL Azure does not support heaps. ALL tables must have a clustered index before data can be inserted.

Check all scripts to make sure all table creation scripts include clustered index.

TSQL Supportability

 

Certain TSQL commands are fully supported; some are partially supported while others are unsupported.

· Supported TSQL: http://msdn.microsoft.com/en-us/library/ee336270.aspx

· Partially Supported TSQL: http://msdn.microsoft.com/en-us/library/ee336267.aspx

· Unsupported TSQL: http://msdn.microsoft.com/en-us/library/ee336253.aspx

 

“USE” command

Supported

Not supported

USE command is not supported because each of the databases created by the user may not be on the same physical server. So the application has to retrieve data separately from multiple databases and consolidate at the application level.

Transactional Replication

Supported

Not supported

You can use BCP or SSIS to get the data out on-demand into an on premise SQL Server. You can also use the SQL Data Sync tool to keep on-premise SQL Server and SQL Azure in sync.

Log Shipping

Supported

Not supported

 

Database Mirroring

Supported

Not supported

 

SQL Agent

Supported

Cannot run SQL agent/jobs on SQL Azure

You can run SQL agent on on-premise SQL Server and connect to SQL Azure

Server options

Supported

· Some system views are supported (http://msdn.microsoft.com/en-us/library/ee336238.aspx)

The idea is most system level metadata is disabled as it does not make sense in a cloud model to expose server level information

Connection Limitations

N/A

To provide fair usage experience to all tenants on the nodes, connections to service may be closed due to one of the following situations:

· Excessive resource usage

· Long running queries – (over 5 minutes)

· Long running single transactions between BEGIN TRAN and END TRAN – (over 5 minutes)

· Idle Connections – (over 30 minutes)

 

SSIS

Can run SSIS on-premise

Cannot run SSIS in SQL Azure

Run SSIS on site and connect to SQL Azure with ADO.NET provider

 

Regards,

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

image image image image

http://mswindowscr.org

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

https://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

http://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/

Note: Cross posted from Eduardo Castro.

Permalink

Great news from http://blogs.msdn.com/b/sqlazure/archive/2010/07/12/10037077.aspx and http://blogs.technet.com/b/microsoft_blog/archive/2010/07/12/realizing-the-promise-of-cloud-with-microsoft.aspx

 

David Robinson states “the new Windows Azure platform appliance combines Windows Azure and Microsoft SQL Azure with Microsoft-specified hardware, enabling on-demand IT capacity and faster delivery of new applications. Large enterprises and service provider partners deploying the appliance in their datacenters will have the benefits of the cloud services that Microsoft offers today, while maintaining physical control of location, regulatory compliance and data”. 

Blog Muglia explains the Windows Azure appliance as “The appliance is the same Windows Azure platform we run at Microsoft, and includes Windows Azure and SQL Azure on Microsoft-specified hardware. Using it, service providers, governments and large enterprises will be able to get the control they need, while still getting the benefits of scale, multi–tenancy, and low operational costs.”

 

With this offering big companies can know built their own private clouds based on Azure.

 

Saludos,

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

image image image image

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

https://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

http://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/

Note: Cross posted from Eduardo Castro.

Permalink

Next Page »