SQL databases recovery model

SELECT name, recovery_model_desc
FROM sys.databases

GO

Advertisements

How to force drop database in SQL

USE master;
ALTER DATABASE [databasename] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [databasename] ;

Cannot see a SQL Configuration Manager

sqlservermanager11.msc

Add listener to AlwaysOn Cluster

ALTER AVAILABILITY GROUP sp2013
ADD LISTENER ‘lisname’ ( WITH IP ( (‘192.168.0.1′,’255.255.255.0’) ) , PORT = 1433 );
GO

SQL: list of waiting tasks

select * from sys.dm_os_waiting_tasks where session_id>50

SQL waiting stats

SELECT *
FROM sys.dm_os_wait_stats

SQL: create account with SID

CREATE LOGIN <loginname> WITH PASSWORD = <password>, SID = <sid for same login on principal server>