Monday, November 11, 2013

Stored Procedure to Document Database

Significantly changed format.

Moved Stored procedure to a script.

That makes documenting of whole server less convenient, but  allows you avoid any changes, such of creation of stored procedure itself, on highly secured server.

So, I also added error checking, some version control, enhanced extended events' reporting, and partitioned databases handling.


Download Here - Version 1.24

Tested on following versions of SQL Server:
- 2016 Enterprise
- 2014 Enterprise
- 2012 Enterprise, Standard.
- 2008 R2 (SP1) Enterprise.
- 2005 Express.

Does not work on SQL Server versions earlier than 2005.

Usage:
Just put name of the database you want to document in the third line of the script and run the script.
DECLARE @DBName VARCHAR(128) = '<YOUR DATABASE NAME>'
 
You have to get something like this:


Please leave you feedback here.

Thanks.


Bugs found so far:
1. (FIXED) In 2008R2(SP1) "DB Used Space in MB" is calculated incorrectly.
2. Does not properly handles multiple object's properties.

Changes for Ver 1.01:
1. Changed SP to "dbo" schema.
2. Fixed Bug #1.

6 comments:

  1. Slava,
    What are the minimum required permissions to run this? I created a user who has VIEW SERVER STATE (got errors before granting them that) and now it executes, but the results don't include any objects that aren't system objects.

    ReplyDelete
  2. I'd suggest to use DB owner's permissions. I haven't tested it with any other permission settings.

    ReplyDelete
  3. Link should work: https://drive.google.com/file/d/0B5yWoyX1eEWqSkx1SjBpNnFFNlk/view?resourcekey=0-tDzQjX6Z_F2_V0YsNynoGw

    ReplyDelete
  4. hi,
    one of the best documenter tools out there
    you can expand documentation for latest sql version releases as follows
    CASE @ServerRelease
    WHEN 90 THEN '2005'
    WHEN 100 THEN '2008'
    WHEN 110 THEN '2012'
    WHEN 120 THEN '2014'
    WHEN 130 THEN '2016' <-- new line
    WHEN 140 THEN '2017' <-- new line
    WHEN 150 THEN '2019' <-- new line
    ELSE @ServerRelease <- just to report at which version script is running
    END
    thank you very much

    ReplyDelete
    Replies
    1. Changed. Put in github: https://github.com/SlavaSQL/SQLDocumenter

      Delete