question

jangi avatar image
jangi asked

changing owner of database in wrong server

Hi,

I have migrated some databases to new server. As I need to change the owner of database to sa. I ran the script which I have to change all the databases owner to sa. But I did a mistake here, I ran it in source server instead of Target server. Does it going to be effect anything ?

I am confused now :/

sql-server-2016
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jangi avatar image jangi commented ·

@Oleg You have any idea ???

0 Likes 0 ·

1 Answer

·
KenJ avatar image
KenJ answered

it's not going to be a problem unless you have some specific reason for the source databases to be owned by accounts *other than* 'sa' - perhaps a vendor system or something. You can change database owners to other accounts on a case-by-case basis if it causes any problems.

It's generally a good idea to set database ownership to 'sa', as you were planning to do on your new server.

Just run the script on the new server as you originally planned and call it a day.

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·

If you know which accounts used to own the databases. You might be able to check an old backup of the master database for the previous owners.

1 Like 1 ·
jangi avatar image jangi KenJ commented ·

Ohhhh no. I don't have old databases.

Can we have any other way for it?

And what will be the issue we need to face if the database related to some Vendor?

0 Likes 0 ·
KenJ avatar image KenJ jangi commented ·

No other way, you need to know who the previous owners were to revert.

You’re very likely to be fine with the sa ownership. At worst you may see some permission issues for certain operations where a service account used to own a database - however, this is an uncommon problem. There’s a good chance you won’t see ant side effects from the change.

PS: I *strongly* recommend that you begin backing up your databases. Just imagine if you had run something destructive on the wrong server! How could you recover from that?

1 Like 1 ·
Show more comments
jangi avatar image jangi commented ·

Can I rollback those changes ?

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.