remote procedure call failed after deleting account - sql-server

Someone retired and we deleted an account associated with them on our Microsoft SQL Server 2008. We are getting "remote procedure call failed 0x800706be" and the Administrator login is not working. (And every thing else isn't working too) It seems like somehow that account was a key for the whole Microsoft SQL Server install.
We tried restoring the Microsoft backup for C (windows) and D (applications/SQL Server) drives and it didn't fix it. In fact, the deleted account didn't come back, although we had tried creating an account with the same name and hadn't deleted that fully before the restore.
Any ideas how to recover from that? The rest of the server is like this:
F: our file system/web
G: DB

Re-creating an account with the same name isn't going to work, because SQL Server uses the UID of the account and not the name for authentication.
Create a new Active Directory service account, and do a clean install of SQL Server using this new service account as the account to run SQL Server. Then, restore your database backups (including master, model, and msdb).

Related

SQL Server Express unable to set login password

I've installed SQL Server Express 2019 on a Windows machine for Sitecore development. I had a hard drive crash and needed to rebuild; prior to the crash everything was working fine.
Mixed authentication is enabled, as is the SA account.
The Sitecore installer can connect to my local instance, and sets up the database structure, including a set of database logins. Everything looks OK in SSMS and initially works - I get the Welcome to Sitecore page.
However, connecting to SSMS and then trying to log in with the passwords Sitecore generated fails. When I try to set them in SQL Server, they don't take (I always get a bad password error).
I've tried as both my Windows account (which installed SQL Server) and as the sa account I configured at install. Also tried running as administrator.
The GUI and scripts seem to work fine, but the passwords never seem to get set. Prior to the crash I could connect to SSMS using the generated logins, and verify connectivity.
I'm at a loss where to go from here, other than imaging the machine and reinstalling a fresh copy of Windows.
I'm assuming that you had to reinstall SQL Server and then perform a database restore from a backup.
If this was the case, the users in the database, after the restore, were "orphaned", as they had no corresponding login in the master database. Even if Sitecore did create logins, they would have different SIDs to the users in the Sitecore database. The only way work with those users, would have been to restore a backup of the master database, in which case both server logins and database users would have had the same SIDs.
Failing that, your only option was to delete the users and re-create the logins and users correctly, which you did.
For future reference check out Microsoft's documentation on troubleshooting orphaned users in SQL Server.
So, no, this was not "a quirk with the installer and SQL Express or some kind of bug." ;-)
HTH Sean

Restore .bak on Azure SQL database through SSMS: Failed to connect to Server ***. Login Failed for user ***

I am trying to restored a .bak file on an Azure SQL server through SSMS.
The reason why I am doing this is that my company unfortunately blocked any action on the Azure portal itself and therefore I have to find another way around.
I am able to connect successfully to the DB on Azure with my admin account through SSMS.
I first successfully restored the .bak on my local database. And then I am trying:
Again, I am able to connect through the same SSMS to the SQL db.
Moreover, when starting this procedure I get asked to connect first to the DB, which works successfully! What I mean is:
It doesn't give me any error, which is weird because if I try to connect with a wrong password it tells me right away that is wrong. So it kind of accepts it. It's only after when I really start the deployment that it gives me the problem:
Just for now, Azure SQL database doesn't support restore from .bak file.
You work flow should be right, restore the .bak file(database) into a local SQL Server firstly, then deploy the restored database to Azure with "Deploy database to Microsoft Azure SQL database".
Make sure you are using the server admin account of the Azure SQL database. Per my experience, the error is usually caused by the permission limits.
If all of these(SSMS) don't work, please thy other ways. Please try Data Migration Assistant(DMA) migrate the database. If DMA still give the same error, we can ensure that it's not caused by the tools, you need another higher Azure SQL database account permission.
HTH.
Working solution was to use the export data task:
For some reason this worked and the publish to ASQL task from SSMS didn't. I understand this is very based on the restrictions imposed by my company but at least this solution worked.
NOTE: as both Source and Destination use SQL Server Native Client .
Moreover when setting the Destination the refresh of the list of databases might not work (depending on your permissions on Server level) but if you type directly the name of the database it will work. Talking about this:

Windows Authentication Failed on changing the domain server

