TO SET TO READ WRITE
-----------------------------------------------------------------
USE MASTER
GO
/*Mark it as Singe User*/
ALTER DATABASE [DATABASE_NAME] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
/*Mark the database as Read Write*/
ALTER DATABASE [DATABASE_NAM] ESET READ_WRITE WITH ROLLBACK IMMEDIATE
/*Mark it back to Multi User now*/
ALTER DATABASE DATABASE_NAME SET MULTI_USER
GO
/*Mark it as Singe User*/
ALTER DATABASE [DATABASE_NAME] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
/*Mark the database as Read Write*/
ALTER DATABASE [DATABASE_NAM] ESET READ_WRITE WITH ROLLBACK IMMEDIATE
/*Mark it back to Multi User now*/
ALTER DATABASE DATABASE_NAME SET MULTI_USER
TO SET TO READ ONLY
-----------------------------------------------------------------
USE MASTER
GO
/*Mark it as Singe User*/
ALTER DATABASE [DATABASE_NAME] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
/*Mark the database as Read Only*/
ALTER DATABASE [DATABASE_NAME] SET READ_ONLY WITH ROLLBACK IMMEDIATE
/*Mark it back to Multi User now*/
ALTER DATABASE [DATABASE_NAME] SET MULTI_USER
GO
/*Mark it as Singe User*/
ALTER DATABASE [DATABASE_NAME] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
/*Mark the database as Read Only*/
ALTER DATABASE [DATABASE_NAME] SET READ_ONLY WITH ROLLBACK IMMEDIATE
/*Mark it back to Multi User now*/
ALTER DATABASE [DATABASE_NAME] SET MULTI_USER
No comments:
Post a Comment