xp_sqlinventory (T-SQL)

Captures Microsoft® SQL Server™ configuration and inventory information asynchronously on the computer running SQL Server and stores it in the specified database and table.

Syntax

xp_sqlinventory {'database', 'table', {interval | STOP}}

Arguments
'database'
Is the database in which to store inventory information. The database specified must already exist and must have enough free space to hold the retrieved inventory data. database is varchar(30), with no default.
'table'
Is the name of the table in which to store the inventory information. The specified table is created if it does not already exist, and stores configuration information only for servers that are in the same Microsoft Windows NT® domain as the SQL Server running xp_sqlinventory. table is varchar(30), with no default.
interval
Is the time (in seconds) to wait between checks for inventory messages. interval is int, and can be a value between 1 (once per second) and 3600 (once per hour).
STOP
Specifies that all in-progress inventory actions are stopped.
Return Code Values

0 (success) or 1 (failure)

Result Sets

xp_sqlinventory returns this message (values may vary):

Server: Msg 2, Level 1, State 1

[Microsoft][ODBC SQL Server Driver][SQL Server]SQL Server Inventory Running. SQL Server Information Is Being Captured By '' To Database 'master' Table 'xp_sqlinv' Every 2 Seconds.

  

When stop is issued, xp_sqlinventory returns this message (values may vary):

Server: Msg 2, Level 1, State 1

[Microsoft][ODBC SQL Server Driver][SQL Server]SQL Server Inventory Stopped. SQL Server Information Captured By '' In Database 'master' Table 'xp_sqlinv' Interval 2 Seconds.

  

Remarks

Before executing xp_sqlinventory, start SQL Server.

xp_sqlinventory captures SQL Server configuration and inventory information for all SQL Servers on the domain and stores the information in the specified database and table. Any SQL Server running the LocalSystem account is not included.


Caution By default, SQL Server is installed as a service in the Windows NT LocalSystem account, and the SQL Server registration and configuration information cannot be sent over the network. For xp_sqlinventory to work, you must configure SQL Server to run in a valid domain user account through the Startup dialog box located in Services on Control Panel.


Inventory errors are written to the Windows NT application log.


Note xp_sqlinventory does not support named parameters.


This inventory information is captured for each inventoried SQL Server.

Column name Description
ReceiveDate Date and time the message was received by SQL Server.
ServerName SQL Server computer name.
ProductName Product name of SQL Server.
SQLRegisteredOwner Registered owner name typed during SQL Server Setup.
DomainName Windows NT domain name of SQL Server.
MajorVersion Major version number for the SQL Server version. For example, the 6 in SQL Server version 6.0 is the SQLMajorVersion.
MinorVersion Minor version number for the SQL Server version. For example, the 50 in SQL Server version 6.50 is the SQLMinorVersion.
BuildNumber Internal build number for the SQL Server version.
ServerLogins Total number of configured user logins obtained from the master.dbo.syslogins system table.
MaxConnections Maximum number of people that can be simultaneously connected to SQL Server.
DBCount Total number of databases on the server, including master, tempdb, and model databases.
TotalDeviceSize Size in megabytes of all devices allocated for SQL Server data. This number does not include dump devices.
SortOrder Sort order and code page chosen at SQL Server Setup. For more information about the selected code page, see master.dbo.syscharsets where id = SortOrder.
SecurityMode SQL Server security mode:
0 = Mixed Mode
1 = Windows NT Authentication Mode
ProcedureCache Percentage of memory allocated to SQL Server’s procedure cache. Values may range from 1 to 99.
SMPStatus Indicates how aggressively SQL Server uses multiple microprocessors. The default value is 0.
ConfiguredMemory Total amount of memory in megabytes allocated to SQL Server.
PriorityBoost Indicates whether SQL Server has been configured to run at a higher Windows NT process priority level. For more information about priority boost, see sp_configure.
WorkingSet Directs Windows NT to reserve physical memory space for SQL Server equal to the sum of the memory setting and the size of tempdb. Default is 0 (no working set) and 1 (working set). For more information, see set working set size Option.
Publisher Number of publications configured for SQL Server.
Subscriber Number of publications subscribed to for SQL Server.
Distribution Indicates whether SQL Server is configured as a Distributor:
0 = Not a Distributor
1 = A Distributor
NamedPipe Indicates whether SQL Server can accept client connections by using the named pipe Net-Library:
0 = No
1 = Yes
MultiProtocol Indicates whether SQL Server can accept client connections by using the Multiprotocol Net-Library:
0 = No
1 = Yes
SPX Indicates whether SQL Server can accept client connections by using the Novell IPX/SPX Net-Library:
0 = No
1 = Yes
WinSocket Indicates whether SQL Server can accept client connections by using a WinSocket application programming interface Net-Library:
0 = No
1 = Yes
Appletalk Indicates whether SQL Server can accept client connections by using an Appletalk Net-Library:
0 = No
1 = Yes
VINES Indicates whether SQL Server can accept client connections by using a Banyan® VINES® Net-Library:
0 = No
1 = Yes
CPUBrand Brand of the microprocessor for SQL Server. Possible values can be Intel, or Alpha.
CPUModel Microprocessor model, such as Pentium or Alpha for SQL Server.
CPUStepLevel Processor stepping version.
CPUCount The number of microprocessors for the SQL Server.
ServerTotalMemory Total amount of physical memory in megabytes on SQL Server.
ServerAvailableMemory Available amount of physical memory in megabytes on SQL Server.
OperatingSystem Operating system for SQL Server; for example, Microsoft Windows NT.
OperatingSystemBuild Internal operating-system build version number for SQL Server; for example, 1057 for the 1057 build of Windows NT 3.51 or later.
TotalPhysicalDisk Total amount of physical disk space in megabytes on nonremovable storage media.
AvailablePhysicalDisk Amount of free disk space available in megabytes on SQL Server.

Examples

This example checks every two seconds for SQL Server inventory messages. The information is loaded into the xp_sqlinv table in the master database.

USE pubs

GO

DECLARE @db varchar(30), @table varchar(30), @interval int

SET @db = 'master'

SET @table = 'xp_sqlinv'

SET @interval = 2

EXEC master..xp_sqlinventory @db, @table, @interval

-- Time passes...

EXEC master..xp_sqlinventory stop

  

See Also
System Stored Procedures (General Extended Procedures)  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.