MS SQL Server – Cannot create Database Diagram: You have to alter authorization on database

MS SQL Server – Cannot create Database Diagram: You have to alter authorization on database

Di recente mi è capitato di ricevere il seguente errore in fase di creazione di un diagramma di un database ripristinato a partire da un bakup:

Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.

Dopo una ricca ricarca su Google sono arrivato alla conclusione che in sostanza si è perso l’owner del database.

Lo snippet che mi ha risolto il problema è il seguente:

ALTER AUTHORIZATION ON DATABASE::dbName TO sa

Dove ‘Northwind’ è il nome del database e ‘sa’ è la login da abilitare.

Enjoy snuippet!

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *