SQL CLR: Liability in Disguise for a DBA?

  • First of all, let me make it clear, I am not against the CLR integration at all 😉 It serves much better than TSQL in some scenarios.

    But being a DBA, my question is, do not CLRs make it a bit difficult to keep the environment secure with optimal performance. Especially, when there is requirement to keep up to date with the latest SQL Server version, learn new enhancements and other daily responsibilities etc. and not to say personal preferences (With least priority though). My concerns are

    •How to make sure that the CLR code is safe to import in my environment? Is it handling the exceptions correctly? Is there any code that can be exploited? I agree, most/some of us do have knowledge of .NET, but complex code is hard to look into?

    •For security reasons, one have the option to mark the assemblies as SAFE, EXTERNAL_EXCESS etc. which are quite manageable but what about when you have to declare it as UNSAFE? (In my environment it is needed as the CLR is accessing non-SQL database through OLEDB. In this case even Microsoft would not give support until the CLR is disabled temporarily from SQL Server instance).

    •Moreover, is it the DBA’s responsibility to keep up to date with .NET framework hotfixes, Service Packs, Upgrade etc.? The Upgrade itself needs refreshing of the assemblies in most cases 🙁

    •Testing. How you go about testing the CLR? What factors should be looked into?

    •Should there be a baseline above which CLR functionality should not be allowed? What is the balanced approach?

    I know most of the environments would have the CLRs installed, but what is the best way to manage them and how the segregation of the responsibilities is done? At the end of the day, in most environments, the management seeks an immediate response from the DBAs, when it comes to performance downgrade, server hang etc. and in some cases you find yourself in a predicament 🙂

    Thanks in advance for suggestions and help.

  • Usman Butt (5/23/2012)


    First of all, let me make it clear, I am not against the CLR integration at all 😉 It serves much better than TSQL in some scenarios.

    But being a DBA, my question is, do not CLRs make it a bit difficult to keep the environment secure with optimal performance. Especially, when there is requirement to keep up to date with the latest SQL Server version, learn new enhancements and other daily responsibilities etc. and not to say personal preferences (With least priority though). My concerns are

    •How to make sure that the CLR code is safe to import in my environment? Is it handling the exceptions correctly? Is there any code that can be exploited? I agree, most/some of us do have knowledge of .NET, but complex code is hard to look into?

    •For security reasons, one have the option to mark the assemblies as SAFE, EXTERNAL_EXCESS etc. which are quite manageable but what about when you have to declare it as UNSAFE? (In my environment it is needed as the CLR is accessing non-SQL database through OLEDB. In this case even Microsoft would not give support until the CLR is disabled temporarily from SQL Server instance).

    •Moreover, is it the DBA’s responsibility to keep up to date with .NET framework hotfixes, Service Packs, Upgrade etc.? The Upgrade itself needs refreshing of the assemblies in most cases 🙁

    •Testing. How you go about testing the CLR? What factors should be looked into?

    •Should there be a baseline above which CLR functionality should not be allowed? What is the balanced approach?

    I know most of the environments would have the CLRs installed, but what is the best way to manage them and how the segregation of the responsibilities is done? At the end of the day, in most environments, the management seeks an immediate response from the DBAs, when it comes to performance downgrade, server hang etc. and in some cases you find yourself in a predicament 🙂

    Thanks in advance for suggestions and help.

    this really depends on who is writing your CLR code - is it external contractors or internal developers?

    have you validated that there is no open source code in the CLR that has a reciprocal license that requires you to publish the source code of your "ENTIRE" product.

    I have worked with 3rd party companies before who act as independant code quality auditors and review any potential license violations.

    have a look at SQS.com - these guys provide all of these services as well as being able to provide resources and strategy on testing.

    I think of all of these testing is the biggest issue to tackle in terms of man hours... functional testing, performance testing (load and soak), regression testing on code changes etc etc - perhaps a nice article/editorial on this site

    MVDBA

  • michael vessey (5/23/2012)


    have you validated that there is no open source code in the CLR that has a reciprocal license that requires you to publish the source code of your "ENTIRE" product.

    That was not on my mind. Thanks for sharing. But I do not think it is the case for us.


    I have worked with 3rd party companies before who act as independant code quality auditors and review any potential license violations.

    have a look at SQS.com - these guys provide all of these services as well as being able to provide resources and strategy on testing.

    Third party auditors review ....that I cannot see happening for us 😉


    I think of all of these testing is the biggest issue to tackle in terms of man hours... functional testing, performance testing (load and soak), regression testing on code changes etc etc - perhaps a nice article/editorial on this site

    That would indeed be great.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply