To begin with, it helps to log in to Windows under a login name with Windows Administration privileges. This lets the programs you run perform operations that might otherwise be impossible. It's also very helpful if the login name has SQL Server Administration privileges. (In some versions of Windows, people with Windows Administration privileges automatically have SQL Server Administration privileges, but in other versions of Windows, this isn't the case.)
Also in the window that tells you that errors occurred, click Details to gather more information about the problem. The rest of this web page discusses some Details messages you might see.
This error is displayed because there is still a "user" logged into the database. This may be a normal MainBoss user, but it might also be one of the following:
To correct this, you can use SQL Server Management Studio or Management Studio Express.
This error occurs if the backup was made by one version of SQL Server, but you are trying to open it in a different (older) version. In general, older versions of SQL Server cannot restore backup files made by newer versions.
This error is displayed because the user account was created on the SQL server by a system administrator or by a user who isn't the user attempting the restore. The error is because they are not the database owner (dbo) and they do not have the dbcreator role. Depending on what the IT department will accept, you can correct this in one of the three following ways:
EXEC sp_addsrvrolemember 'DOMAIN\LOGINNAME','dbcreator'where DOMAIN\LOGINNAME is the domain and login name of the person who'll be doing the restore. Once you have entered this query, press F5. This will add the user to the dbcreator role for all databases managed by this instance of SQL Server. This permission allows the user to create any database and will also enable the user to drop or alter any database across the entire server. This is therefore an extremely powerful permission that affects the entire SQL Server.
USE MainBossDatabase EXEC sp_changedbowner 'DOMAIN\LOGINNAME'where MainBossDatabase is the name of the MainBoss database and DOMAIN\LOGINNAME is the domain and login name of the person who'll be the new owner. Once you've typed in the above, press F5. This will add the user to the database owner role for the MainBoss database. The new owner will be able to create, delete, and alter the database.
USE master GRANT CREATE ANY DATABASE to 'DOMAIN\LOGINNAME'where DOMAIN\LOGINNAME is the domain and login name of the person to whom you want to grant the privilege. Once you've typed in the above, press F5. This gives the CREATE privilege to the specified user. The user will then be able to create databases, but will only be able to alter or delete the ones they create.