Created
June 27, 2018 23:33
-
-
Save adaoex/fdd708030ee88fc0e44f01145defa300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 01. Restringe Acesso ao Banco de Dados somente para "SysAdmin" */ | |
USE master; | |
GO | |
ALTER DATABASE nome_banco_dados | |
SET SINGLE_USER; | |
GO | |
ALTER DATABASE nome_banco_dados | |
SET RESTRICTED_USER; | |
GO | |
/* Procedimento RECOMENDADO PARA SQL Server 2005 ou Superior, sem usar sp_attach_db */ | |
/* 01. Tira o banco de dados "do ar" */ | |
ALTER DATABASE nome_banco_dados SET OFFLINE; | |
/* Mover o arquivo para o 'drive' manualmente e 'attach' a nova localização */ | |
ALTER DATABASE nome_banco_dados | |
MODIFY FILE ( NAME='nome_banco_dados_file', | |
FILENAME='[novo_path]\nome_banco_dados.mdf'); | |
ALTER DATABASE nome_banco_dados SET ONLINE; | |
/* Liberar acesso ao banco de dados */ | |
ALTER DATABASE nome_banco_dados SET MULTI_USER; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment