Issues with Shrinking or Truncating SIMPLE Recovery Mode Database I had a database with log file size of 30 Gig and Data File with 20 Gig. I wanted to shrink the database but I was not able to . When I ran “DBCC OPENTRAN“, I …
SQL Server Login Properties
SQL Server Login Properties USE [master] GO SELECT [name] AS [SQL_User] ,LOGINPROPERTY([name], ‘PasswordLastSetTime’) AS [PasswordLastResetDT] ,LOGINPROPERTY([name], ‘BadPasswordCount’) AS [BadPasswordCount] ,LOGINPROPERTY([name], ‘BadPasswordTime’) AS [BadPasswordDT] ,LOGINPROPERTY([name], ‘HistoryLength’) AS [HistoryLength] ,LOGINPROPERTY([name], ‘IsExpired’) AS [IsExpired] ,LOGINPROPERTY([name], ‘IsLocked’) AS [IsLocked] ,LOGINPROPERTY([name], ‘IsMustChange’) AS [IsMustChange] ,LOGINPROPERTY([name], ‘LockoutTime’) AS [LockoutTime] FROM [sys].[sql_logins] …
Truncate Log – Rebuild Indexes – Statistics
Change FULL Recovery Model to SIMPLE and Shrink Log SELECT sys.databases.name , SUM(size) * 8 / 1024 AS [Total_disk_pace_MB] FROM sys.databases JOIN sys.master_files ON sys.databases.database_id = sys.master_files.database_id GROUP BY sys.databases.name ORDER BY 2 DESC , sys.databases.name; USE master; DECLARE @isql VARCHAR(2000) , @dbname VARCHAR(64) , …
Auditing Columns Add
Auditing Columns Add: I had a need to answer “who”,”where” and “when” questions about the data we add and update. We didn’t have Auditing columns on all our tables. So I thought about coming up with easy way of Adding Auditing Columns. Auditing Columns: CreatedBy …
Attaching Volume to EC2 Instance
Attaching Volume to EC2 Instance To list the partitions $ cat /proc/partitions major minor #blocks name 202 1 52428800 xvda1 Create a Volume in EC2 Instance and attach it to the instance. $ cat /proc/partitions major minor #blocks name 202 …