question

baahubali avatar image
baahubali asked

sql overview

I am trying to spread the details of servers and databases in a table to get monthly reporting to licensing information. what are the requirements to be considered in preparing these table. Here are some of the details for the table i am able to figure out. and from where i can pull this data to gather for all the servers into a single table. server:- Id(Auto), Host, Environment(QA, Prod, Dev), Instance, Version, Memory, Startup, no. of cores database:- Id(Auto), Servers_Id (references Servers, Id), database_id (sql server numeric database id), database_name, SpaceUsedInMb, LastFullBackup, LastDiffBackup, LastTLogBackup, UnusedIndexes, Modified(date row inserted or updated), last used indexes, max index seek, max index scan Any suggestion Thanks
sql server 2014
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
ThomasRushton avatar image
ThomasRushton answered
Server: * Host - you mean the server name? `SELECT @@SERVERNAME` might be a place to start, but that might not be the same as that returned by the appropriate [SELECT SERVERPROPERTY][1] command. * Environment - that's one for you to decide. You could have a table that matches server names to environments, or you could pull it from your naming convention (you *do* have a naming convention, right?) * Instance - see Host * Version - `SELECT @@VERSION`? * Memory - physical memory, or the memory in use by SQL Server, or the memory SQL Server is allowed to use? And if it's the memory in use by SQL Server, then what bit, the buffer pool, the procedure cache, or what? * Startup - what do you mean? The date/time at which the instance was restarted, or the server was restarted? If the instance, there are many ways of doing this with varying degrees of accuracy. Me, I tend to go with the creation date of the temp database. * Number of cores - there's a handy DMV (Dynamic management View) that contains some of this sort of thing - it's called [`sys.dm_os_sys_info`][2] - check it out. Just a thought - you might want to keep track of the Edition as well as the version, as that's where licensing snafus can get a bit expensive... Database: * database id & name - and some other stuff - look in sys.databases * space used - is that the space used inside the database, or the space the database takes up on disk? I would aim at tracking both * Last Backups - there's a load of useful information returned by [`DBCC DBINFO`][3] * Index information - oh, wait. [Another bunch of DMVs][4]. Anything else? [1]: https://msdn.microsoft.com/en-us/library/ms174396.aspx [2]: https://msdn.microsoft.com/en-us/library/ms175048.aspx [3]: https://www.google.co.uk/search?q=dbcc+dbinfo [4]: https://msdn.microsoft.com/en-GB/library/ms187974.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.