<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'T-SQL', '2008', and 'Scripts'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=T-SQL,2008,Scripts&amp;orTags=0</link><description>Search results matching tags 'T-SQL', '2008', and 'Scripts'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>SYS2 Scripts Updated – Scripts to monitor database backup, database space usage and memory grants now available</title><link>http://sqlblog.com/blogs/davide_mauri/archive/2011/02/13/sys2-scripts-updated-scripts-to-monitor-database-backup-database-space-usage-and-memory-grants-now-available.aspx</link><pubDate>Sun, 13 Feb 2011 17:30:22 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:33451</guid><dc:creator>manowar</dc:creator><description>&lt;p&gt;I’ve just released three new scripts of my “sys2” script collection that can be found on CodePlex:&lt;/p&gt;  &lt;p&gt;Project Page: &lt;a title="http://sys2dmvs.codeplex.com/" href="http://sys2dmvs.codeplex.com/"&gt;http://sys2dmvs.codeplex.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Source Code Download: &lt;a title="http://sys2dmvs.codeplex.com/SourceControl/changeset/view/57732" href="http://sys2dmvs.codeplex.com/SourceControl/changeset/view/57732"&gt;http://sys2dmvs.codeplex.com/SourceControl/changeset/view/57732&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The three new scripts are the following&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;sys2.database_backup_info.sql &lt;/li&gt;    &lt;li&gt;sys2.query_memory_grants.sql &lt;/li&gt;    &lt;li&gt;sys2.stp_get_databases_space_used_info.sql &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here’s some more details:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;database_backup_info&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;This script has been made to quickly check if and when backup was done. It will report the last full, differential and log backup date and time for each database. Along with these information you’ll also get some additional metadata that shows if a database is a read-only database and its recovery model:&lt;/p&gt;    &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/davide_mauri/image_4B56D20D.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/davide_mauri/image_thumb_269594C9.png" width="1028" height="109" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;By default it will check only the last seven days, but you can change this value just specifying how many days back you want to check.&lt;/p&gt;    &lt;p&gt;To analyze the last seven days, and list only the database with FULL recovery model without a log backup&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;select * from sys2.databases_backup_info(default)        &lt;br /&gt;where recovery_model = 3 and log_backup = 0&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;To analyze the last fifteen days, and list only the database with FULL recovery model with a differential backup&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;select * from sys2.databases_backup_info(15)        &lt;br /&gt;where recovery_model = 3 and diff_backup = 1&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;I just love this script, I use it every time I need to check that backups are not too old and that t-log backup are correctly scheduled.&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;query_memory_grants&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;This is just a wrapper around sys.dm_exec_query_memory_grants that enriches the default result set with the text of the query for which memory has been granted or is waiting for a memory grant and, optionally, its execution plan&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;stp_get_databases_space_used_info&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;This is a stored procedure that list all the available databases and for each one the overall size, the used space within that size, the maximum size it may reach and the auto grow options. This is another script I use every day in order to be able to monitor, track and forecast database space usage.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;As usual feedbacks and suggestions are more than welcome!&lt;/p&gt;</description></item><item><title>SYS2 DMVs on CodePlex</title><link>http://sqlblog.com/blogs/davide_mauri/archive/2010/01/18/sys2-dmvs-on-codeplex.aspx</link><pubDate>Mon, 18 Jan 2010 18:09:03 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:21152</guid><dc:creator>manowar</dc:creator><description>&lt;p&gt;I’ve just created a new project on CodePlex anmed &lt;em&gt;SYS2DMVS&lt;/em&gt;, where I’ll put all my &lt;em&gt;&lt;a href="http://www.davidemauri.it/resources/sql-scripts.aspx" target="_blank"&gt;sys2 scripts&lt;/a&gt;&lt;/em&gt; so that they can be found and accessed more easily. Also it will more easy for me to maintain them, just a Check-In with SVN and that’s it :-).&lt;/p&gt;  &lt;p&gt;&lt;a title="http://sys2dmvs.codeplex.com/" href="http://sys2dmvs.codeplex.com/"&gt;http://sys2dmvs.codeplex.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The scripts are growing in number, they are now 9, so I though that they deserve a better place to stay than my personal website.&lt;/p&gt;  &lt;p&gt;This also has another important meaning: if you want to contribuite, I’ll be *very* *very* happy to have you on board for this project. I think it would be very nice and useful if we can make this project grow all togheter.&lt;/p&gt;  &lt;p&gt;So, if you have a script to share, and you have the will to make it adhere to a certain style (I followed the DMVs style: lower case name, using “_” to separate names, and so on) and to share your own scripts with the community, you’re more than welcome!&lt;/p&gt;</description></item><item><title>sys2 scripts updated</title><link>http://sqlblog.com/blogs/davide_mauri/archive/2010/01/07/sys2-scripts-updated.aspx</link><pubDate>Thu, 07 Jan 2010 20:54:10 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:20694</guid><dc:creator>manowar</dc:creator><description>&lt;p&gt;I’ve updated my “sys2” scripts with three 3 new scripts:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;sys2.objects_dependencies&lt;/em&gt;&lt;/strong&gt;    &lt;br /&gt;A wrapper around sys.sql_expression_dependencies that shows also related informations taken from sys.object table, like object name, object type and schema name of the referencing entity. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;sys2.objects_partition_ranges&lt;/em&gt;&lt;/strong&gt;    &lt;br /&gt;Shows information on partitioned table like rows per partition, partition ranges and partition filegroup destination. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;sys2.objects_data_spaces&lt;/em&gt;&lt;/strong&gt;    &lt;br /&gt;List tables and indexes and show in which filegroup they reside. &lt;/p&gt;  &lt;p&gt;They are freely available – along with all the others – here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.davidemauri.it/resources/sql-scripts.aspx" href="http://www.davidemauri.it/resources/sql-scripts.aspx"&gt;http://www.davidemauri.it/resources/sql-scripts.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;</description></item></channel></rss>