Skip to main content

[MSSQL]: Common T-SQL



-- Check version
PRINT @@Version


SELECT * FROM sys.configurations


-- Show all processes
SELECT * FROM sys.sysprocesses


-- Check active connections
SELECT DB_NAME(dbid) AS DBName, COUNT(dbid) AS NumberOfConnections, loginame
FROM sys.sysprocesses
GROUP BY dbid, loginame
ORDER BY DB_NAME(dbid)



-- Check Collation used by all databases
USE Master
GO 
SELECT NAME, COLLATION_NAME 
FROM sys.Databases 
ORDER BY DATABASE_ID ASC 
GO

-- Enable 'sa' login
ALTER LOGIN [sa] ENABLE
GO

Popular posts from this blog

VMware vCenter: user@vsphere.local password expired - Authentication Failure

SSO log file: C:\ProgramData\VMware\vCenterServer\logs\sso\vmware-sts-idmd.log [2017-10-15T12:19:28.148+07:00 vsphere.local        e18baecc-2ce5-479a-adec-1bcbef603cdb ERROR] [IdentityManager] Failed to authenticate principal [tuyendq@vsphere.local]. User password expired. [2017-10-15T12:19:28.148+07:00 vsphere.local        e18baecc-2ce5-479a-adec-1bcbef603cdb INFO ] [IdentityManager] Authentication failed for user [tuyendq@vsphere.local] in tenant [vsphere.local] in [15] milliseconds with provider [vsphere.local] of type [com.vmware.identity.idm.server.provider.vmwdirectory.VMwareDirectoryProvider] [2017-10-15T12:19:28.148+07:00 vsphere.local        e18baecc-2ce5-479a-adec-1bcbef603cdb ERROR] [ServerUtils] Exception 'com.vmware.identity.idm.PasswordExpiredException: User account expired: {Name: tuyendq, Domain: vsphere.local}' com.vmware.identity.idm.PasswordExpiredException: User account expired: {Name: tuyendq, D...

Linux command: grep - Global Regular Expression Print

grep command grep, egrep, fgrep, rgrep - print lines matching a pattern

Windows Command: arp - Address Resolution Protocol

Notes from daily work situation. While troubleshooting HSRP, I need to delete arp table on my computer. arp -d * Take a look at other options with arp command: C:\Users\Administrator>arp /? Displays and modifies the IP-to-Physical address translation tables used by address resolution protocol (ARP). ARP -s inet_addr eth_addr [if_addr] ARP -d inet_addr [if_addr] ARP -a [inet_addr] [-N if_addr] [-v] -a Displays current ARP entries by interrogating the current protocol data. If inet_addr is specified, the IP and Physical addresses for only the specified computer are displayed. If more than one network interface uses ARP, entries for each ARP table are displayed. -g Same as -a. -v Displays current ARP entries in verbose mode. All invalid entries and entries on the loop-back interface will be shown. inet_addr Specifies an internet address. -N if_a...