Operational Defect Database

BugZero found this defect 459 days ago.

Microsoft SQL Server | 1860413

This fix resolves the following issues that can occur when you rename databases: Issue 1: SQL Server crashes when a user who has a non-default schema (for example: CREATE USER <user_name> FOR LOGIN <login_name> WITH DEFAULT_SCHEMA = <schema_name>) executes queries in the following sequence: 1. Executes a query like the following with an implicit name (a schema name that isn't explicitly specified requires SQL Server to determine the same name): SELECT * FROM <database_name>..<table_name> 2. Renames the database. 3. Reruns the implicit query from step 1. Issue 2: Fixes SQL Server error 942 that occurs when you perform the following steps in the same sequence on your SQL Server instance: 1. You query a table in a database (for example: SELECT * FROM DatabaseA.sys.columns). 2. You rename an existing database (for example: ALTER DATABASE DatabaseA MODIFY NAME = DatabaseA_old). 3. You take this renamed database offline (for example: ALTER DATABASE DatabaseA_old SET OFFLINE). 4. You rename another database on the server to have the same name as the database that you renamed in step 2 (for example: ALTER DATABASE DatabaseA_new MODIFY NAME = DatabaseA). 5. Now if you query a table in this database (for example: SELECT * FROM DatabaseA.sys.columns), you'll receive the following 942 error: Msg 942, Level 14, State 4, Line <LineNumber> Database 'DatabaseA_old' cannot be opened because it is offline.

Last update date:

2/16/2023

Affected products:

SQL Server 2022 on Linux

SQL Server 2022 on Windows

Affected releases:

build lower than 16.0.4003.1

Fixed releases:

16.0.4003.1

Description:

This fix resolves the following issues that can occur when you rename databases: Issue 1: SQL Server crashes when a user who has a non-default schema (for example: CREATE USER <user_name> FOR LOGIN <login_name> WITH DEFAULT_SCHEMA = <schema_name>) executes queries in the following sequence: 1. Executes a query like the following with an implicit name (a schema name that isn't explicitly specified requires SQL Server to determine the same name): SELECT * FROM <database_name>..<table_name> 2. Renames the database. 3. Reruns the implicit query from step 1. Issue 2: Fixes SQL Server error 942 that occurs when you perform the following steps in the same sequence on your SQL Server instance: 1. You query a table in a database (for example: SELECT * FROM DatabaseA.sys.columns). 2. You rename an existing database (for example: ALTER DATABASE DatabaseA MODIFY NAME = DatabaseA_old). 3. You take this renamed database offline (for example: ALTER DATABASE DatabaseA_old SET OFFLINE). 4. You rename another database on the server to have the same name as the database that you renamed in step 2 (for example: ALTER DATABASE DatabaseA_new MODIFY NAME = DatabaseA). 5. Now if you query a table in this database (for example: SELECT * FROM DatabaseA.sys.columns), you'll receive the following 942 error: Msg 942, Level 14, State 4, Line <LineNumber> Database 'DatabaseA_old' cannot be opened because it is offline.

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Unavailable

Learn More

Search:

...