| title | Rename user sys | Microsoft Docs | |
|---|---|---|
| ms.custom | ||
| ms.date | 06/13/2017 | |
| ms.prod | sql-server-2014 | |
| ms.reviewer | ||
| ms.technology | database-engine | |
| ms.topic | conceptual | |
| helpviewer_keywords |
|
|
| ms.assetid | d622d646-83e4-4b6f-9a21-77b301af04b5 | |
| author | mashamsft | |
| ms.author | mathoma | |
| manager | craigg |
Upgrade Advisor detected the user name sys in a database. This name is reserved. Rename the user before you upgrade. If the user is not renamed, the database will be in a suspect state after the upgrade process and will be unavailable until the database is brought online.
[!INCLUDEssDE]
User sys is reserved.
Before you upgrade, in each database that contains user sys, do the following:
-
Create a new user.
-
Use the following statements to display all permissions that are granted by user sys and granted to user sys.
-- Return permissions granted by user sys. SELECT * FROM sysprotects WHERE grantor = USER_ID('sys') -- Return permissions granted to user sys. SELECT * FROM sysprotects WHERE uid = USER_ID('sys') -
To transfer ownership of all objects owned by sys to the new user, use sp_changeobjectowner.
-
Drop user sys.
-
To restore the original permissions captured in step 2, use the AS new_user clause of the GRANT statement.
-
Modify scripts to reference the new user. For example, scripts that contain statements such as
SELECT * FROM sys.my_tablemust be changed toSELECT * FROM new_user.my_table.
If the user sys was not renamed prior to upgrading, do the following:
-
Execute the statement
ALTER DATABASE db_name SET ONLINE. The database will be in SINGLE_USER mode. -
Follow all steps in the Before Upgrade Procedure section.
-
Execute the statement
ALTER DATABASE db_name SET MULTI_USER.
Database Engine Upgrade Issues
SQL Server 2014 Upgrade Advisor [new]