Category: SQL & Big Data

  • Do I need DTC for my SQL Server?

    I get a lot of questions about the “best” way to configure the Distributed Transaction Coordinator (DTC) for SQL Server on a Windows 2008 cluster. There is no one best way to do it, and the first question you ask should be “do you even use DTC and if so how and how often?”. If you don’t use DTC or use it rarely, then perhaps you don’t need to spend a lot of time coming up with the absolute “best” method for each instance of SQL Server or your application. If your application calls DTC directly or if you use a feature in SQL Server that calls DTC, then you need DTC to be available. Some examples of how SQL Server uses DTC: linked servers, OPENROWSET, OPENQUERY, OPENDATASOURCE, remote procedure calls, BEGIN DISTRIBUTED TRANSACTION, updatable subscriptions for transactional replication (immediate and queued updating are now deprecated). You can choose to enlist in a DTC transaction from CLR, SSIS, and DTS. SQL Server does not support using DTC with some features such as database mirroring. Be very careful using DTC with functionality such as TRY…CATCH. DTC is a Windows feature and as such can be used by many applications. In addition to finding out if your SQL Server implementation takes advantage of DTC, check if any of your applications enlist DTC, such as with XA transactions. For information on your options for setting up DTC on Windows 2008 clusters, see:

    How to configure DTC for SQL Server in a Windows 2008 cluster

    http://blogs.msdn.com/cindygross/archive/2009/02/22/how-to-configure-dtc-for-sql-server-in-a-windows-2008-cluster.aspx

  • Out with the Old (SQL 7.0) and in with the New (SQL 2008 SP2)

    We are fast approaching the end of support for SQL Server 7.0. It has been in “extended support” for a while, meaning you could call for help but no non-security hotfixes would be created. But after January 11, 2011 extended support for SQL Server 7.0 ends and you will no longer be able to contact Microsoft for help with SQL Server 7.0. See more details here: http://blogs.msdn.com/b/sqlreleaseservices/archive/2010/09/29/end-of-support-for-sql-server-7-0.aspx

    But everything is not ending! Indeed we have a new service pack for SQL Server 2008! SQL Server 2008 SP2 is now available for download! SP2 includes all hotfixes from SP1 CU1 to CU8. You can also get the updated feature pack.

     

    •          SQL Server 2008 SP2: http://go.microsoft.com/fwlink/?LinkId=196550

    •          SQL Server 2008 SP2 Express: http://go.microsoft.com/fwlink/?LinkId=196551

    •          SQL Server 2008 SP2 Feature Packs: http://go.microsoft.com/fwlink/?LinkId=202815

     

    Key improvements in Microsoft SQL Server 2008 Service Pack 2 are:

     

    • Reporting Services in SharePoint Integrated Mode. SQL Server 2008 SP2 provides updates for Reporting Services integration with SharePoint products.   SQL Server 2008 SP2 report servers can integrate with SharePoint 2010 products. SQL Server 2008 SP2 also provides a new add-in to support the integration of SQL Server 2008 R2 report servers with SharePoint 2007 products. This now enables SharePoint Server 2007 to be used with SQL Server 2008 R2 Report Server. For more information see the “What’s New in SharePoint Integration and SQL Server 2008 Service Pack 2 (SP2)” section in What’s New (Reporting Services).
    • SQL Server 2008 R2 Application and Multi-Server Management Compatibility with SQL Server 2008.
      • SQL Server 2008 Instance Management. With SP2 applied, an instance of the SQL Server 2008 Database Engine can be enrolled with a SQL Server 2008 R2 Utility Control Point as a managed instance of SQL Server. SQL Server 2008 SP2 enables organizations to extend the value of the Utility Control Point to instances of SQL Server 2008 SP2 without having to upgrade those servers to SQL Server 2008 R2. For more information, see Overview of SQL Server Utility in SQL Server 2008 R2 Books Online.

    o   Data-tier Application (DAC) Support. Instances of the SQL Server 2008 Database Engine support all DAC operations delivered in SQL Server 2008 R2 after SP2 has been applied. You can deploy, upgrade, register, extract, and delete DACs. SP2 does not upgrade the SQL Server 2008 client tools to support DACs. You must use the SQL Server 2008 R2 client tools, such as SQL Server Management Studio, to perform DAC operations. A data-tier application is an entity that contains all of the database objects and instance objects used by an application. A DAC provides a single unit for authoring, deploying, and managing the data-tier objects. For more information, see Designing and Implementing Data-tier Applications.

  • New Releases – SQL Server Migration Assistant (SSMA)

    We have shipped some updates to our migration tool – the SQL Server Migration Assistant (SSMA). It is now easier than ever to migrate to SQL Server 2005, 2008, and/or 2008 R2 from Access, Oracle, Sybase, and MySQL. You can even use SSMA to migrate from Access or MySQL to SQL Azure.

     

    Customers and partners can provide SSMA feedback via ssmateam@microsoft.com.

     

    ·         SSMA team blog http://blogs.msdn.com/b/ssma/

    ·         Microsoft announces SQL Server Migration Assistant for MySQL http://blogs.msdn.com/b/ssma/archive/2010/08/12/microsoft-announces-sql-server-migration-assistant-for-mysql.aspx

    ·         Migrating to SQL Server 2008 http://www.microsoft.com/sqlserver/2008/en/us/migration.aspx

    Links to downloads: http://blogs.msdn.com/b/ssma/archive/2010/08/12/microsoft-announces-sql-server-migration-assistant-for-mysql.aspx

  • Memory Trimming: A significant part of sql server process memory has been paged out.

    I have written about this topic before (in my old SQLCommunity blog) but I still see lots of questions about it. So here is a simplified explanation of this memory trimming issue that is common with SQL Server on Windows 2003.

    On Windows 2003 you may occasionally see memory trimming messages in your SQL Server error logs: “A significant part of sql server process memory has been paged out. This may result in a performance degradation.” Generally you will see this at the same time that the performance of your SQL Server becomes very bad. What happens is Windows has to free up memory rapidly and it  cannot wait for the normal, polite “hey, I need some memory, are there any apps willing to give me some”. This can happen due to severe memory pressure, when certain APIs are called, or due to certain Windows 2003 bugs (most of which are fixed in Windows 2003 SP2 or post SP2 hotfixes). Windows 2003 will respond to this pressure by trimming GBs of memory at once. Windows 2008 responds much better in that it trims MBs at a time instead and typically does not cripple running applications such as SQL Server. Therefore it is expected that you will NOT see this scenario on Windows 2008 or later.

     

    Ideally you would find and resolve the reason for the external memory pressure, but in many cases that is impractical when a workaround may alleviate the problem. On Windows 2003 you can try combining the “lock pages in memory” (LPIM) setting with a “max server memory” setting such that all instances of SQL added together will still leave “enough” memory for everything else running on the box (SQL Agent, SSIS/DTS, RS, AS, anti-virus, backups, batch processes, services, etc.). LPIM keeps Windows from trimming SQL’s buffer pool. Do NOT ever enable LPIM without also setting “max server memory” for all instances to an appropriate value. There are rare cases where LPIM can cause more problems than it solves. This happens if Windows still faces this type of memory pressure and has to trim SQL Server memory outside the buffer pool which could mean trimming the mapped SQL exes and dlls and causing even bigger performance problems. So monitor the system carefully after you add LPIM and make sure you’ve properly set the “max server memory” setting. The currently recommended fix is to upgrade to Windows 2008 or Windows 2008 R2 where the memory trimming is handled much differently.

     

    2001745 Working Set Trimming can negatively impact SQL, Exchange, and Operating System performance under Windows 2003

    http://support.microsoft.com/kb/2001745

    918483 How to reduce paging of buffer pool memory in the 64-bit version of SQL Server

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;918483

    How to enable the Lock Page in Memory option (Windows)

    http://msdn.microsoft.com/en-us/library/ms190730(SQL.90).aspx

  • Online learning with Kalen Delaney – SQL Server 2008 Indexes – Internals and Best Practices

    Kalen always does a great job of explaining the guts of SQL Server. She has a deep, intuitive grasp of index internals. Even better, she can take that knowledge and share it so everyone can learn something, whether you’re a relative newbie or a veteran. This particular workshop is a deep-dive with advanced topics so if you have a good grasp of the basics and want to hone your index skills, sign up now for Friday’s online workshop for only $99 and learn all about index internals and best practices. You can even get a DVD as part of the registration (but it costs extra).

    Workshop: SQL Server 2008 Indexes – Internals and Best Practices http://www.vconferenceonline.com/shows/workshops/indexing.asp or http://www.vconferenceonline.com/event/home.aspx?id=130

    Date: Friday, July 23, 2010 at 9:00a Pacific

    And learn more about Kalen Delaney and her SQL Server 2008 Internals book here: http://www.sqlserverinternals.com/about.html

  • CTP of SP2 for SQL Server 2008 is now available

    SQL Server 2008 will soon have a new service pack – SP2. SQL Server service packs go through a CTP (aka beta) cycle prior to release. The CTP of SP2 is now available for you to download and test. This is only the pre-release version, so only use it for testing.

     

    ·         SQL Server 2008 Service Pack 2 CTP http://www.microsoft.com/downloads/details.aspx?FamilyID=65606fdd-093f-4c70-91f6-dc1f24520e8f&displaylang=en

    ·         SQL Server 2008 Express Edition Service Pack 2 – CTP http://www.microsoft.com/downloads/details.aspx?FamilyID=c56e753d-13ef-4b95-a5eb-0b470bf56341&displaylang=en

    ·         Feedback via Connect http://connect.microsoft.com/SQLServer/Feedback

    ·         SQL Server 2008 Service Pack 2 Customer Technology Preview Available http://blogs.msdn.com/b/sqlreleaseservices/archive/2010/07/07/sql-server-2008-service-pack-2-customer-technology-preview-available.aspx

    “Today marks the release of the Customer Technology Preview (CTP) for Microsoft SQL Server 2008 Service Pack 2.  Microsoft SQL Server 2008 Service Pack 2 includes:

    ·         All hotfixes released up to Microsoft SQL Server 2008 SP1 CU 8.

    ·         Updates to the Reporting Services Add-in for Microsoft SharePoint Products 2007 allowing customer to connect to SQL Server 2008 R2 Report Servers.

    ·         Support for SQL Server 2008 R2 version of Management Studio to perform operations for data-tier applications (DAC) in SQL Server 2008 instances that have SP2 installed.  For more information please visit http://msdn.microsoft.com/en-us/library/ee240739.aspx.

    ·         Support for SQL Server 2008 R2 Utility Explorer and SQL Server Utility viewpoints in (SSMS) provide administrators a holistic view of resource health through an instance of SQL Server that serves as a utility control point (UCP).  For more information please visit http://msdn.microsoft.com/en-us/library/ee210557.aspx.

     We encourage customers to try Microsoft SQL Server 2008 SP2 CTP, and provide us your feedback.  We are actively reading all feedback and appreciate any thoughts that you might have to help us with this product update.  To provide feedback please visit the Microsoft Connect Feedback Center.”

    ·         List of the bugs that are fixed in SQL Server 2008 Service Pack 2 http://support.microsoft.com/kb/979450

     

    SQL Server Servicing plans

    http://blogs.msdn.com/sqlreleaseservices/archive/2010/02/12/sql-server-servicing-plans.aspx

     

    ·         SQL Server 2008 SP2 is targeted for the third quarter of calendar year 2010.

    ·         SQL Server 2005 SP4 is targeted for the fourth quarter of calendar year 2010. This is planned to be the last SQL Server 2005 service pack.

     

    SQL Server Service Pack support (mostly) ends 12 months after the next service pack releases. So 1 year after SQL Server 2008 SP2 releases you need to be have all SQL Server 2008 instances on SP2 (and optionally with SP2 based cumulative updates (CUs) applied). There is very limited support for older service packs under our new SP policy.

     

    ·         Service Pack support (general) http://support.microsoft.com/?LN=en-us&scid=gp%3B%5Bln%5D%3Blifecycle&x=17&y=10#ServicePackSupport

    ·         SQL Server lifecycle http://support.microsoft.com/gp/lifeselectindex#S

  • Windows storport enhancement to help troubleshoot IO issues

    For Windows 2008 and Windows 2008 R2 you can download a Windows storport enhancement (packaged as a hotfix). This enhancement can lead to faster root cause analysis for slow IO issues. Once you apply this Windows hotfix you can use Event Tracing for Windows (ETW) via perfmon or xperf to capture more detailed IO information that you can share with your storage team. This could be very useful for your SQL Server installations or any system where you suspect IO issues.

     

    Enhancement information and background topics:

    ·         Storport ETW Logging to Measure Requests Made to a Disk Unit http://blogs.msdn.com/b/ntdebugging/archive/2010/04/22/etw-storport.aspx

    ·         Diagnose Slow I/O on Windows With Xperf https://www.youtube.com/watch?v=0h-i_EfzadA (from the MSFT guys who wrote it – based on a pre-release version but the basics still apply)

    ·         xPerf: Once I Was Blind and Now I See http://blogs.msdn.com/b/jimmymay/archive/2009/09/08/xperf-once-i-was-blind-and-now-i-see.aspx

    ·         Storport Driver http://msdn.microsoft.com/en-us/library/ff567541(VS.85).aspx

    The hotfix downloads are available from the top of each article and instructions are included in the body of each KB:

    ·         KB 979764 (Windows Server 2008 hotfix)

    ·         KB 978000 (Windows Server 2008 R2 hotfix)

    ·         http://msdn.microsoft.com/en-us/performance/cc825801.aspx (xperf downloads)

  • DBCC CHECKDB / Database Integrity

    It is very important to understand DBCC CHECKDB. Make sure you run DBCC CHECKDB periodically and that if you do find some sort of corruption you address it immediately – both the current problem in the SQL Server database and the underlying problem that caused it.

     

    ·         How often should we run CHECKDB?

    o   There is no single best schedule for how often to run CHECKDB. You have to understand how much risk you are willing to take and balance that with the impact of running CHECKDB. Paul Randal’s blog says to run some sort of consistency check “at least once a week”.

    o   On systems that are not used 24 hours a day where CHECKDB is able to complete during the low/no use period, maybe you run it every week or even every day. On systems where CHECKDB cannot complete within a downtime/slow period then either you take the performance hit or you run it less frequently.

    o   If you have systems that have been up for years with no corruption, does that mean you run it less often? Maybe, but remember that the older the hardware is the more likely it is to begin to wear out or even fail, and bad hardware is the cause of almost all database corruption problems.

    ·         How can we make it run faster?

    o   Indirectly, run it less often. 🙂

    §  Instead of running it for every database every night, maybe run it for half the dbs one night and the other half the next night.

    §  Do one database a night. Either round robin equally or do more important ones more frequently.

    §  Check individual tables with CHECKTABLE and don’t do them all at once (and frequently do the other database level checks that are included in CHECKDB – CHECKALLOC and CHECKCATALOG).

    §  Check one partition (assuming each is on a separate filegroup) at a time with CHECKFILEGROUP.

    §  Run CHECKDB more frequently on data that changes frequently and less often on less frequently updated or less important data.

    §  Create a program that runs one checkdb, then checks to see how much time is left and maybe runs another, looping through until it reaches the end of your batch window. Fancier versions might look at runtime history to estimate whether the “next” check can finish before the batch window ends, when each database was last checked, a priority you add to each database, etc.

    §  Use whatever schedule balances your ability to handle the risk of having corruption without knowing vs. the overhead of checking for the corruption.

    o   Make the IO faster and/or add more CPUs.

    o   Reduce other activity on the system while CHECKDB is running, especially data modifications.

    o   Reduce the amount of space used in the database.

    §  Archive unused data.

    §  Drop redundant, duplicate, or unused indexes.

    o   Use different options such as PHYSICAL_ONLY combined with having CHECKSUM enabled. Run a full CHECKDB less often.

    o   Restore the backup and run CHECKDB on the restored copy. This has the added benefit of testing the consistency of the log and testing the viability of the backup file itself (and the restore process).

    o   Use the TABLOCK option for CHECKDB. This may make the CHECKDB itself run faster BUT can result in some blocking.

    ·         Options

    o   Generally you will want WITH ALL_ERRORMSGS on. The default was OFF in older versions, but is ON in newer versions. So just specify it explicitly to avoid a mistake. A caveat here is that SSMS has been written to limit the output of CHECKDB to the first 1000 rows, so you’re better off running CHECKDB from a tool like SQLCMD or OSQL. This has the added benefit of avoiding the overhead of writing all that output to the memory of the client box (or possibly the server if you run SSMS them).

    o   NO_INFOMSGS is commonly used so you only have actual errors in the output, but sometimes the informational info can be useful to have.

    o   PHYSICAL_ONLY changes the impact from a CPU bound process to an IO bound process.

    ·         Finding errors

    o   If you have corruption, DBCC CHECKDB will NOT automatically abend! It will “successfully” complete. In SQL 2005 and later a “successful” CHECKDB will update the last known good run for that db.

    o   If SQL Agent is used to schedule the CHECKDB then under some conditions it may abend when corruption is detected. This is a feature of SQL Agent, not a feature of DBCC. So if you use another scheduling tool that tool would have to detect @@error or use another method to look for CHECKDB failures. Within SQL Agent, you will probably want to change your job steps so that a failure in checking one database does NOT fail the entire job, but instead continues checking the next database in the next job step.

    o   When CHECKDB detects a corruption error it writes a log SQLDUMPnnnn.txt to the SQL log directory.

    o   Try/Catch only catches exceptions and DBCC CHECK* errors are not exceptions. Therefore Try/Catch will not detect DBCC errors. 953503 The DBCC CHECKDB statement does not raise exceptions in SQL Server when the DBCC CHECKDB statement detect a consistency error in the database http://support.microsoft.com/default.aspx?scid=kb;EN-US;953503

    ·         Checking the log

    o   CHECKDB checks the data files. It does NOT check the log. The only way to ensure the log is not corrupted is to test a restore and see if it’s successful.

    ·         Suspect_pages table

    o   In SQL 2005 and later a table in MSDB called suspect_pages tracks page IO errors 823 and 824. It does NOT track metadata, header, or linkage corruption errors/problems. It also does not track 825 errors which are early indicators that often later become 823/824 errors.

    o   It is populated ONLY if a corrupted page is read into memory and if that page has an 823 or 824 problem.

    o   Only the first 1000 rows are kept, don’t rely on this to have every error if you have massive or long running corruption. You need to monitor and clean up this table.

    o   These pages are “suspected” to have problems, but it is possible the problem was transient or has already been fixed.

    ·         Backups

    o   The only way to verify a backup is good/usable is to restore it. Let me say it again – you don’t know you have a good backup until you have restored it!

    o   You can check that the header is fine with RESTORE …. WITH VERIFYONLY but that only checks the header and checksums!

    o   Enabling CHECKSUM on the database plus specifying WITH CHECKSUM on the backup will detect many types of problems, but not all.

    o   Even if the file is good at the time you take it, there’s no guarantee it will remain good. The media it is on can potentially cause corruption of the backup file(s).

    o   Did I mention that you don’t know you have a good backup until you have restored it?

    ·         Checksum database option

    o   A SQL Server DBA myth a day: (27/30) use BACKUP WITH CHECKSUM to replace DBCC CHECKDB http://sqlskills.com/BLOGS/PAUL/post/A-SQL-Server-DBA-myth-a-day-(2730)-use-BACKUP-WITH-CHECKSUM-to-replace-DBCC-CHECKDB.aspx

    o   Once CHECKSUM has been enabled at the database level (ALTER DATABASE … SET PAGE_VERIFY CHECKSUM) any data pages that are modified will have a checksum added. Until every page is modified there will be pages that have no checksum.

    o   CHECKSUM is calculated for a data page the first time that page is modified after the ALTER DATABASE.

    o   CHECKSUM values on pages are only checked when those pages are read into memory so rarely used pages can be corrupted for a long time without being detected! Common ways to read the pages and see if the checksum values are still valid: BACKUP WITH CHECKSUM and CHECKDB.

    o   CHECKSUM causes an error to be reported, it cannot correct the problem.

    o   CHECKSUM doesn’t do anything about in-memory corruptions or any corruption errors other than 823, 824, 825.

    o   CHECKSUM does NOT apply to/report problems with logical meta data, page linkages, stale reads, or index ordering.

    ·         Avoid corruption

    o   Make sure your hardware is sound.

    o   Alert on hardware level errors and take action on them.

    o   Keep your firmware and storport drivers updated.

    o   Alert on 823, 824, and 825 errors. If you already alert on severity 19+ errors that will capture 823 and 824 errors but not 825.

    o   Run SQLIOSim to check that the IO subsystem is still properly handling data correctness.

    ·         What should I do when there are errors?

    o   Check the status of your backups and start thinking about the consequences of restoring them.

    o   The REPAIR_ALLOW_DATA_LOSS option is your LAST resort. If you use it, you WILL lose data and you may very well never know how much or what was lost.

    o   Fix the underlying problem! If you see corruption once it will almost certainly happen again on the same system. The vast majority of the time the problem is with the hardware layer. Sometimes it is that the actual disk failed, sometimes it’s something less direct like failed batteries on the write controller combined with a power outage. It could potentially be firmware, a filter driver (Diskkeeper recently had a bug), or other problems. There was a rare bug (KB 954734) in SQL 2005 prior to SP3 (and SP3 is now the minimum supported version of 2005) where using the old DBREINDEX syntax instead of the new ALTER INDEX REBUILD/REORG syntax on a heap could corrupt the index and you would have to rebuild the index again. So you MUST find the source of the problem and increase monitoring on any system that has had a corruption problem.

    o   Understand the errors. Corruption in a non-clustered index can usually be fixed by rebuilding the index. Other types of errors can require a restore of a backup. Read this blog from the guy who wrote CHECKDB: http://www.sqlskills.com/BLOGS/PAUL/post/CHECKDB-From-Every-Angle-Tips-and-tricks-for-interpreting-CHECKDB-output.aspx

     

    General info:

    ·         Paul Randal’s collection of Corruption and CHECKDB blogs

    o   http://www.sqlskills.com/BLOGS/PAUL/category/Corruption.aspx

    o   http://www.sqlskills.com/BLOGS/PAUL/category/CHECKDB-From-Every-Angle.aspx

    ·         Sample corrupt databases to play with  

    o   http://www.sqlskills.com/BLOGS/PAUL/post/Sample-corrupt-databases-to-play-with.aspx

    o   http://www.sqlskills.com/BLOGS/PAUL/post/Conference-corruption-demo-scripts-and-example-corrupt-databases.aspx

    o   http://www.sqlskills.com/pastConferences.asp

    ·         SQL Server: Is CHECKDB A Necessity?

    http://blogs.msdn.com/psssql/archive/2009/02/20/sql-server-is-checkdb-a-necessity.aspx

    ·         Transaction Log (block) CHECKSUM
    http://sqlserverpedia.com/blog/sql-server-2005/transaction-log-block-checksum/

    ·         Which part of ‘REPAIR_ALLOW_DATA_LOSS’ isn’t clear? http://blogs.msdn.com/sqlserverstorageengine/archive/2006/06/16/633645.aspx

    ·         Misconceptions around database repair http://www.sqlskills.com/BLOGS/PAUL/post/Misconceptions-around-database-repair.aspx

    ·         SQL Server 2008 Database Checking  http://blogs.technet.com/josebda/archive/2009/03/20/sql-server-2008-checking-databases.aspx

     

    Checking the output

    ·         Automate your Database Integrity checks using SMO http://www.simple-talk.com/sql/backup-and-recovery/automate-your-database-integrity-checks-using-smo/

    ·         Inserting DBCC CHECKDB Results Into A Table http://www.lockergnome.com/sqlsquirrel/2009/03/11/inserting-dbcc-checkdb-results-into-a-table/

  • SQL Server lifecycle and the compatibility level settings

    I’ve had several people ask how the compatibility mode/level fits in with the SQL Server lifecycle. For example, the question might be: once we no longer support SQL Server 2000, does that mean we don’t support databases restored/attached to later versions of SQL and still set to 80 compatibility mode for example? The answer is that each version of SQL Server has a set of compatibility levels it supports. That support does not change based on the lifecycle. So for example, SQL Server 2008 R2 supports compatibility levels 80 (SQL 2000), 90 (SQL 2005), and 100 (SQL 2008). When you restore a SQL Server 2000 database to SQL Server 2008 R2 it remains in 80 compatibility mode until you issue ALTER DATABASE {dbname} SET COMPATIBILITY LEVEL = 100 (in older versions use sp_dbcmptlevel). When extended support for SQL Server 2000 ends in 2013, Microsoft will not support SQL Server 2000 any more. But we will still support a database on SQL Server 2008 R2 that is in 80 compatibility mode because that is a supported level/mode for R2. So the lifecycle refers to the actual instance, not the database level.

    I want to add some information here that a lot of people don’t understand. The compatibility level affects only some of the behavior of that database, mostly related to syntax and available features. A database set to 80 compatibility on SQL Server 2008 R2 is NOT the same as a database actually running on SQL Server 2000. For example, you can NOT restore the 2008 R2 80 compatibility mode database back to a 2000 instance. The optimizer is the 2008 R2 optimizer, not the 2000 optimizer. The compatibility mode/level is meant to be a temporary workaround while you fix syntax or keyword issues.