0

I had to change hostname to conform to new employer policy. I have about 4 DBs locally in MSSQL lite. They still work. The apps that use them are working just fine. I ran...

SELECT @@SERVERNAME AS 'Old Server Name'
EXEC xp_getnetname

and it came up with the correct old server name and the correct new name in the results. I found an article that drops the old server name but I'm worried that my DBs which are working will be dropped. Is there a way to update the old such that my DBs will now be accessible. I tried just changing the server name to the old one, but my user has also changed. The employer changed our domain and accounts and gave us new hostnames. And I always used Windows Auth to authenticate.

How can I find my old DBs and get into them so I can do maintenance?

3
  • I don't quite understand your scenario. When you say MSSQL lite, you mean SQL Server Express? And what is the error message you get when you try to connect to the database?
    – Ronaldo
    Jun 15 at 12:05
  • sorry, yes, express. I can login by using windows authentication with my new pc name and username. But the 4 DBs that I used to have when I click on them to drill down into tables or users,etc, it says "The database <dbname> is not accessible. (ObjectExplorer). I have 4 DBs that do this. And I suspect that my change in hostname is the issue.
    – brjacobso
    Jun 15 at 21:34
  • 1
    Is the login used to start SQL Server service a local account (like System) or a domain account? Are the databases that work and the ones that don't residing on the same folder? Are the databases on a local folder or some share on the network? Since your problems started after a change of names and users, it's likely that the new accounts don't have permission on the folders that contain those databases. Also, did you see SQL Server log? A database inaccessible usually creates log entries that will give you a hint about the actual problem.
    – Ronaldo
    Jun 16 at 12:17

1 Answer 1

0

Is the article this one?

https://docs.microsoft.com/en-us/sql/database-engine/install-windows/rename-a-computer-that-hosts-a-stand-alone-instance-of-sql-server?view=sql-server-ver16

What I would also add, do you have a sandbox environment where you can test and prove the process? That will also help a great deal in confidence on a production system.

5
  • 1
    Heads up, this is really more of a comment than an answer.
    – J.D.
    Jun 15 at 11:44
  • I think it is helpful though. There was a different link where I had found the way to compare the servernames with named instances. So I think I'm going to try this procedure from the link you provided and see if that does it.
    – brjacobso
    Jun 15 at 21:26
  • Shoot, I tried the named instance version of updating and I got user does not have permission to perform this action. I'll keep digging.
    – brjacobso
    Jun 15 at 21:31
  • I tried adding a -m parameter to my service for sql in my windows services, restarted the service and now all my old users appeared. And this time when I clicked on my database, It says "login failed for user '<OldComputerName'\'OldUsername>' Reason: Server is in single user mode. Only one administrator can connect at this time. error 18461. I'll be looking that up next.
    – brjacobso
    Jun 15 at 21:50
  • -m seems to specify that single user mode. I'm automatically logged in as the new user and when I click on options and items in the databases, I think it's trying to use the old computer name and username to connect and I'm already connected as the new person.
    – brjacobso
    Jun 15 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.