I had installed SQL server 2012 using windows authentication and attached a database that is on my C drive. Domain server failed and we have to rebuild domain server. The domain server name is now changed to new name. When I try to log in to the SQL 2012 Studio, I can not log in and I am getting an error login failed for the user.
All we did was add a letter to the domain server. Could someone direct how to correct the issue as SQL server 2012 studio is not allow me to login?
Thanking you,
Hem
This is about more than just changing the name. Domain memberships involve cyrptographic signatures that must also be replaced. All of the machines in your domain will need to re-join. You'll have a new account on your own machine. Yep, it sucks, and this is one reason why you should always keep at least 2 DCs.
Assuming you don't know any other account info, the only way to get back into the existing Sql Server instance is to restart Sql Server in single-user mode and connect as a local administrator. After you've done this, you'll need to recreate all of your logins.
Since you'll be recreating accounts and permission anyway, another option is to use this as opportunity to upgrade to a more recent Sql Server version. Sql Server 2012 is already major 3 releases behind. Shut down and uninstall the existing Sql Server instance. Install the new version of the Sql Server, where you know the sa login, and then attach to the old database mdf files.
Have you try to login with SQL authentication? (with SA account)
SQL:
DROP LOGIN [OldDomain\UserName]
GO
CREATE LOGIN [NewDomain\UserName] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
GO
ALTER SERVER ROLE [sysadmin] ADD MEMBER [NewDomain\UserName]
GO
Then you will be able to login with your new domain name. (Make sure you change the domain name and username in the above SQL)
If you need to recover your sa password? Check this article How to recover SA password

How to restore DNN Backup

I have taken DNN 6 backup in the following ways
Copy the DNN folder from C:\inetpub\wwwroot
Take Sqlserver 2008 Enterprise edition database backup
When I try to restore it, I am getting error:
Connection Error(s): Index #: 0 Source: .Net SqlClient Data Provider
Class: 14 Number: 18456 Message: Sql login failed
I am using the following link for restoration:
.../Install/InstallWizard.aspx
Note !!! When i change the database and username, it will install the fresh installation but not restoring backup database.
How to solve this problem?
Some of the answer here will depend on where/how you are restoring the database.
If you take a database from one server to the other, the user account does NOT come with it from a server login perspective. So after restoring the database, you will need to create a new user account for managing the access to the database.
I'm not sure about needing to run the /InstallWizard.aspx to perform a restore. The first step is to get the files laid down in the Windows directory you want, and then get the IIS setup and pointed properly ensuring that you have the right security access (Depending on your version of IIS) to the files. If you get all that right you will be good to go from a file perspective.
As far as SQL Server you will need to do a manual database restore and as Mitch says create a new account that will have access to the database - You will need to change both database access statements the web.config to specify the new user. (standard and legacy if they both exist) Finally, make sure that SQL server is configured in Mixed Mode Authentication if you are specifying a SQL user.

locating a flat file from SQL server 2005

I have built an SSIS job in visual studio 2005 that accesses a flat file and updates a table in SQL Server 2005. This works perfectly. I then store a copy on SQL Server by using the server storage option in the protection level property. When I try to run this it cannot locate the flat file. The flat file is located on a server and I use the IP address to access it. I have noticed that if I remove my maping to this server and run the job from visual studio, it cannot find it either. Hoe do I access the file from SQL Server 2005 ? I intend to schedule this job to run automatically on SQL Server.
Many Thanks for any help you can give.
Ronnie Carlin
Just to avoid anything more complex being the issue, check what account the job is being run under (e.g. has a procy and credential) or whether it is using the base SQL Agent account, and then check whether that account has access rights to the folder \ file you are trying to import.
Had that catch us out more than once.
Edited to include the additional information in the main answer.
When SQL Agent runs a job it does not use your account, even if you initiated the job execution - it uses the SQL Agent account. The account the SQl Agent is set up under (by default) or a named account you specidy with a proxy / credential. You might be able to access the folder, but you need to check what account SQL Agent is running under and whether it can access it.
To find out which account the job is running under by default you can access it via
Start -> Program files ->SQL Server -> Configuration Tools -> SQL Server Configuration Manager. In the 2005 Services SQL Server Agent will be listed, right click properties, first tab shows what account the Agent is being run under.
However, if you need a job running under a specific account I would advise you create a proxy / credential and not alter the agent account - since that is the account all the other jobs are using.
Credential and proxy are different objects within SQL, Credentials are stored under the security folder / credentials - that is where you create a credential and place your AD username / pwd.
The proxy then asks you to select a credential from the list of credentials already stored on the system - not your domain\user at that point.

Resources