Cannot alter the login 'sa', because it does not exist or you do not have permission. (Microsoft SQL Server, Error: 15151)
User does not have permission to perform this action( Microsoft SQL Server, Error:15247)
---------------------------------------------
I found a solution. Basically, run SQL server in Single-user maintenance mode, and you will get access to the server again. You must be an administrative user for this to work.
NOTE: In all of the examples below, you may have to change parameters or command-lines based on your server name and instance name.
I. Force SQL server to support mixed-mode authentication.
1. Run REGEDIT
2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer
NOTE: This key may vary slightly based on the installed version and instance name.
3. Set "LoginMode" to 2.
4. Restart SQL Server.
(Source: http://support.microsoft.com/kb/285097 )
II. Force SQL server to let you in temporarily
1. Go to services.
2. Stop SQL Server.
3. Grab the SQL server command-line (right click the service - properties). Mine is:
"C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS
I. Force SQL server to support mixed-mode authentication.
1. Run REGEDIT
2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer
NOTE: This key may vary slightly based on the installed version and instance name.
3. Set "LoginMode" to 2.
4. Restart SQL Server.
(Source: http://support.microsoft.com/kb/285097 )
II. Force SQL server to let you in temporarily
1. Go to services.
2. Stop SQL Server.
3. Grab the SQL server command-line (right click the service - properties). Mine is:
"C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS
Este passo 3 não rodei porque deu erro no passo 5
4. Open an administrative command prompt.
5. Run the command-line from step 3, but add -m -c for single-user maintenance mode command-line.
6. Open another administrative command prompt.
7. Run "sqlcmd -S localhost\SQLEXPRESS" from that same directory (replace with your server and instance name)
8. Now you can do all the stuff everyone told you to do that didn't work. For example, to create a hero user with administrative accss:
Eu preferi habilitar o usuario SA e colocar uma senha, veja no fim do POST
CREATE LOGIN hero WITH PASSWORD='123', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF EXEC sys.sp_addsrvrolemember @loginname = 'hero', @rolename = 'sysadmin' GO9. QUIT and close the command-prompt
10. Go to the SQL Server command-line window and hit ctrl+C. It will prompt "Do you wish to shutdown SQL Server (Y/N)?" and enter Y.
11. Close the command-prompt
(Source: http://msdn.microsoft.com/en-us/library/dd207004.aspx )
III. Finally, login using your hero:
1. Restart the SQL Server service
2. Login using SQL Server authentication as the user "hero" with password "123"
3. *BAM* now you are in. Now give yourself sysadmin access and delete the temporary user.
Fiz diferente ao invez de criar um outro usario habilitei o usuario "SA" e coloquei uma senha: 123456 nele
- Proposed As Answer by Moby Disk Wednesday, December 15, 2010 7:39 PM
http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/60b888bf-30dc-4eaf-bea8-5fd55181f8e5
-------------------------------------------------------------------
"Como acessar o SQL Server quando não temos uma conta Administrativa"
Links Uteis
Como alterar o modo de autenticação de logon padrão para SQL
http://support.microsoft.com/kb/285097
Como verificar se a senha do SA está em branco
http://support.microsoft.com/kb/322336
Como determinar ou alterar o modo de autenticação
http://support.microsoft.com/kb/322336
habilitando sql authentication e o usuário “sa”
http://sqlfromhell.wordpress.com/2009/05/24/habilitando-sql-authentication-e-o-usuario-sa/
Comandos uteis:
|
Outra maneira pratica de habilitar o usuário “sa” é por meio de script, exemplo:
ALTER LOGIN sa ENABLE;
GO
ALTER LOGIN sa WITH PASSWORD = 'P@ssw0rdM0del0';
GO
Fontes:
http://www.mcdbabrasil.com.br/modules.php?name=Forums&file=viewtopic&t=3850
Outros links:
http://social.technet.microsoft.com/Forums/en-US/admingeralpt/thread/48593c3d-a2d1-4fd5-b745-cb5908afb7ac
Nenhum comentário:
Postar um comentário