1) The following SQL query will show the HostName , SQL Instance Name , SQL edition ,SQL Product Level, Standalone or Clustered type and SQL version info
SELECT
SERVERPROPERTY('MachineName') as HostName,
SERVERPROPERTY('InstanceName') as InstanceName,
SERVERPROPERTY('Edition') as Edition,
SERVERPROPERTY('ProductLevel') as ProductLevel
Case SERVERPROPERTY('IsClustered') when 1 then 'CLUSTERED' else
'STANDALONE' end as ServerType,
@@VERSION as SQLVersionDetails
2 The below SQL query will show all of the information related to Server level configuration and sql performance related information .
SELECT * from sys.configurations order by NAME
3 Below SQL query will show the info of sql security .
SELECT sl.name, sl.denylogin, sl.isntname,sl.isntgroup, sl.isntuser
FROM master.dbo.syslogins sl
WHERE sl.sysadmin = 1 OR sl.securityadmin = 1
4 Below SQL query will show the information of database name , compatibility level ,database recovery model and database state , is it online or offline .
SELECT name,compatibility_level,recovery_model_desc,state_desc FROM sys.databases
5. This sql query will provides the logical name and the physical location of the data/log files of all the databases available in the current SQL Server instance
SELECT db_name(database_id) as DatabaseName,name,type_desc,physical_name FROM sys.master_files
6) The database may contain filegroups other than the primary file group. The following sql query gets executed in each database on the server and displays the file groups related results
EXEC master.dbo.sp_MSforeachdb @command1 = 'USE [?] SELECT * FROM sys.filegroups'
7) The following SQL query lists all of the databases in the server and the last day the backup happened. This will help the database administrators to check the backup jobs and also to make sure backups are happening for all the databases
SELECT db.name, case when MAX(b.backup_finish_date) is NULL then 'No Backup' else convert(varchar(100), MAX(b.backup_finish_date)) end AS last_backup_finish_date FROM sys.databases db LEFT OUTER JOIN msdb.dbo.backupset b ON db.name = b.database_name AND b.type = 'D' WHERE db.database_id NOT IN (2) GROUP BY db.name ORDER BY 2 DESC
8)The below sql query gets all the information related to the current backup location from the msdb database.
SELECT Distinct physical_device_name FROM msdb.dbo.backupmediafamily
9) SQL Server database administrators used sp_who and sp_who2 to check the current users, process and session information. These statements also provided information related to cpu, memory and blocking information related to the sessions
sp_who
Sp_who2
10) Using below query to find out the all databases file location on sql instance.
SELECT DB_NAME([dbid])AS [Database Name], fileid, [filename]
FROM sys.sysaltfiles
WHERE [dbid] > 0 AND [dbid] <> 32767
OR [dbid] = 2;