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.22

Tested on following versions of SQL Server:
- 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.

2 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