You can use the below script to make the database read only so that no user can edit the database.
USE [master]
GO
ALTER DATABASE [DBName] SET READ_ONLY WITH NO_WAIT
OR
GO
ALTER DATABASE [DBName] SET READ_ONLY
GO
You can use the below script to make the database read only so that no user can edit the database.
USE [master]
GO
ALTER DATABASE [DBName] SET READ_ONLY WITH NO_WAIT
OR
GO
ALTER DATABASE [DBName] SET READ_ONLY
GO
Orphan User:
An orphan user is a user in a SQL Server database that is not associated with a SQL Server login.
-- Script to check the orphan user
EXEC sp_change_users_login 'Report'
--Use below code to fix the Orphan User issue
DECLARE @username varchar(25)
DECLARE fixOrphanusers CURSOR
FOR
SELECT UserName = name FROM sysusers
WHERE issqluser = 1 and (sid is not null and sid <> 0x0)
and suser_sname(sid) is null
ORDER BY name
OPEN fixOrphanusers
FETCH NEXT FROM fixOrphanusers
INTO @username
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_change_users_login 'update_one', @username, @username
FETCH NEXT FROM fixOrphanusers
INTO @username
END
CLOSE fixOrphanusers
DEALLOCATE fixOrphanusers
How is the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
How to deploy .Net assembly? An MSI installer, a CAB archive, and XCOPY command.
What is a satellite assembly and what is the use of it? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
What namespaces are necessary to create a localized application? System.Globalization and System.Resources.
What is the smallest unit of execution in .NET? An Assembly is the smallest unit of execution in .Net
When should you call the garbage collector in .NET? It is recommended that, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory.
How do you convert a value-type to a reference-type? Use Boxing
What happens in memory when you Box and Unbox a value-type?
Boxing converts a value-type to a reference-type, thus storing the object on the heap. Unboxing converts a reference-type to a value-type, thus storing the value on the stack
DBCC TRACEON / DBCC TRACEOFF/ DBCC TRACESTATUS
DBCC TRACEON – Enable trace flags.
DBCC TRACEOFF – Disable trace flags.
DBCC TRACESTATUS – Display the status of trace flags.
–> Turn flag on for only the session level
DBCC TRACEON (1222)
DBCC TRACEON (1205,1222)
GO
–> Turn flag on globally at server for all the sessions
DBCC TRACEON (1222, -1)
GO
— >Turn flag off
DBCC TRACEOFF (1222);
GO
–> Show flag status
DBCC TRACESTATUS (1205,1222)
DBCC TRACESTATUS (-1)
Error Description
Login failed for user ‘sa’ because the account is currently locked out. The system administrator can unlock it.
Root Cause
SQL Account only locked out, if it is enfoced to use password policies.
Resolution
You can unlock it by exeuction below command.
ALTER LOGIN sa WITH PASSWORD = ‘password’ UNLOCK
OR
You can do it GUI as well by unchecked locked checkbox