Sql Server数据库的一大优势

Sql Server数据库的一大优势,就是具有富UI的管理和调试工具,这点,绝对是优于ORACLE和其他的大中型数据库的。

Sql Server的众多工具中,对于开发人员和DBA来讲,非常重要的一个,就是Sql Profiler (事件探查器) 了。

Sql Server中执行的每个一个动作,都可以在Sql Profiler里看的一清二楚,这对于性能调优,后期维护等等是非常有帮助的。

但是,问题来了,在你的产品发布后,你可能不想让客户跟踪到你的SQL执行情况,便于对客户保密。那么这个优势,就成了你的“眼中钉”<iframe id="iframe_0.3481339267231632" style="border: medium; border-image: none; width: 28px; height: 30px;" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.zu14.cn/coolemotion/emotions/hi_3.gif?_=2208430%22%20style=%22border:none;max-width:1202px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.3481339267231632',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no"></iframe>

如何才能不被Sql Profiler跟踪到呢?

下面,我们就来探讨这个问题

假设,你有一张表A,里面有个字段password,保存密码,你执行下面的SQL:

SELECT [password] FROM [A]

在Sql Profiler 事件探查器里,你会看到如下的内容:

事件探查器 Sql Profiler 在该事件中找到 password 出于安全原因

— 在该事件文本中找到“password”。
— 出于安全原因,已用该注释替换此文本。

这样,就看不到你执行的SQL语句的内容了。<iframe id="iframe_0.7088511154862682" style="border: medium; border-image: none; width: 28px; height: 30px;" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.zu14.cn/coolemotion/emotions/zz_16.gif?_=2208430%22%20style=%22border:none;max-width:1202px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7088511154862682',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no"></iframe>

但是,你可能要疑惑了,我的表中,不可能都存在password字段啊 <iframe id="iframe_0.4873697396465109" style="border: medium; border-image: none; width: 28px; height: 30px;" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.zu14.cn/coolemotion/emotions/zz_13.gif?_=2208430%22%20style=%22border:none;max-width:1202px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.4873697396465109',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no"></iframe>

确实如此,但是微软做的更绝,只要在查询的过程中,任意地方出现关键词password,encryption,sp_setapprole之一,整个查询过程都将被隐藏,任意地方,当然也包括 注释 中。

例如,执行下面的过程语句:

isqlw

同样,在Sql Profiler中,可以看到如下的提示:

sql profiler isqlw

这样,事情就很清楚了,只要在所执行的想保护的SQL语句中,添加一个含有关键词的注释,就可以被保护起来了

猜你喜欢

转载自weitao1026.iteye.com/blog/2347588