<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1116812007309218313</id><updated>2011-07-28T15:14:22.587+04:00</updated><title type='text'>Hossam Abdel Wahab "TECHNICAL BLOG"</title><subtitle type='html'>This blog will contain all my technical posts i think all my post will related with my Technical Experience 
 On (Microsoft SQL Server, .NET development) and related Solutions
hope be useful for all 
Regards</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-8822192009015701884</id><published>2010-03-11T13:39:00.001+04:00</published><updated>2010-03-11T13:42:48.976+04:00</updated><title type='text'>SQL Server perfromance Counters</title><content type='html'>&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 505px; DISPLAY: block; HEIGHT: 326px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5447309191536951746" border="0" alt="" src="http://3.bp.blogspot.com/_LgGdE9ZA8aQ/S5i62T9HwcI/AAAAAAAAAEM/WICNV2a_8Q8/s320/SQL+Server+Perfromance+Counters.png" /&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-8822192009015701884?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/8822192009015701884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=8822192009015701884&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/8822192009015701884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/8822192009015701884'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2010/03/sql-server-perfromance-counters.html' title='SQL Server perfromance Counters'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_LgGdE9ZA8aQ/S5i62T9HwcI/AAAAAAAAAEM/WICNV2a_8Q8/s72-c/SQL+Server+Perfromance+Counters.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-2434898931354685483</id><published>2010-01-27T14:18:00.000+04:00</published><updated>2010-01-27T14:19:13.047+04:00</updated><title type='text'>What's new for PerformancePoint Services (SharePoint Server 2010)</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-2434898931354685483?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://technet.microsoft.com/en-us/library/ee661741(office.14).aspx#ppsWhatsNewSection1' title='What&apos;s new for PerformancePoint Services (SharePoint Server 2010)'/><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/2434898931354685483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=2434898931354685483&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2434898931354685483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2434898931354685483'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2010/01/whats-new-for-performancepoint-services.html' title='What&apos;s new for PerformancePoint Services (SharePoint Server 2010)'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-2394877298046434600</id><published>2009-12-07T13:44:00.004+04:00</published><updated>2010-01-27T14:17:28.218+04:00</updated><title type='text'>Converting a Stored Procedure 2 View</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-2394877298046434600?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.sqlservercentral.com/articles/T-SQL/68233/' title='Converting a Stored Procedure 2 View'/><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/2394877298046434600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=2394877298046434600&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2394877298046434600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2394877298046434600'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2009/12/converting-stored-procedure-2-view.html' title='Converting a Stored Procedure 2 View'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-4636238125121107671</id><published>2009-11-19T16:10:00.005+04:00</published><updated>2009-11-19T16:22:17.470+04:00</updated><title type='text'>SQL Server 2008 R2 Pricing and Feature Changes</title><content type='html'>&lt;p&gt;&lt;strong&gt;Standard Edition: Now with Backup Compression&lt;/strong&gt;&lt;br /&gt;SQL Server 2008 introduced backup compression, but it was only available in Enterprise Edition. At the time, Enterprise Edition cost around $20,000 more per processor than Standard Edition, so companies couldn’t justify upgrading to Enterprise Edition just to get backup compression. Companies had to need Enterprise for multiple features in order to stomach the price. If all a DBA needed was compression, they could buy backup compression software much cheaper than the price of Enterprise Edition.&lt;br /&gt;In SQL 2008 R2, even Standard Edition gets backup compression. That’s a game-changer, and I’d expect to see smaller companies that do backup compression – and nothing else – to start falling by the wayside.&lt;br /&gt;In addition, Standard can now be a managed instance – it can be managed by some of the slick multi-server-management tools coming down the pike like the Utility Control Point (read my SQL 2008 R2 Utility review). It can’t be the management server itself – it can’t be a Utility Control Point – but at least we can manage Standard. It’s good to see that Microsoft recognizes all servers need to be managed, not just the expensive ones. Big thumbs up there.&lt;br /&gt;&lt;strong&gt;Enterprise Edition: CPU Limits&lt;/strong&gt;&lt;br /&gt;In Enterprise, Microsoft giveth and Microsoft taketh away. SQL 2008 R2’s BI tools include a new Master Data Services tool. It’s targeted at enterprises with data warehouses that need to manage incoming data from lots of different sources, and that data isn’t always clean or correct. MDS helps make sure data follows business rules. This isn’t a common need for OLTP systems, so it’s only included in Enterprise, not Standard. Makes sense.&lt;br /&gt;A little less easy to stomach, however, is a new set of caps on Enterprise Edition. The current SQL 2008 comparison page shows that Enterprise has no licensing limit on memory or the number of CPU sockets. SQL 2008 R2 Enterprise Edition is capped at 8 CPU sockets, and there’s a memory cap as well, but I haven’t been able to track down a public page showing the cap. The only hint is the SQL 2008 R2 edition comparison page, which notes that Datacenter Edition (more on that in a second) is licensed for “memory limits up to OS maximum.” If that wasn’t a unique selling point, it shouldn’t be included in the feature list.&lt;br /&gt;The more expensive Enterprise can act as the management server (Utility Control Point) for up to 25 instances. However, that doesn’t mean you need to buy one Enterprise per 24-25 Standard servers, and then manage them in pools – there’s an app edition for that.&lt;br /&gt;&lt;strong&gt;Datacenter Edition: For, Well, Datacenters&lt;/strong&gt;&lt;br /&gt;The new Datacenter Edition picks up where Enterprise now runs out of gas. It supports more than 8 sockets, up to 256 cores, and all the memory you can afford. Or can’t afford, for that matter.&lt;br /&gt;If you’re going to manage over 25 instances with the Utility Control Point stuff, Datacenter Edition can manage “more than 25 instances” according to Microsoft’s edition comparison page. I like how they worded that – they didn’t say “unlimited instances,” because there will be performance impacts associated with using Utility Control Points. The performance data collections gather a lot of data, and storing it for hundreds of instances will take some pretty high performance hardware.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Parallel Data Warehouse Edition: Sold with Hardware Only&lt;br /&gt;&lt;/strong&gt;The big new fella in town getting all the press is the artist formerly known as Project Madison, formerly known as DATAllegro. It’s a scale-out data warehouse appliance, but you won’t find this appliance at Home Depot. This version of SQL Server is sold in reference architecture hardware packages from Bull, Dell, HP, EMC, and IBM. Write one check, and you get a complete soup-to-nuts data warehouse storage engine that includes everything from the servers, SAN, configuration, and training.&lt;br /&gt;I had the chance to talk with Microsoft’s Val Fontama, and I’ll post more details of that interview next week, but I have to share one quick snippet. I asked what happens when a Parallel Data Warehouse system starts to have performance issues, and he explained that the DBA will need to call in specialized Parallel engineers. You won’t be popping open this rack and installing another drawer of hard drives yourself or adding additional commodity hardware boxes to scale out your datacenter. It’s more of a sealed solution than something you have to build yourself.&lt;br /&gt;I have mixed feelings about this – as a guy who loves hardware, I want to dive under the hood. However, as a guy who’s managed data warehouses, I know it’s one heck of an ugly skillset to learn on the job, and when data gets into the 5-10 terabyte range, you can’t afford to make configuration mistakes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How Much Would You Pay For All This?&lt;/strong&gt;&lt;br /&gt;It slices. It dices. And if you call now, you can get all this for the low, low sticker price of:&lt;br /&gt;• Standard Edition – $7,499 per processor (socket)&lt;br /&gt;• Enterprise Edition – $28,749 per processor&lt;br /&gt;• Datacenter Edition – $57,498 per processor&lt;br /&gt;• Parallel Data Warehouse Edition – $57,498 per processor (but you’ll be buying this in combination with hardware anyway)&lt;br /&gt;Eagle-eyed readers will note it’s about a 20% price increase from SQL Server 2008. That’s probably easy to justify on Standard Edition because Microsoft can say they’re throwing in backup compression, a feature that normally would have cost extra from third party vendors.&lt;br /&gt;SQL 2008 R2 Enterprise Edition, however, won’t have quite as easy of a time justifying its price increase given that it now has CPU caps and already had backup compression anyway&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-4636238125121107671?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.brentozar.com/archive/2009/11/sql-server-2008-r2-pricing-and-feature-changes/' title='SQL Server 2008 R2 Pricing and Feature Changes'/><link rel='enclosure' type='' href='http://www.brentozar.com/archive/2009/11/sql-server-2008-r2-pricing-and-feature-changes/' length='0'/><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/4636238125121107671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=4636238125121107671&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/4636238125121107671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/4636238125121107671'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2009/11/sql-server-2008-r2-pricing-and-feature.html' title='SQL Server 2008 R2 Pricing and Feature Changes'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-2345563373602252956</id><published>2009-07-01T16:26:00.003+04:00</published><updated>2009-07-01T16:32:54.065+04:00</updated><title type='text'>MS SQL Server System Databases</title><content type='html'>&lt;span style="font-family:georgia;"&gt;&lt;strong&gt;&lt;em&gt;The Resource Database&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;SQL Server added the Resource database. This database contains all the read-only critical system tables, metadata, and stored procedures that SQL Server needs to run. It does not contain any information about your instance or your databases, because it is only written to during an installation of a new service pack. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:georgia;"&gt;The Resource database contains all the physical tables and stored procedures referenced&lt;br /&gt;logically by other databases. The database can be found by default in C:\Program Files\Microsoft SQL&lt;br /&gt;Server\MSSQL10.MSSQLSERVER\MSSQL\Binn.mdf and .ldf, and there is only one Resource database perinstance.&lt;br /&gt;The use of drive C: in the path assumes a standard setup. If your machine is set up differently, you may&lt;br /&gt;need to change the path to match your setup. Additionally, the .MSSQLSERVER is the instance name.&lt;br /&gt;If your instance name is different, use your instance name in the path.&lt;br /&gt;In SQL Server 2000, when you upgraded to a new service pack, you would need to run many long scripts to drop and recreate system objects. This process took a long time to run and created an environment hat couldn’t be rolled back to the previous release after the service pack. In SQL Server 2008, when you pgrade to a new service pack or quick fix, a copy of the Resource database overwrites the old database.&lt;br /&gt;This enables you to both quickly upgrade your SQL Server catalog and roll back a release.&lt;br /&gt;The Resource database cannot be seen through Management Studio and should never be altered unless you’re under instruction to do so by Microsoft Product Support Services (PSS). You can connect to the database under certain single-user mode conditions by typing the command USE MSSQLSystemResource.&lt;br /&gt;Typically, a DBA runs simple queries against it while connected to any database, instead of having to connect to the resource database directly. Microsoft provides some functions which allow this access. For example, if you were to run this query while connected to any database, it would return your Resource database’s version and the last time it was upgraded:&lt;br /&gt;SELECT serverproperty(‘resourceversion’) ResourceDBVersion,&lt;br /&gt;serverproperty(‘resourcelastupdatedatetime’) LastUpdateDate Do not place the Resource database on an encrypted or compressed drive. Doing this may cause upgrade or performance issues.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;The master Database&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;The master database contains the metadata about your databases (database configuration and file location),logins, and configuration information about the instance. You can see some of the metadata stored in master by running the following query, which returns information about the databases that exist onthe server:SELECT * FROM sys.databasesThe main difference between the Resource and master databases is that the master database holds dataspecific to your instance, whereas the Resource database just holds the schema and stored proceduresneeded to run your instance, but does not contain any data specific to your instance. You should alwaysback up the master database after creating a new database, adding a login, or changing the configurationof the server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;tempdb Database&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;The tempdb database is similar to the operating system paging file. It’s used to hold temporary objects created by users, temporary objects needed by the database engine, and row-version information. The tempdb database is created each time you restart SQL Server. The database will be recreated to be its original database size when the SQL Server is stopped. Because the database is recreated each time, there is no reason to back it up. Data changes made to objects in the tempdb database benefit from reduced logging.&lt;br /&gt;It is important to have enough space allocated to your tempdb database, because many operations that you will use in your database applications use the tempdb. Generally speaking, you should set tempdb to autogrow as it needs space. If there is not enough space, the user may receive one of the following errors:&lt;br /&gt;❑ 1101 or 1105: The session connecting to SQL Server must allocate space in tempdb.&lt;br /&gt;❑ 3959: The version store is full.&lt;br /&gt;❑ 3967: The version store must shrink because tempdb is full.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;model Database&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;model is a system database that serves as a template when SQL Server creates a new database. As each database is created, SQL Server copies the model database as the new database. The only time this does not apply is when you restore or attach a database from a different server.&lt;br /&gt;If a table, stored procedure, or database option should be included in each new database that you create on a server, you may simplify the process by creating the object in model. When the new database is created, model is copied as the new database, including the special objects or database settings you have added to the model database. If you add your own objects to model, model should be included in your backups, or you should maintain a script which includes the changes.&lt;br /&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;msdb Database&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;msdb is a system database that contains information used by SQL Server agent, log shipping, SSIS, and the backup and restore system for the relational database engine. The database stores all the information about jobs, operators, alerts, and job history. Because it contains this important system-level data, you should back up this database regularly&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-2345563373602252956?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/2345563373602252956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=2345563373602252956&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2345563373602252956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2345563373602252956'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2009/07/ms-sql-server-system-databases.html' title='MS SQL Server System Databases'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-556044470224233454</id><published>2009-05-05T01:31:00.005+04:00</published><updated>2009-05-05T01:38:08.113+04:00</updated><title type='text'>Shrinking Truncate Log File - Log Full</title><content type='html'>Sometime, it looks impossible to shrink the Truncated Log file. Following code always shrinks the Truncated Log File to minimum size possible.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;USE DatabaseName&lt;br /&gt;GO&lt;br /&gt;DBCC SHRINKFILE(TransactionLogName, 1)&lt;br /&gt;BACKUP LOG 'DatabaseName' WITH TRUNCATE_ONLY&lt;br /&gt;DBCC SHRINKFILE(TransactionLogName, 1)&lt;br /&gt;GO &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-556044470224233454?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/556044470224233454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=556044470224233454&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/556044470224233454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/556044470224233454'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2009/05/shrinking-truncate-log-file-log-full.html' title='Shrinking Truncate Log File - Log Full'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-705113657589458768</id><published>2009-04-11T15:16:00.002+04:00</published><updated>2009-04-11T15:22:06.248+04:00</updated><title type='text'>Rebuild System Databases in SQL Server 2008</title><content type='html'>&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;The syntax for using setup.exe to rebuild the system databases is as follows:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;&lt;em&gt;setup.exe&lt;br /&gt;/QUIET&lt;br /&gt;/ACTION=REBUILDDATABASE&lt;br /&gt;/INSTANCENAME=instance_name&lt;br /&gt;/SQLSYSADMINACCOUNTS= accounts&lt;br /&gt;[/SAPWD=password]&lt;br /&gt;[/SQLCOLLATION=collation_name]&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:Trebuchet MS;font-size:85%;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;&lt;strong&gt;Here are the details about how to use this syntax and how it works&lt;/strong&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;&lt;br /&gt;1. Find setup.exe either from your original media or the "local" setup.exe as found in the directory where you have installed SQL Server in the 100\Setup BootStrap\Release directory. So on my machine, I changed directory to C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Release.&lt;br /&gt;2. Run setup.exe with the following syntax from a Windows command prompt:&lt;br /&gt;If you have SQL configured for Windows Authentication Mode use this syntax:&lt;br /&gt;setup /ACTION=REBUILDDATABASE /QUIET /INSTANCENAME=&lt;instance&gt; /SQLSYSADMINACCOUNTS=&lt;accounts&gt;&lt;br /&gt;where &lt;instance&gt; is either the name of your named instance or MSSQLSERVER for the default instance&lt;br /&gt;&lt;accounts&gt; are Windows groups or individual accounts to provision as sysadmin If you have SQL configured for Mixed Authentication Mode use the same syntax except you must also provide the /SAPWD parameter to specify the SA password. If you don't, you will get an error.&lt;br /&gt;If you want to rebuild the system databases with a different collation than what you used to install SQL Server, you would need to supply the /SQLCOLLATION parameter. If you don't supply this parameter, then SQL Server will rebuild the system databases with the collation you selected when you installed SQL Server.&lt;br /&gt;3. When setup has completed rebuilding the system databases, it will return to the command prompt with no messages (It always first prints out the version). If you have any syntax problems or issues with parameters you will see these errors in the command window. If you don't see any errors, then you will need to examine the "Summary" log file to verify it was completely successful.&lt;br /&gt;4. If you immediately go to the directory where logs are stored for setup (100\setup bootstrap\logs), you can open up a file called Summary.txt. This file represents the most recent summary of any execution of setup. If you run setup for any other reason after rebuilding the databases before you look at the summary.txt file you will have to look for a folder inside the logs directory that matches the datetime when you run setup to rebuild the system databases. This may not be something that is simple to do if you have run setup several times so a tip here is to use findstr.exe from the command prompt like the following:&lt;br /&gt;findstr /s RebuildDatabase summary*.*&lt;br /&gt;This search will point you to any summary files that are for rebuilding system databases because this is the string printed in the Summary setup log file when using setup for this purpose. Here is an example "top portion" of a Summary setup log file when rebuilding system databases was successful:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Overall summary:   &lt;/em&gt;&lt;br /&gt;&lt;em&gt;Final result:                  &lt;/em&gt;&lt;br /&gt;&lt;em&gt;Passed   &lt;/em&gt;&lt;br /&gt;&lt;em&gt;Exit code (Decimal):           0  &lt;/em&gt;&lt;br /&gt;&lt;em&gt; Exit message:                  Passed   &lt;/em&gt;&lt;br /&gt;&lt;em&gt;Start time:                    2008-08-29 08:09:10  &lt;/em&gt;&lt;br /&gt;&lt;em&gt; End time:                      2008-08-29 08:10:25   &lt;/em&gt;&lt;br /&gt;&lt;em&gt;Requested action:              RebuildDatabase&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;Here are a few interesting notes to consider about how this feature works:&lt;br /&gt;You don't need your DVD anymore!&lt;br /&gt;A new feature different from previous versions of SQL Server is that the system databases files we use to rebuild the current system databases do not come from the original installation media. So where do they come from? The come from the installation folder on your local computer in BINN\templates. On my machine where I installed SQL Server 2008 RTM on a clean machine with the default instance, this full path was at:&lt;br /&gt;C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\Templates&lt;br /&gt;In this directory you will find master, model, and msdb database and log files that were copied from your installation source as part of setup.&lt;br /&gt;So the logic in rebuilding the system databases is to get these files and copy them into your DATA directory to obtain your new system databases. This is a very nice enhancements for rebuilding system databases because you are not required to have your DVD or original install media.&lt;br /&gt;However, If these files are missing, then setup will fail and your summary log may look something like this:&lt;br /&gt;Overall summary:   Final result:                  Failed: see details below   Exit code (Decimal):           -2068643839   Exit facility code:            1203   Exit error code:               1   Exit message:                  Failed: see details below   Start time:                    2008-08-29 08:30:42   End time:                      2008-08-29 08:31:32   Requested action:              RebuildDatabase&lt;br /&gt;Later down in the summary log file you will see the details like the following example:&lt;br /&gt;Detailed results:   Feature:                       Database Engine Services   Status:                        Failed: see logs for details   MSI status:                    Passed   Configuration status:          Failed: see details below   Configuration error code:      0x8C77B9A8@1306@25   Configuration error description: The file C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\Templates\master.mdf is missing.   Configuration log:             C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20080829_083014\Detail.txt&lt;br /&gt;The details show the problem. master.mdf is missing from the templates directory. The way to resolve this is to either&lt;br /&gt;1) Use the Repair feature of Setup (Available from the Maintenance option of the SQL Server Installation Center installed your machine)&lt;br /&gt;2) Manually copy the necessary file(s) yourself. On your media source find the directory of your platform (x86, x64, or ia64). Then go to the following directory:&lt;br /&gt;setup\sql_engine_core_inst_msi\PFiles\SqlServr\MSSQL.X\MSSQL\Binn\Template&lt;br /&gt;Once you have copied the file into the templates directory, re-run setup with the syntax I've described above.&lt;br /&gt;What about the Resource Database?&lt;br /&gt;This feature does not attempt to restore the resource database files mssqlsystemresource.mdf or mssqlsystemresource.ldf. In fact, these files are considered part of the software so are now installed in the BINN directory. Therefore, to rebuild these database files you would need to run Repair from the Installation Center.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-705113657589458768?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/705113657589458768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=705113657589458768&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/705113657589458768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/705113657589458768'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2009/04/rebuild-system-databases-in-sql-server.html' title='Rebuild System Databases in SQL Server 2008'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-108511546400564721</id><published>2009-03-17T16:32:00.002+04:00</published><updated>2009-03-17T16:37:57.034+04:00</updated><title type='text'>Backup Database script</title><content type='html'>&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;Below&lt;/span&gt; &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;script&lt;/span&gt; &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;describe&lt;/span&gt; &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;how&lt;/span&gt; &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;to&lt;/span&gt; &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;backup&lt;/span&gt; &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;database&lt;/span&gt; &lt;span id="SPELLING_ERROR_7" class="blsp-spelling-error"&gt;and&lt;/span&gt; &lt;span id="SPELLING_ERROR_8" class="blsp-spelling-error"&gt;output&lt;/span&gt; &lt;span id="SPELLING_ERROR_9" class="blsp-spelling-error"&gt;file&lt;/span&gt; &lt;span id="SPELLING_ERROR_10" class="blsp-spelling-error"&gt;include&lt;/span&gt; &lt;span id="SPELLING_ERROR_11" class="blsp-spelling-error"&gt;current&lt;/span&gt; &lt;span id="SPELLING_ERROR_12" class="blsp-spelling-error"&gt;date&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;&lt;span id="SPELLING_ERROR_13" class="blsp-spelling-error"&gt;DECLARE&lt;/span&gt; @&lt;span id="SPELLING_ERROR_14" class="blsp-spelling-error"&gt;filename&lt;/span&gt; &lt;span id="SPELLING_ERROR_15" class="blsp-spelling-error"&gt;NVARCHAR&lt;/span&gt; ( 500 )&lt;br /&gt;&lt;span id="SPELLING_ERROR_16" class="blsp-spelling-error"&gt;SET&lt;/span&gt; @&lt;span id="SPELLING_ERROR_17" class="blsp-spelling-error"&gt;filename&lt;/span&gt; = 'C:\&lt;span id="SPELLING_ERROR_18" class="blsp-spelling-error"&gt;ABC&lt;/span&gt;_' + &lt;span id="SPELLING_ERROR_19" class="blsp-spelling-error"&gt;CONVERT&lt;/span&gt;(&lt;span id="SPELLING_ERROR_20" class="blsp-spelling-error"&gt;NVARCHAR&lt;/span&gt;, &lt;span id="SPELLING_ERROR_21" class="blsp-spelling-error"&gt;GETDATE&lt;/span&gt;(),112) + '.&lt;span id="SPELLING_ERROR_22" class="blsp-spelling-error"&gt;BAK&lt;/span&gt;'&lt;br /&gt;&lt;span id="SPELLING_ERROR_23" class="blsp-spelling-error"&gt;BACKUP&lt;/span&gt; &lt;span id="SPELLING_ERROR_24" class="blsp-spelling-error"&gt;DATABASE&lt;/span&gt; &lt;span id="SPELLING_ERROR_25" class="blsp-spelling-error"&gt;ABC&lt;/span&gt; &lt;span id="SPELLING_ERROR_26" class="blsp-spelling-error"&gt;TO&lt;/span&gt; &lt;span id="SPELLING_ERROR_27" class="blsp-spelling-error"&gt;DISK&lt;/span&gt; = @filename &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Trebuchet MS;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Trebuchet MS;font-size:85%;"&gt;&lt;span id="SPELLING_ERROR_28" class="blsp-spelling-error"&gt;Happy&lt;/span&gt; &lt;span id="SPELLING_ERROR_29" class="blsp-spelling-error"&gt;code&lt;/span&gt; ;) &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-108511546400564721?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/108511546400564721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=108511546400564721&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/108511546400564721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/108511546400564721'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2009/03/backup-database-script.html' title='Backup Database script'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-7929620722554802341</id><published>2008-12-28T15:02:00.003+04:00</published><updated>2008-12-28T15:10:32.515+04:00</updated><title type='text'>What's New in PerformancePoint SP2?</title><content type='html'>&lt;span style="font-family:verdana;font-size:78%;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Planning&lt;/strong&gt;&lt;br /&gt;Support for Windows Server 2008 Hyper-V™&lt;br /&gt;You can now use PerformancePoint Server 2007 SP2 with Windows Server 2008 Hyper-V.&lt;br /&gt;Hyper-V creates new opportunities for server virtualization. You can use Hyper-V to make more efficient use of system hardware and host operating system resources to reduce the overhead that is associated with virtualization.&lt;br /&gt;For more information, see the &lt;/span&gt;&lt;/span&gt;&lt;a href="http://technet.microsoft.com/en-us/library/bb218968.aspx?missingurl=%2fen-us%2flibrary%2f7e0a06c2-cea5-4ce2-877a-e156b23a7f24.aspx"&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;PerformancePoint Server 2007 Hyper-V guide&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Monitoring&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;You can now use SQL Server 2008 with PerformancePoint Server 2007 SP2.&lt;br /&gt;Important: To use SQL Server 2008 with PerformancePoint Server, you must install PerformancePoint Server 2007 SP2 before you install SQL Server 2008.&lt;br /&gt;You can now use the Show Details action on PerformancePoint reports that use data that is stored in SQL Server 2008 Analysis Services.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;Show Details enables dashboard consumers to right-click in a cell or on a chart value and see the transaction-level details for that value.&lt;br /&gt;PerformancePoint Server 2007 with SP2 now supports Windows Server 2008 Hyper-V.&lt;br /&gt;Hyper-V creates new opportunities for server virtualization. You can use Hyper-V to make more efficient use of system hardware and host operating system resources to reduce the overhead associated with virtualization.&lt;br /&gt;For more information, see the &lt;/span&gt;&lt;a href="http://go.microsoft.com/?linkid=9639690"&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;PerformancePoint Server 2007 Hyper-V guide&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt; (&lt;/span&gt;&lt;a href="http://go.microsoft.com/?linkid=9639690"&gt;&lt;span style="font-size:78%;"&gt;http://go.microsoft.com/?linkid=9639690&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;).&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;You can now use Dashboard Designer on a computer that us running .NET Framework 3.5 alongside .NET Framework 2.0.&lt;br /&gt;You must install .NET Framework 2.0 before you install .NET Framework 3.5.&lt;br /&gt;You can now use PerformancePoint Server with domains that have apostrophes in their names&lt;br /&gt;In previous versions of PerformancePoint Server, when a domain name included an apostrophe, the configuration tool failed for both Planning Server and Monitoring Server. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;Scorecard key performance indicator (KPI) queries are improved. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;Timeout errors no longer occur with scorecard key performance indicators (KPIs) that use data that is stored in SQL Server 2005 Analysis Services. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;Time Intelligence Post Formula filters now display the correct number of days for each month.&lt;br /&gt;In previous versions of PerformancePoint Server, the calendar control for Time Intelligence Post Formula filters sometimes displayed 31 days for each month. This is no longer the case. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;Time Intelligence filters now work on scorecard KPIs that use data that is stored in Analysis Services&lt;br /&gt;In previous versions of PerformancePoint Server, some Time Intelligence expressions caused filters that were linked to KPIs to fail.&lt;br /&gt;For example, when a compound expression such as (Day-7:Day-1) was used in a Time Intelligence Post Formula filter and that filter was linked to a KPI, an error message occurred. In PerformancePoint Server 2007 PS2, single and compound Time Intelligence expressions work with KPIs that use data that is stored in Analysis Services.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-7929620722554802341?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/7929620722554802341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=7929620722554802341&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/7929620722554802341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/7929620722554802341'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2008/12/whats-new-in-performancepoint-sp2.html' title='What&apos;s New in PerformancePoint SP2?'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-5997836602233960360</id><published>2008-11-02T19:36:00.001+04:00</published><updated>2008-11-02T19:38:12.066+04:00</updated><title type='text'>Download SQL Server 2005 Service Pack 3 - CTP</title><content type='html'>&lt;div class="entry"&gt;      &lt;div class="snap_preview"&gt;&lt;p&gt;&lt;span&gt;The CTP version of SQL Server 2005 Service Pack 3 (SP3) is now available. You can use these packages to upgrade any of the following SQL Server 2005 editions:&lt;/span&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Enterprise&lt;/li&gt;&lt;li&gt;Enterprise Evaluation&lt;/li&gt;&lt;li&gt;Developer&lt;/li&gt;&lt;li&gt;Standard&lt;/li&gt;&lt;li&gt;Workgroup&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;For a summary list of What’s new in SQL Server 2005 SP3 CTP, review the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=132124&amp;amp;clcid=0x409"&gt;What’s New document&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;These packages have been made available for general testing purposes only. Do not deploy the CTP software in production.&lt;/p&gt; &lt;h3 style="text-align: center;"&gt;&lt;strong&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=d22317e1-bc64-4936-a14b-7a632b50a4ca&amp;amp;DisplayLang=en" target="_blank"&gt;Download SQL Server 2005 Service Pack 3&lt;/a&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;/div&gt;         &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-5997836602233960360?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/5997836602233960360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=5997836602233960360&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/5997836602233960360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/5997836602233960360'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2008/11/download-sql-server-2005-service-pack-3.html' title='Download SQL Server 2005 Service Pack 3 - CTP'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-6985587915025360149</id><published>2008-07-30T13:14:00.007+04:00</published><updated>2008-07-30T13:25:16.637+04:00</updated><title type='text'>SQL Server 2008 SSMS Enhancements - Part I</title><content type='html'>&lt;em&gt;&lt;span style="font-family:georgia;"&gt;I have&lt;/span&gt;&lt;span style="font-family:georgia;"&gt; just installed SQL Server 2008 RC0 and had been playing a bit with the new Management Studio. I found a few interesting features. I will try to cover some of those features in this post. &lt;/span&gt;&lt;/em&gt;&lt;div&gt;&lt;div&gt;&lt;span style="font-family:georgia;"&gt;&lt;em&gt;&lt;/em&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span style="font-family:georgia;"&gt;&lt;em&gt;&lt;strong&gt;The new cool splash screen SQL Server 2008&lt;/strong&gt; has got an all new logo and splash screen.&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://bp0.blogger.com/_LgGdE9ZA8aQ/SJAxwdXB70I/AAAAAAAAACI/OYx1zkgTl4k/s1600-h/1261.jpg"&gt;&lt;em&gt;&lt;img id="BLOGGER_PHOTO_ID_5228733875961851714" style="CURSOR: hand" alt="" src="http://bp0.blogger.com/_LgGdE9ZA8aQ/SJAxwdXB70I/AAAAAAAAACI/OYx1zkgTl4k/s320/1261.jpg" border="0" /&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt; &lt;/em&gt;&lt;/div&gt;&lt;div&gt;&lt;em&gt;&lt;strong&gt;Activity Monitor&lt;br /&gt;&lt;/strong&gt;The next feature that attracted me is the new "Activity Monitor".&lt;/em&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://bp3.blogger.com/_LgGdE9ZA8aQ/SJAyIolv-6I/AAAAAAAAACQ/I97mbykFJYA/s1600-h/1259.jpg"&gt;&lt;em&gt;&lt;img id="BLOGGER_PHOTO_ID_5228734291293240226" style="CURSOR: hand" alt="" src="http://bp3.blogger.com/_LgGdE9ZA8aQ/SJAyIolv-6I/AAAAAAAAACQ/I97mbykFJYA/s320/1259.jpg" border="0" /&gt;&lt;/em&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;em&gt;It opens a window that displays the server activities. &lt;/em&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://bp3.blogger.com/_LgGdE9ZA8aQ/SJAyWZmMC3I/AAAAAAAAACY/sV7KaLZgJzA/s1600-h/1260.jpg"&gt;&lt;em&gt;&lt;img id="BLOGGER_PHOTO_ID_5228734527786716018" style="CURSOR: hand" height="244" alt="" src="http://bp3.blogger.com/_LgGdE9ZA8aQ/SJAyWZmMC3I/AAAAAAAAACY/sV7KaLZgJzA/s320/1260.jpg" width="459" border="0" /&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;br /&gt;What I found most useful is the section that shows "Recent Expensive Queries". One of the tasks that I do quite often is the optimization of "bad" queries or even "well written" queries that does not perform well enough. This panel of the activity monitor seems to be a good tool which readily shows me the stuff that I need to work on.&lt;br /&gt;Missing Index hints in Graphical Execution Plan&lt;br /&gt;Another change that I noticed instantly is the addition of Missing Index Hints in the query execution plan. &lt;/em&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://bp2.blogger.com/_LgGdE9ZA8aQ/SJAyp12xIxI/AAAAAAAAACg/I1g6StvCDZA/s1600-h/1256.jpg"&gt;&lt;em&gt;&lt;img id="BLOGGER_PHOTO_ID_5228734861789963026" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_LgGdE9ZA8aQ/SJAyp12xIxI/AAAAAAAAACg/I1g6StvCDZA/s320/1256.jpg" border="0" /&gt;&lt;/em&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;em&gt;You could right click on the index hint and it will show a context menu that will take you to the details of the missing index.&lt;br /&gt;&lt;/em&gt;&lt;/div&gt;&lt;a href="http://bp2.blogger.com/_LgGdE9ZA8aQ/SJAzBtg2dqI/AAAAAAAAACo/lme_pD5G4Uk/s1600-h/1257.jpg"&gt;&lt;em&gt;&lt;img id="BLOGGER_PHOTO_ID_5228735271867414178" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_LgGdE9ZA8aQ/SJAzBtg2dqI/AAAAAAAAACo/lme_pD5G4Uk/s320/1257.jpg" border="0" /&gt;&lt;/em&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;em&gt;&lt;/em&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:georgia;"&gt;&lt;em&gt;&lt;/em&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-6985587915025360149?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/6985587915025360149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=6985587915025360149&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/6985587915025360149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/6985587915025360149'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2008/07/sql-server-2008-ssms-enhancements-part.html' title='SQL Server 2008 SSMS Enhancements - Part I'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_LgGdE9ZA8aQ/SJAxwdXB70I/AAAAAAAAACI/OYx1zkgTl4k/s72-c/1261.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-5947484932980658269</id><published>2008-07-24T11:32:00.004+04:00</published><updated>2008-07-24T11:49:57.420+04:00</updated><title type='text'>Upgrade live applications to SQL Server 2005 for high availability</title><content type='html'>&lt;div&gt;Most companies have the luxury of upgrading their applications in place. But for many industries such as credit card, banking, shopping and gaming companies, the prospect of downtime is unacceptable. Imagine eBay/PayPal taking the system down for even one hour for an upgrade. The costs quickly escalate into the millions in just lost immediate revenue, not to mention the customers that would be lost to competitors.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;The challenge &lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Your boss has told you that the ordering application has to be upgraded to version 10 with less than 15 minutes downtime. The database in question is 4+ TB and takes 16 hours to upgrade without any traffic running to it.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;Reality check&lt;/strong&gt;&lt;br /&gt;The best laid ideas often fail because the scope of the project is not set early on and strictly adhered to. You will probably need to focus on a few key application areas that are critical to convert live. In eBay's case, it might say that, throughout the course of the upgrade, activities such as placing auctions, bids, payments and so on have to be live, but it's acceptable if you can't provide feedback or account merges. Try to avoid converting any data live, but keep each functional unit (block of tables) intact and transfer them live. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;strong&gt;Hypothetical process&lt;br /&gt;&lt;/strong&gt;What process you pick, is heavily dependent on your budget. In this hypothetical scenario, we'll use two clusters with two nodes each. But you could easily simulate this scenario using two SQL Server instances on the same physical (or cluster) box or virtual servers running something like VMware's ESX. Let's examine the figure below. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://bp2.blogger.com/_LgGdE9ZA8aQ/SIgzKFkoZ6I/AAAAAAAAACA/_N4Ma-oVU6A/s1600-h/upgrade_pt4-sm.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5226483615950989218" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_LgGdE9ZA8aQ/SIgzKFkoZ6I/AAAAAAAAACA/_N4Ma-oVU6A/s320/upgrade_pt4-sm.gif" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;&lt;strong&gt;Using two clusters and two nodes for live application upgrade. &lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt; &lt;/div&gt;&lt;div&gt;&lt;strong&gt;Stage 1&lt;br /&gt;&lt;/strong&gt;In stage 1, we have the live data flowing into the current version of the database application. We created a second conversion database on Cluster 1 that contains any tables we want to convert over to the upgraded database – while the application is live. The most important part at this point is determining how to maintain consistency in the tables. The most common method is saving off of the current date/reference number for all conversion data at the time you want to start converting. Then continually you'd use a job that fires off stored procedures to bring over dates/reference numbers greater than the initial numbers you saved off. You could use other methods, such as triggers or Service Broker, but both would involve modifications to the original database schema and increase your risk and chance of making a mistake.&lt;br /&gt;&lt;strong&gt;Stage 2&lt;br /&gt;&lt;/strong&gt;Stage 2 is a second physical cluster (or second instance/virtual server, depending on budget). As far as the schema goes, the conversion database on Cluster 2 exactly matches the conversion database on Cluster 1.&lt;br /&gt;As the application pushes live data into the Order App DB (V9), the SQL Agent job on Cluster 1 fires off stored procedures that move the data into the conversion database on Cluster 1. Once the data reaches the conversion database, you can set up a replication publication on Cluster 1 for the conversion database that has a subscription running on Cluster 2. This causes any data pushed into the conversion database to transfer almost immediately into the conversion database on Cluster 2.&lt;br /&gt;As the application is live pushing data into Cluster 1's version 9 database and is replicated over to the conversion database on Cluster 2, you can run the database upgrade process on Cluster 2's Order App DB – which you already restored from production at some point. Regardless of the time the database upgrade takes to run, the live data will be flowing into the conversion database on Cluster 2. Once the database upgrade is complete, you can fire off the SQL Server Agent job on Cluster 2; this fires off stored procedures that convert the version 9 data tables in the conversion database into the upgraded version 10 database sitting on Cluster 2. At this point, you'll have a chance to do any necessary configuration/maintenance to the upgraded version 10 database.&lt;br /&gt;&lt;strong&gt;Stage 3&lt;/strong&gt;&lt;br /&gt;Once the conversion database on Cluster 2 is close to empty and the clients are upgraded to version 10, it's time to simply turn off Cluster 1 and point all the clients to Cluster 2, which already have all the critical live data transferred. A quick method of switching clients to version 10 would be SMS or SoftGrid (application virtualization), or some other method of automatically deploying a new version of a client en masse to a large client base. This would allow you to deploy version 10 applications within 15 minutes and they'd point to the freshly upgraded version 10 database on Cluster 2.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;Summary &lt;/strong&gt;&lt;br /&gt;Upgrading an application while it is live requires that a lot of custom code be written to ensure the tables are consistent between the clusters (servers or instances). Test the upgrade scenario/scripts out several times, verifying reports at all the various stages to make sure the upgrade flows like clockwork. Verifying the various conversion database processes and jobs and documenting and ensuring consistency is fairly boring work, but it will pay off in the end when the upgrade flows smoothly. It beats working out issues within the user's sight. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-5947484932980658269?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/5947484932980658269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=5947484932980658269&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/5947484932980658269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/5947484932980658269'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2008/07/upgrade-live-applications-to-sql-server.html' title='Upgrade live applications to SQL Server 2005 for high availability'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_LgGdE9ZA8aQ/SIgzKFkoZ6I/AAAAAAAAACA/_N4Ma-oVU6A/s72-c/upgrade_pt4-sm.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-6479142171502045409</id><published>2008-07-22T11:22:00.003+04:00</published><updated>2008-07-22T11:31:14.164+04:00</updated><title type='text'>Configure IBM Cognos 8.3 with IIS 7 and Windows Vista</title><content type='html'>One of the common problems I has facing is Configure IBM Cognos 8.3 with IIS 7 and Windows Vista for that I summarize the configuration in the following steps hoping be useful&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. In IIS7 goto your device name &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;2. There in the center screen open ISAPI and CGI RESTRICTIONS &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;3. On the right screen click add &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;4. the path: %windir%\system32\inetsrv\cgi.dll (if you dont have this file, install it from the 'turn windows features on/off) where you can find it under the IIS component. &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;5. Name this thing something like 'dot cgi' &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;6. Allow it to execute -&gt; done &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;7. Now click on the right screen 'edit feature settings' and allow cgi (I allowed both cgi and isapi )&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;8. Click on your device name again and in the center screen open 'Handler mappings' &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;9. Add module mapping &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;10. Request path: *.cgi &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;11. Module: CgiModule &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;12. Name: dot.cgi &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Now you can go to open welcome page and start navigate :http://"ServerName"/Cognos8&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Warning: do not add cgi as MIME type&lt;/strong&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-6479142171502045409?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/6479142171502045409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=6479142171502045409&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/6479142171502045409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/6479142171502045409'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2008/07/configure-ibm-cognos-83-with-iis-7-and.html' title='Configure IBM Cognos 8.3 with IIS 7 and Windows Vista'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-2773261944599366899</id><published>2008-07-15T12:51:00.005+04:00</published><updated>2008-07-15T13:00:54.960+04:00</updated><title type='text'>SQL Server Audit in SQL Server 2008</title><content type='html'>SQL Server 2008 February CTP introduces a new feature, SQL Server Audit. This feature facilitates auditing of Database Engine events by providing simple T-SQL statements to enable, store, and view audits on server and database objects. Compared to auditing with SQL Server trace files, using SQL Server Audit is much easier and cleaner. SQL Server Audit is implemented in the SQL Server Extended Events infrastructure. Extended events are created by the T-SQL statements to record the occurrences of the auditable actions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To implement SQL Server audits, you first need to create a SQL Server Audit object. This object collects server and/or database-level actions and groups of actions that you want to monitor. It is created at the SQL Server instance level. You can have multiple SQL Server Audit objects per SQL Server instance. In the SQL Server Audit object, you specify the location for the output of the audit results. The results can be written to a binary file, the Windows Application Log, or the Windows Security Log. The file or the log is the Target component and the consumer of the associated extended events. Then you create Server or Database Audit Specification objects that belong to the SQL Server audit object. A Server Audit Specification collects server-level actions grouped in server audit action groups. It cannot collect individual actions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, a Database Audit Specification collects both database-level audit action groups and individual actions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In Part I of this series, we will focus on the server level events. Server audit action groups record logon and logoff operations, server principal changes, server and database role membership changes, database maintenance operations, server object changes, database object changes, server and database statement and object permission changes. Any database related action groups are collected on all the databases on the server instance.&lt;br /&gt;&lt;br /&gt;For example, DATABASE_ROLE_MEMBER_CHANGE_GROUP in a Server Audit Specification collects any actions that add or remove a login from a database role in any database on the server. If you want to audit only one database, you will need to define a Database Audit Specification in that specific database.&lt;br /&gt;As part of the auditing requirements, we would like to monitor server logins and their server-level permission changes. To monitor login additions and deletions, we can include the SERVER_PRINCIPAL_CHANGE_GROUP audit action group in our server audit specification. Server-level permissions can be changed by issuing GRANT, REVOKE, or DENY, or through assigning server role memberships. Therefore, we can include the SERVER_PERMISSION_CHANGE_GROUP and SERVER_ROLE_MEMBER_CHANGE_GROUP audit action groups.&lt;br /&gt;In this script, we write the audit to the Application Log.&lt;br /&gt;&lt;br /&gt;/* Create a SQL Server Audit Object that writes the audit results to the Windows Application Log every one second.&lt;br /&gt;If the write fails, the instance continues running without stopping. */&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;CREATE SERVER AUDIT MyServerAudit&lt;br /&gt;TO APPLICATION_LOG&lt;br /&gt;WITH ( QUEUE_DELAY = 1000, ON_FAILURE = CONTINUE);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;/* Create a Server Audit Specification object for the server audit.&lt;br /&gt;This object include three audit action groups related to server principal changes. */&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;CREATE SERVER AUDIT SPECIFICATION MyServerAuditSpecification&lt;br /&gt;FOR SERVER AUDIT MyServerAudit&lt;br /&gt;ADD (SERVER_PRINCIPAL_CHANGE_GROUP),&lt;br /&gt;ADD (SERVER_PERMISSION_CHANGE_GROUP),&lt;br /&gt;ADD (SERVER_ROLE_MEMBER_CHANGE_GROUP);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;/* By default, both the audit and audit specification are created in the disabled state.&lt;br /&gt;We need to enable them before using them to record actions. */&lt;br /&gt;&lt;span style="font-size:85%;"&gt;ALTER SERVER AUDIT SPECIFICATION MyServerAuditSpecification&lt;br /&gt;WITH (STATE = ON);&lt;br /&gt;ALTER SERVER AUDIT MyServerAudit&lt;br /&gt;WITH (STATE = ON);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;You can confirm that the server audit object and the server audit specification object have been created by selecting from the system views shown below.SELECT * FROM sys.server_audits&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;SELECT * FROM sys.server_audit_specifications&lt;br /&gt;To confirm that an extended event session has been created, we can select from the extended events dynamic management views.select s.name as [session name], se.event_name as [event name], p.name as [package name], t.target_name as [target name]&lt;br /&gt;from sys.dm_xe_sessions s&lt;br /&gt;join sys.dm_xe_session_events se on s.address = se.event_session_address&lt;br /&gt;join sys.dm_xe_packages p on se.event_package_guid = p.guid&lt;br /&gt;join sys.dm_xe_session_targets t on s.address=t.event_session_address&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;As we can see above, an extended event session called MyServerAudit$A was created. It includes the audit_event from the SecAdudit package. The audit is written to Application Event log asynchronously.&lt;br /&gt;Let’s test this script by adding a login called testlogin. Grant the View Server State permission to the login, and add it to the dbcreator role.CREATE LOGIN testLogin WITH PASSWORD = 'Welcome123'&lt;br /&gt;GRANT VIEW SERVER STATE TO testLogin&lt;br /&gt;EXEC sp_addsrvrolemember 'testLogin', 'dbcreator'&lt;br /&gt;DROP LOGIN testLogin&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;We can examine the Application Log by running the Windows Powershell command below.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;color:#000099;"&gt;Get-EventLog -logname "application" -newest 4 where {$_.Source -eq 'MSSQLSERVER' } &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#000099;"&gt;select EntryType, EventID, Message, TimeGenerated format-list&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;img id="BLOGGER_PHOTO_ID_5223162607114719394" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 395px; CURSOR: hand; HEIGHT: 227px; TEXT-ALIGN: center" height="226" alt="" src="http://bp2.blogger.com/_LgGdE9ZA8aQ/SHxmt7ktEKI/AAAAAAAAABc/eP7mj73Y5wI/s320/yp_audit1_image001.jpg" width="365" border="0" /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#000099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#000099;"&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-2773261944599366899?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/2773261944599366899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=2773261944599366899&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2773261944599366899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2773261944599366899'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2008/07/sql-server-audit-in-sql-server-2008.html' title='SQL Server Audit in SQL Server 2008'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_LgGdE9ZA8aQ/SHxmt7ktEKI/AAAAAAAAABc/eP7mj73Y5wI/s72-c/yp_audit1_image001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-3155142988038006920</id><published>2008-07-01T11:00:00.002+04:00</published><updated>2008-07-01T11:07:49.819+04:00</updated><title type='text'>Integrating Telephony Services Into .NET Applications</title><content type='html'>&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;Software developers have had limited access to telecom networks and capabilities. Specialized computer-telephony integration protocols are too complex and inflexible to properly link telephony services into enterprise business applications. As such, integrating person-to-person calling, conferencing, and call routing capabilities such as find me-follow me into applications has always been the preserve of specialized developers. As organizations continually attempt to increase the efficiency of their business processes through communications, the inability to easily tie communications services into the fabric of daily operational processes has emerged as a serious obstacle to business profitability.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;With the advent of next-generation IP communications, Session Initiation Protocol (SIP), and Web services, these barriers to interconnectivity are being deconstructed. IT and communications systems now share a common language. However, developers are still faced with a lack of easy-to-use development tools to take advantage of this new interconnection capability. In particular, developers using Microsoft’s .NET Framework are challenged by the lack of tools to discover and incorporate telephony services into their business applications. SIP Objects.NET from Inova IT fills this void&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;you can download the white paper from below URL&lt;/span&gt;&lt;br /&gt;&lt;a href="http://lippisreport.com/2007/09/12/integrating-telephony-services-into-net-applications/"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;http://lippisreport.com/2007/09/12/integrating-telephony-services-into-net-applications/&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-3155142988038006920?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/3155142988038006920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=3155142988038006920&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/3155142988038006920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/3155142988038006920'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2008/07/integrating-telephony-services-into-net.html' title='Integrating Telephony Services Into .NET Applications'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-308091681567964108</id><published>2007-11-14T02:20:00.000+04:00</published><updated>2007-11-14T16:01:05.784+04:00</updated><title type='text'>Search into database tables - Without Cursors</title><content type='html'>Is there such a thing as a task where you would not need a cursor? Hidden in the depths of the master database are a series of stored procedures that can replace some cursors with these one-liners. Behind the scenes, cursors are still used, but they will save you tons of development time.&lt;br /&gt;Traditionally if you wanted to run a DBCC CHECKTABLE on every table in a database you'd have to write an elaborate cursor like below :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;create table #Result&lt;br /&gt;(&lt;br /&gt;tablename nvarchar(1000),&lt;br /&gt;columnname nvarchar(1000),&lt;br /&gt;searchvalue nvarchar(1000)&lt;br /&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;&lt;br /&gt;declare @searchstring as varchar(1000)&lt;br /&gt;declare @searchscript as varchar(2000)&lt;br /&gt;set @searchstring = 'Hossam'&lt;br /&gt;set @searchscript =&lt;br /&gt;'declare @sql as varchar(8000)&lt;br /&gt;set @sql = ''select '''''''' tablename,'''''''' columnname,'''''''' value where 1=0''&lt;br /&gt;select&lt;br /&gt;@sql = @sql + '' union all select ''''?'''','''''' +&lt;br /&gt;name + '''''',['' + name + ''] from ? where ['' + name + ''] like ''''%' + @searchstring + '%''''''&lt;br /&gt;from&lt;br /&gt;syscolumns&lt;br /&gt;where&lt;br /&gt;xtype in (175,239,231,167)&lt;br /&gt;and id=object_id(''?'')&lt;br /&gt;insert into #Result&lt;br /&gt;Exec (@sql)&lt;br /&gt;print ''search is completed on ?.'''&lt;br /&gt;exec sp_msforeachtable @searchscript&lt;br /&gt;select * from #Result&lt;br /&gt;--drop table #Result&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-308091681567964108?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/308091681567964108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=308091681567964108&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/308091681567964108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/308091681567964108'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2007/11/search-into-database-tables-life.html' title='Search into database tables - Without Cursors'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-2554165991246500665</id><published>2007-11-06T13:47:00.000+04:00</published><updated>2007-11-06T14:12:38.389+04:00</updated><title type='text'>Microsoft Windows PowerShell and SQL Server 2005 SMO</title><content type='html'>As you probably know, Windows PowerShell is the new command shell and scripting language that provides a command line environment for interactive exploration and administration of computers. In addition, it provides an opportunity to script these commands so that we can schedule and run these scripts multiple times.&lt;br /&gt;&lt;br /&gt;Windows PowerShell depends on .NET framework 2.0. SQL Server Management Objects, known as SMO, is an object model for SQL Server and its configuration settings. SMO-based applications use .NET Framework languages to program against this in-memory object model, rather than sending Transact-SQL (T-SQL) commands to SQL Server to do so.&lt;br /&gt;&lt;br /&gt;In this article series, I am going to illustrate the power of Windows PowerShell in conjunction with SQL Server 2005. Part I of this series is going to illustrate how to install and use a simple PowerShell command and a simple SMO command.&lt;br /&gt;&lt;strong&gt;Assumption &lt;/strong&gt;&lt;br /&gt;a. The machine you use already has .NET 2.0 installed b. The machine you use already has SQL Server 2005 client installed with the latest service pack Download and Install Microsoft PowerShell.&lt;br /&gt; Download Microsoft PowerShell “WindowsXP-KB926139-x86-ENU.exe” from &lt;a href="http://download.microsoft.com/"&gt;http://download.microsoft.com/&lt;/a&gt;&lt;br /&gt;b. Install PowerShell Step 1: Double click on the “WindowsXP-KB926139-x86-ENU.exe’ executable. [Refer Fig 1.0]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_LgGdE9ZA8aQ/RzA8niqwG5I/AAAAAAAAABU/jUAg3fKEo3g/s1600-h/mak_PowerShell_image001th.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5129666625593678738" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp0.blogger.com/_LgGdE9ZA8aQ/RzA8niqwG5I/AAAAAAAAABU/jUAg3fKEo3g/s320/mak_PowerShell_image001th.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="left"&gt;Fig 1.0&lt;/div&gt;&lt;br /&gt;&lt;a href="http://bp2.blogger.com/_LgGdE9ZA8aQ/RzA5tCqwGxI/AAAAAAAAAAU/HWj2yOEfZNU/s1600-h/mak_PowerShell_image002.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5129663421548075794" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp2.blogger.com/_LgGdE9ZA8aQ/RzA5tCqwGxI/AAAAAAAAAAU/HWj2yOEfZNU/s320/mak_PowerShell_image002.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_LgGdE9ZA8aQ/RzA5tSqwGyI/AAAAAAAAAAc/uo3zmZWjLT4/s1600-h/mak_PowerShell_image003.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5129663425843043106" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp3.blogger.com/_LgGdE9ZA8aQ/RzA5tSqwGyI/AAAAAAAAAAc/uo3zmZWjLT4/s320/mak_PowerShell_image003.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp1.blogger.com/_LgGdE9ZA8aQ/RzA5tyqwG0I/AAAAAAAAAAs/0t1ofzZgKUk/s1600-h/mak_PowerShell_image005.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5129663434432977730" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp1.blogger.com/_LgGdE9ZA8aQ/RzA5tyqwG0I/AAAAAAAAAAs/0t1ofzZgKUk/s320/mak_PowerShell_image005.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Launch PowerShell&lt;br /&gt;&lt;/strong&gt;There are few ways to launch PowerShell. One method is to go to the command prompt and type the following command. [Refer Fig 1.6]&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp1.blogger.com/_LgGdE9ZA8aQ/RzA7WyqwG2I/AAAAAAAAAA8/C4kO_WuW4tQ/s1600-h/mak_PowerShell_image007.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5129665238319242082" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 389px; CURSOR: hand; HEIGHT: 131px" height="118" alt="" src="http://bp1.blogger.com/_LgGdE9ZA8aQ/RzA7WyqwG2I/AAAAAAAAAA8/C4kO_WuW4tQ/s320/mak_PowerShell_image007.jpg" width="389" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After a short pause, the PowerShell prompt appears. [Refer Fig 1.7]&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_LgGdE9ZA8aQ/RzA71iqwG3I/AAAAAAAAABE/MkOitU6pQWo/s1600-h/mak_PowerShell_image008.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5129665766600219506" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp0.blogger.com/_LgGdE9ZA8aQ/RzA71iqwG3I/AAAAAAAAABE/MkOitU6pQWo/s320/mak_PowerShell_image008.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Alternatively, you can start PowerShell by selecting Programs-Windows PowerShell 1.0-Windows PowerShell. [Refer Fig 1.8]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp1.blogger.com/_LgGdE9ZA8aQ/RzA8FyqwG4I/AAAAAAAAABM/tLJe4sT-iM4/s1600-h/mak_PowerShell_image009.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5129666045773093762" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://bp1.blogger.com/_LgGdE9ZA8aQ/RzA8FyqwG4I/AAAAAAAAABM/tLJe4sT-iM4/s320/mak_PowerShell_image009.jpg" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-2554165991246500665?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/2554165991246500665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=2554165991246500665&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2554165991246500665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/2554165991246500665'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2007/11/microsoft-windows-powershell-and-sql.html' title='Microsoft Windows PowerShell and SQL Server 2005 SMO'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_LgGdE9ZA8aQ/RzA8niqwG5I/AAAAAAAAABU/jUAg3fKEo3g/s72-c/mak_PowerShell_image001th.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-3777976185268315794</id><published>2007-10-30T15:53:00.000+04:00</published><updated>2007-10-30T16:03:48.659+04:00</updated><title type='text'>Setting the default Button in ASP.NET</title><content type='html'>&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;to set default button in ASp.net 2.0 is to easy but in asp.net 1.0 i think every one will be facing the problem i hade faced.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;font-size:85%;"&gt;i try to use many ways to solve this problem and finally solve it by the below Syntax put it in your page load and replace the text name with your text on the page and the button y need to make it the default button and happy code&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;txt_Search&lt;/strong&gt;.Attributes.Add("onkeydown", "if(event.which  event.keyCode){if ((event.which == 13)  (event.keyCode == 13)) {document.getElementById('" + &lt;strong&gt;Me.btn_Search&lt;/strong&gt;.UniqueID + "').click();return false;}} else {return true}; ")&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Trebuchet MS;"&gt;:)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-3777976185268315794?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/3777976185268315794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=3777976185268315794&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/3777976185268315794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/3777976185268315794'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2007/10/setting-default-button-in-aspnet.html' title='Setting the default Button in ASP.NET'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-4477736678623155579</id><published>2007-10-09T15:48:00.000+04:00</published><updated>2007-10-09T15:52:41.214+04:00</updated><title type='text'>SQL Server 2008 New Featuers</title><content type='html'>&lt;span style="font-family:verdana;"&gt;SQL Server 2008 contains many new features and enhancements, Additional information can be found at the main SQL 2008 Microsoft page: &lt;/span&gt;&lt;a href="http://www.microsoft.com/sql/2008/default.mspx"&gt;&lt;span style="font-family:verdana;"&gt;http://www.microsoft.com/sql/2008/default.mspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;. Listed below is a concise bulleted list of the SQL Server 2008 features .&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Transparent Data Encryption. The ability to encrypt an entire database.&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Backup Encryption. Executed at backup time to prevent tampering.&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;External Key Management. Storing Keys separate from the data.&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Auditing. Monitoring of data access.&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Data Compression. Fact Table size reduction and improved performance.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Resource Governor. Restrict users or groups from consuming high levels or resources.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Hot Plug CPU. Add CPUs on the fly.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Performance Studio. Collection of performance monitoring tools.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Installation improvements. Disk images and service pack uninstall options.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Dynamic Development. New ADO and Visual Studio options as well as Dot Net 3.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Entity Data Services. Line Of Business (LOB) framework and Entity Query Language (eSQL)&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;LINQ. Development query language for access multiple types of data such as SQL and XML.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Data Synchronizing. Development of frequently disconnected applications.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Large UDT. No size restriction on UDT.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Dates and Times. New data types: Date, Time, Date Time Offset.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;File Stream. New data type VarBinary(Max) FileStream for managing binary data.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Table Value Parameters. The ability to pass an entire table to a stored procedure.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Spatial Data. Data type for storing Latitude, Longitude, and GPS entries.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Full Text Search. Native Indexes, thesaurus as metadata, and backup ability.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Reporting Server. Improved memory management.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SQL Server Integration Service. Improved multiprocessor support and faster lookups.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;MERGE. TSQL command combining Insert, Update, and Delete.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SQL Server Analysis Server. Stack improvements, faster block computations.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SQL Server Reporting Server. Improved memory management and better rendering.&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Microsoft Office 2007. Use OFFICE as an SSRS template. SSRS to WORD&lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-4477736678623155579?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/4477736678623155579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=4477736678623155579&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/4477736678623155579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/4477736678623155579'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2007/10/sql-server-2008-new-featuers.html' title='SQL Server 2008 New Featuers'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-8724956369145758993</id><published>2007-10-09T14:42:00.000+04:00</published><updated>2007-10-09T14:49:20.753+04:00</updated><title type='text'>Documenting a Microsoft SQL Server database</title><content type='html'>&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;This article describes how to document your Microsoft SQL Server database. The principles are similar for all versions of SQL Server, although SQL Server 2005 and above contain a number of neat enhancements to database documentation capabilities. The article includes database naming conventions, adding object descriptions, documenting stored procedures, and how to create technical documentation for your SQL Server databases.&lt;br /&gt;&lt;br /&gt;Much of this article can also apply equally to other relational databases such as Oracle, MySQL, Microsoft Access and PostgreSQL.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ffffff;"&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;Database Naming Conventions&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;If you're designing a database from scratch, then it makes sense to follow a logical database entity naming convention. The following are some suggestions for when naming the objects in your new database.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;General naming conventions&lt;/strong&gt;&lt;br /&gt;Database names should if possible use alphanumeric characters only. Avoid using hyphens as they can subsequently make it difficult to write certain Transact SQL queries!&lt;br /&gt;&lt;br /&gt;Where possible, try to avoid using spaces in database entities, particularly in table names and column names. While Transact SQL can still refer to these entities if they are enclosed in square brackets, it can sometimes lead to confusion and coding errors.&lt;br /&gt;&lt;br /&gt;It is also a good idea to avoid using table and column names that are reserved words in Transact SQL, such as month, year or user.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Table naming conventions&lt;/strong&gt;&lt;br /&gt;Tables should be given names that relate to the data stored within them. For example, employee data should be stored in a table called Employees. Note that the plural form of the word is used, as there will more than likely be more than one employee stored in the table.&lt;br /&gt;&lt;br /&gt;Some developers prefix table names with something like t_. Such prefixes can be particularly useful if the tables are referenced from application source code, as it makes it more obvious to the software development team that a table rather than a view or some other entity is being referenced.&lt;br /&gt;&lt;br /&gt;Giving a table a prefix related to its function (e.g. Payroll_ can help to group tables into related categories. SQL Server 2005 introduces the concept of schemas. This allows tables to be grouped accordingly. For example, the AdventureWorks sample database contains a HumanResources schema, and the associated tables (Employee, EmployeeAddress, EmployeeDepartmentHistory etc.) are all listed under this schema in the SQL Server Management Studio table list.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Foreign key naming conventions&lt;/strong&gt;&lt;br /&gt;It is particularly useful to be able to identify the foreign keys within a database table. Prefixing them with something like fk_ makes it much more straightforward to identify table relationships just by looking at the table's columns.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Stored Procedure naming conventions&lt;/strong&gt;It is always useful to name stored procedures according to their use. For example: GetUserID, InsertDateOfBirth or UpdatePaymentInfo.&lt;br /&gt;&lt;br /&gt;On occasions, it is useful to add a suffix to show the stored procedure's input parameters. For example the stored procedure GetUserIDByUserNameAndPassword will return take a user name and password as input parameters and return a user ID . This can be used to differentiate stored procedures that have similar functionality but have different parameters. This would allow other related stored procedures to be added, e.g. GetUserIDByGUID and GetUserIDByApplicantID. The downside to this naming convention is that the stored procedure names can become quite long.&lt;br /&gt;&lt;br /&gt;Some developers prefix all their stored procedures with certain tags. A popular convention is to name a stored procedure with a sp_ prefix. However, this is not recommended best practice for two reasons. Firstly, there is a slight reduction in database performance, as the SQL Server will check for stored procedures with this prefix in the master database first. This performance reduction is small, but it may be significant in high end enterprise systems. Secondly, since Microsoft uses this prefix for system stored procedures, there is always the chance that you could give your own stored procedure the same name as a system stored procedure. It is also possible that a future version of SQL Server could introduce a new system stored procedure with the same name as one of your existing user stored procedures.&lt;br /&gt;&lt;br /&gt;If you do want to prefix your stored procedures then it is recommended to use something like usp_ or sproc_. Likewise a function could be prefixed with something like func_. Such prefixes can be particularly useful if the stored procedures are called from application source code, as it makes it more obvious to the software development team that a stored procedure is being called.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Documenting SQL Stored Procedures&lt;/strong&gt;&lt;br /&gt;Don't forget to document the Transact SQL code of stored procedures and functions. While simple queries should be self explanatory, larger queries will benefit from documentation. Stored procedures will also benefit from a standard header, which at the very least should describe the procedure's functionality. Including a change log will also help to track changes, particularly if you don't have any source control system in place.&lt;br /&gt;&lt;br /&gt;An example header for a stored procedure is shown below:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;&lt;span style="font-size:78%;"&gt;/&lt;span style="color:#33cc00;"&gt;*&lt;br /&gt;Description: Gets a user's UserID&lt;br /&gt;Author: Brett Burridge&lt;br /&gt;Create Date: 14/09/2007&lt;br /&gt;Param: @UserName = User's login name&lt;br /&gt;Param: @Password = User's password&lt;br /&gt;Return: UserID of the user&lt;br /&gt;Modified Date: 10/10/2007&lt;br /&gt;Modification: Added to che&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#33cc00;"&gt;ck to see if their account has been suspended&lt;br /&gt;*/ &lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Note that adding comments to stored procedures has no affect on their performance.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Database Object Descriptions&lt;/strong&gt;&lt;br /&gt;Being able to give database objects descriptions goes some way towards being able to create a self-documenting database.&lt;br /&gt;&lt;br /&gt;SQL Server 7.0 introduced the useful ability to add a Description to a table through the table design window. SQL Server 2000 enhanced this functionality by introducing extended properties. Unfortunately the SQL Server 2000 Enterprise Manager has limited capabilities for allowing these properties to be edited. However, in SQL Server 2005 the SQL Server Management Studio GUI allows extended properties to be edited. Most objects in a database (e.g. tables, table columns, views, functions, stored procedures, the database itself) have extended properties that may be edited. By default there is only a single extended property, MS_Description. Even more limiting is that although you can use the MS_Description extended property to add descriptions to objects, without 3rd party add-ons such as our SQL Documention Tool, there isn't actually a lot you can do with them once entered.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Creating Database Technical Documentation&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Asides from creating database diagrams, there isn't a lot of functionality within SQL Server that allows you to create technical documentation for your database.&lt;br /&gt;&lt;br /&gt;Fortunately there are timesaving 3rd party SQL Server documentor tools that will automatically create comprehensive technical documentation for SQL Server databases. Our SQL Documentation Tool was launched in 2005, and is a low cost option for quickly creating technical documentation for SQL Server databases with the minimum of effort.&lt;br /&gt;&lt;br /&gt;For applications that use SQL Server databases, there are utilities that will create technical documentation for that application plus its associated SQL Server databases. Examples of this are our ASP Documentation Tool (for ASP VBScript and JScript and associated databases), .NET Documentation Tool (for .NET Framework C# and VB.NET code and associated databases), VB Documentation and their associated databases), and PHP Documentation Tool (code documentor for PHP web applications and associated databases).&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-8724956369145758993?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/8724956369145758993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=8724956369145758993&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/8724956369145758993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/8724956369145758993'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2007/10/documenting-microsoft-sql-server.html' title='Documenting a Microsoft SQL Server database'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-1097272064945877534</id><published>2007-07-11T15:41:00.000+04:00</published><updated>2007-07-11T15:43:27.207+04:00</updated><title type='text'>Monitoring Stored Procedure Usage</title><content type='html'>I was attending a SQL Server event a few weeks back when a number of DBA types were talking about new features in SQL Server 2005. One of the topics that came up was how might you monitor execution of stored procedures. One DBA said it would be nice if he had a method to identify how many times a stored procedure (SP) was executed. He was looking for some information to help fine tune his environment and the applications running in his environment. Or at least identify the processes that where run frequently so they could be reviewed by developers to determine if they could be written more efficiently. So what new features in SQL Server 2005 might be used to accomplish the monitoring of SP executions? Dynamic Management views (DMV) of course. In this article I will show you how you can use a few DMV’s to identify the most frequently run SPs of an instance of SQL Server, as well as those SPs that use the most CPU, I/O or run the longest.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Execution Statistics&lt;/strong&gt;&lt;br /&gt;It is relatively easy to identify the use count and resource usage of your SP’s, but first let me discuss how SQL Server maintains the execution statistics. The SQL Server engine keeps execution statistics for each SQL Server 2005 instance. Execution Statistics are an accumulation of execution information about what has been run since the instances has started. Each time an instance is stopped and restarted all execution statistics are reset. &lt;br /&gt;&lt;br /&gt;Individual execution statistics for an object are tied to cached execution plans. When a SP is compiled, an execution plan is cached in memory. These cached execution plans are uniquely identified by a plan_handle. Since memory is limited, SQL Server from time to time will remove execution plans from memory, if the cached plan is not being actively used. Therefore the statistics stored for a particular SP may be for an accumulation of stats since SQL Server started, if the SP has only be compiled once. Or, it may only have statistics for the last few minutes if the SP had recently been compiled. &lt;br /&gt;&lt;br /&gt;How to Get the Execution Count of a Stored Procedure?&lt;br /&gt;To determine how many times a stored procedure in the cache has been executed you need to use a couple of DMV’s and a dynamic management function (DMF). The plan_handle for the cached plans are used to join together the DMVs and retrieve records for a DMF. To get the execution counts for each cached SPs you can run the following code:&lt;br /&gt;&lt;br /&gt;SELECT DB_NAME(st.dbid) DBName&lt;br /&gt;      ,OBJECT_SCHEMA_NAME(st.objectid,dbid) SchemaName&lt;br /&gt;      ,OBJECT_NAME(st.objectid,dbid) StoredProcedure&lt;br /&gt;      ,sum(qs.execution_count) Execution_count&lt;br /&gt; FROM sys.dm_exec_cached_plans &lt;br /&gt;   cp join sys.dm_exec_query_stats qs on cp.plan_handle = qs.plan_handle&lt;br /&gt;      CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st&lt;br /&gt; where DB_NAME(st.dbid) is not null and cp.objtype = 'proc'&lt;br /&gt; group by DB_NAME(st.dbid),OBJECT_SCHEMA_NAME(objectid,st.dbid), &lt;br /&gt;   OBJECT_NAME(objectid,st.dbid) &lt;br /&gt; order by sum(qs.execution_count) desc&lt;br /&gt;Here I used the plan_handle of the “sys.dm_exec_cached_plans” DMV to join with the “sys.dm_exec_query_stats” DMV to obtain the “Execution_count” value where the object type is a store procedure. The “execution_count” column of the “sys.dm_exec_query_stats” DMV identifies the number of time the cached_plan (or SP) has been executed since the last compilation of the SP. I use the plan_handle in conjunction with the CROSS APPLY operator to return the object information (DBName, SchemaName, and ObjectName) using the table-value DMF “sys.dm_exec_sql_text”. The output from this SELECT statement is ordered by the execution_count, so the SP with the most executions will be displayed first.&lt;br /&gt;&lt;br /&gt;Determining Which SP is using the Most CPU, I/O, or has the Longest Duration. &lt;br /&gt;Knowing which SPs are frequently executed is useful information, although from a performance standpoint you might like to know which SP is consuming the greatest amount of CPU resources. Or possibly you might be interested in which SP takes the longest to run, or which SP performs the most physical I/O operations. By modifying the above command, we can easily answer each one of these questions.&lt;br /&gt;&lt;br /&gt;If you want to show the SP that consumes the most CPU resources, you can run the following TSQL command:&lt;br /&gt;&lt;br /&gt;SELECT DB_NAME(st.dbid) DBName&lt;br /&gt;      ,OBJECT_SCHEMA_NAME(st.objectid,dbid) SchemaName&lt;br /&gt;      ,OBJECT_NAME(st.objectid,dbid) StoredProcedure&lt;br /&gt;      ,sum(qs.execution_count) Execution_count&lt;br /&gt;      ,sum(qs.total_worker_time) total_cpu_time&lt;br /&gt;      ,sum(qs.total_worker_time) / (sum(qs.execution_count) * 1.0) avg_cpu_time&lt;br /&gt; &lt;br /&gt; FROM sys.dm_exec_cached_plans cp join sys.dm_exec_query_stats qs on cp.plan_handle = qs.plan_handle&lt;br /&gt;      CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st&lt;br /&gt; where DB_NAME(st.dbid) is not null and cp.objtype = 'proc'&lt;br /&gt; group by DB_NAME(st.dbid),OBJECT_SCHEMA_NAME(objectid,st.dbid), OBJECT_NAME(objectid,st.dbid) &lt;br /&gt; order by sum(qs.total_worker_time) desc&lt;br /&gt;&lt;br /&gt;The “sys.dm_exec_query_stats” view contains the column “total_worker_time”, which is the total number of microseconds that a given cached query plan has executed. Keep in mind that cached plans are sometimes removed from memory and replaced with newer ones. Therefore, the statistics for which SP has consumed the most CPU only takes into account statistics for those plans that are in the cache when this T-SQL is run. &lt;br /&gt;&lt;br /&gt;To determine which SP has executed the most I/O requests you can run the following TSQL code: &lt;br /&gt;&lt;br /&gt;SELECT DB_NAME(st.dbid) DBName&lt;br /&gt;      ,OBJECT_SCHEMA_NAME(objectid,st.dbid) SchemaName&lt;br /&gt;      ,OBJECT_NAME(objectid,st.dbid) StoredProcedure&lt;br /&gt;      ,sum(execution_count) execution_count&lt;br /&gt;      ,sum(qs.total_physical_reads + qs.total_logical_reads + qs.total_logical_writes) total_IO&lt;br /&gt;      ,sum(qs.total_physical_reads + qs.total_logical_reads + qs.total_logical_writes) / sum(execution_count) avg_total_IO&lt;br /&gt;      ,sum(qs.total_physical_reads) total_physical_reads&lt;br /&gt;      ,sum(qs.total_physical_reads) / (sum(execution_count) * 1.0) avg_physical_read    &lt;br /&gt;      ,sum(qs.total_logical_reads) total_logical_reads&lt;br /&gt;      ,sum(qs.total_logical_reads) / (sum(execution_count) * 1.0) avg_logical_read  &lt;br /&gt;      ,sum(qs.total_logical_writes) total_logical_writes&lt;br /&gt;      ,sum(qs.total_logical_writes) / (sum(execution_count) * 1.0) avg_logical_writes  &lt;br /&gt; FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.plan_handle) st&lt;br /&gt;   join sys.dm_exec_cached_plans cp on qs.plan_handle = cp.plan_handle&lt;br /&gt;  where DB_NAME(st.dbid) is not null and cp.objtype = 'proc'&lt;br /&gt; group by DB_NAME(st.dbid),OBJECT_SCHEMA_NAME(objectid,st.dbid), OBJECT_NAME(objectid,st.dbid) &lt;br /&gt; order by sum(qs.total_physical_reads + qs.total_logical_reads + qs.total_logical_writes) desc&lt;br /&gt;&lt;br /&gt;Here I have displayed the total physical and logical read I/O’s, plus the logical write I/O’s. In addition, I have calculated the average number of I/O’s per execution of each SP. Physical reads are the number of reads that are actually made against the physical disk drives; where as logical reads and writes are the number of I/O’s against the cached data pages in memory in the buffer cache. Therefore, by adding the physical and logical I/O’s together I was able to calculate the total I/O’s for each SP. &lt;br /&gt;&lt;br /&gt;To determine which SPs take the longest time to execute I can use the follow TSQL code:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;SELECT DB_NAME(st.dbid) DBName&lt;br /&gt;      ,OBJECT_SCHEMA_NAME(objectid,st.dbid) SchemaName&lt;br /&gt;      ,OBJECT_NAME(objectid,st.dbid) StoredProcedure&lt;br /&gt;      ,sum(execution_count) execution_count&lt;br /&gt;      ,sum(qs.total_elapsed_time) total_elapsed_time&lt;br /&gt;      ,sum(qs.total_elapsed_time) / sum(execution_count) avg_elapsed_time&lt;br /&gt; FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.plan_handle) st&lt;br /&gt;   join sys.dm_exec_cached_plans cp on qs.plan_handle = cp.plan_handle&lt;br /&gt;  where DB_NAME(st.dbid) is not null and cp.objtype = 'proc'&lt;br /&gt; group by DB_NAME(st.dbid),OBJECT_SCHEMA_NAME(objectid,st.dbid), OBJECT_NAME(objectid,st.dbid) &lt;br /&gt; order by sum(qs.total_elapsed_time) desc&lt;/em&gt;In this TSQL, I am calculating the duration of each SP by summing up the “total_elapsed_time” in the “sys.dm_exec_sql_query_stats” DMV by database, schema and object name. I am also calculating the average elapsed time per execution of each SP. I order the output so the SP that took the longest total duration will be displayed first. If you where interested in determining the SP that had the longest average duration all you would need to change is the “ORDER BY” clause to sort by “avg_elapsed_time”. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;The “sys.dm_exec_query_stats” SP is used to look at the accumulated statistics for cached plans. By joining the “sys.dm_exec_query_stats” view with other DMVs, you can determine other information about the cached plan, like the object type for the cached plan, and the actual name of the object. Having these DMVs in SQL Server 2005 now provides you with some data mining tools to review some performance information for a SQL Server instance. Next time you want to review statistics related to your code run on your SQL Server box consider looking at the information available in the SQL Server 2005 dynamic management views.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-1097272064945877534?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/1097272064945877534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=1097272064945877534&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/1097272064945877534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/1097272064945877534'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2007/07/monitoring-stored-procedure-usage.html' title='Monitoring Stored Procedure Usage'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-769242284252679170</id><published>2007-06-30T12:27:00.000+04:00</published><updated>2007-06-30T12:33:27.391+04:00</updated><title type='text'>What to consider when testing databases</title><content type='html'>&lt;strong&gt;What To Test in a Relational Database&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;Last month I explored the assumptions made by the traditional data management community and argued that these assumptions had been shown to be false over the years. These assumptions included the belief that you can't easily evolve a database schema, that you need to do detailed up front modeling, and that reviews and inspections are an effective way to ensure data quality. Respectively, I argued that database refactoring enables you to easily evolve database schemas, that an agile approach to data modeling is significantly more effective, and that database regression testing is the best way to ensure data quality. A debate on the Agile Databases mailing list ensued and it quickly became apparent that the traditionalists could understand, although often not accept, the first two agile database development techniques but clearly struggled with the concept of database testing. I believe that the virtual absence of discussion about testing within the data management community is the primary cause of the $611 billion annual loss, as reported by The Data Warehouse Institute, experienced by North American organizations resulting from poor data quality. So this month I've decided to describe what you should consider testing in a database.&lt;br /&gt;&lt;br /&gt;Let's start with some terminology. Database testing is the act of validating the contents, schema, and functionality within a database. From the point of view of a relational database this includes the actual data itself, the table structures and relationships between tables, and the stored procedures/functions or database classes respectively. Database interface testing validates the database at the black-box level whereas internal database testing validates it at the clear-box level -- if any database testing occurs at all it is typically at the interface level only because of the lack of tool support for internal testing. Database regression testing is the act of running the database test suite on a regular basis, ideally whenever someone does something which could potentially inject a defect into the database such as change how they write data into a database or change some of the code within the database itself. Test Driven Database Development (TDDD), also known as "Behavior Driven Database Development" (BDDD), is the act of specifying the design of a database by writing a single test then just enough database code/schema to fulfill that test.&lt;br /&gt;&lt;br /&gt;I think that one of the reasons why data professionals are confused about the concept of database regression testing is because it is a relatively new idea within the data community. One of the assumptions that I didn't cover last month is the idea within the traditional data community that testing is something that other people do (i.e., test or quality assurance professionals). This reflects a penchant for over-specialization and a serial approach towards development by traditionalists, two ideas which have also been shown to be questionable organizational approaches at best.&lt;br /&gt;The easiest thing to get your head around is the need to validate the logic implemented within a database. Relational databases contain code, in the form of stored procedures, triggers, and even object-oriented classes. There is nothing special about this code. Just like you test application code, shouldn't you also test database code? Of course you should. You'll apply the exact same types of tests to database code as you would to application code.&lt;br /&gt;What isn't as obvious, at least from the questions I was getting from traditional data professionals, was the need to validate data quality via testing. As DDJ's data quality survey showed last year, data is considered a corporate asset by 96 percent of organizations yet less than half have any sort of testing strategy in place to actually ensure data quality. In short, people like to talk about data quality but not act on it. When it comes to data you could validate the following via tests: Column domain value rules. For example, the Flavor column has allowable values of Chocolate, Vanilla, and Strawberry.&lt;br /&gt;Column default value rules. For example, the default value is Strawberry.&lt;br /&gt;Value existence rules. For example, there should always be a value of Flavor indicated (it can never be null).&lt;br /&gt;Row value rules. For example, the value of StartDate must be less than EndDate when EndDate is provided.&lt;br /&gt;Size rules. For example, a code in a column must always be two characters in length or a value in a VARCHAR column must be at least five characters in length Although these data rules can be implemented via constraints, or via other means, you still need to test to ensure that the rules are being implemented properly. Constraints can easily be dropped or reworked, therefore you should have regression tests I place to validate them. Nullability is critical to test for because a NOT NULL constraint can also easily be dropped. Furthermore, "quasi-nulls" such as empty strings are often not allowed so supporting tests should be in place to ensure this.&lt;br /&gt;Table structure can also be easily validated, something that is typically done as a side effect of the tests to validate the Create Read Update and Delete (CRUD) logic of an application. These tests will break whenever you change the database schema without also changing the access code. From a database design point of view, as you write CRUD tests you are effectively designing the table structure which supports those tests.&lt;br /&gt;You can also write tests which validate relationships between the rows in different tables. These tests validate referential integrity (RI) rules, for example if a row in the Employee table references a row within the Position table then that row should actually exist. RI rules such as this are typically implemented as triggers, but what happens if someone drops or modifies a trigger without understanding the implications of doing so?&lt;br /&gt;You may also choose to write database performance tests to both specify performance requirements and to ensure that those requirements are met. From a black-box point of view you might write tests which validate the performance characteristics surrounding database access, including object/relational (O/R) mapping logic. From a clear-box point of view you might have tests which motivate you to maintain secondary indices to support common database access paths or to refactor your database tables into structures which are more performant.&lt;br /&gt;I believe that as an industry we have a lot of work ahead of us with respect to data quality. We have known for decades that testing, particularly regression testing, leads to greater quality yet for some reason we haven't applied this knowledge to relational databases. There are many things which can and should be tested within a relational database, this column touches on just a few, and it is about time that we step up and develop new tools and techniques to do exactly that. The Agile community has lead the way to bringing regression testing, and more importantly test-first development, to application programming. This has lead to noticeable increases in quality, time to market, and return on investment (ROI). We can achieve the same successes when it comes to database design and quality. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-769242284252679170?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/769242284252679170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=769242284252679170&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/769242284252679170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/769242284252679170'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2007/06/what-to-consider-when-testing-databases.html' title='What to consider when testing databases'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1116812007309218313.post-6571374786596727876</id><published>2007-06-27T14:57:00.000+04:00</published><updated>2007-06-27T15:06:27.581+04:00</updated><title type='text'>Technical Blog Hello World :)</title><content type='html'>&lt;span style="font-family:verdana;font-size:78%;color:#ffffff;"&gt;Hello everybody,&lt;br /&gt;&lt;br /&gt;This is my technical blog, here you'll find my technical posts (as soon as I understand everything here and have the ability to write technical articles :D).&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:78%;"&gt;&lt;br /&gt;&lt;span style="color:#ffffff;"&gt;So, welcome in my technical blog and which you to enjoy your time here and be more useful for any one :)&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:78%;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1116812007309218313-6571374786596727876?l=hwahab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://hwahab.blogspot.com/feeds/6571374786596727876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1116812007309218313&amp;postID=6571374786596727876&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/6571374786596727876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1116812007309218313/posts/default/6571374786596727876'/><link rel='alternate' type='text/html' href='http://hwahab.blogspot.com/2007/06/technical-blog-hello-world.html' title='Technical Blog Hello World :)'/><author><name>Hossam Abdel Wahab</name><uri>http://www.blogger.com/profile/01091096346528280357</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='http://4.bp.blogspot.com/_LgGdE9ZA8aQ/Sv_YNKDS-yI/AAAAAAAAADs/vrCbW0oJ-aI/S220/IMG_0143.JPG'/></author><thr:total>0</thr:total></entry></feed>
