HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Error 297, Severity 19 trying to create new table as sysadmin

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
errornewcreatetryingsysadmin297severitytable

Problem

I am completely scratching my head right now. I have two database instances that I am trying to add a table to, and both give me the same error:

The user does not have permission to perform this action.

and I have triple checked the permissions, I am on a sysadmin account. Running the following query to see what create permissions I have yields the following:

SELECT SYSTEM_USER

-- Now get the permissions assigned to you by the server administrator 
use tempDB 
GO 

;with getPermissions as ( SELECT * FROM fn_my_permissions (NULL, 'DATABASE') ) 
select permission_name from getPermissions 
where permission_name like 'create%' 
GO


I have also tried creating another login with sysadmin privileges to no avail. Any ideas?

Error log picture below:

```
USE [db_test]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].Table NOT NULL,
[b] nvarchar NULL,
[c] decimal NULL,
[d] [bit] NULL,
[e] nvarchar NULL,
[f] nvarchar NULL,
[g] nvarchar NULL,
[h] [int] NULL,
[i] [int] NULL,
[j] [int] NULL,
[k] [int] NULL,
[l] [int] NULL,
[m] [int] NULL,
[n] [int] NULL,
[o] [int] NULL,
[p] [int] NULL,
[q] [int] NULL,
[r] [int] NULL,
[s] [int] NULL,
[t] [int] NULL,
[u] [int] NULL,
[v] [int] NULL,
[w] [int] NULL,
[x] [int] NULL,
[y] [int] NULL,
[z] [int] NULL,
[aa] [int] NULL,
[ab] [int] NULL,
[ac] [int] NULL,
[ad] [int] NULL,
[ae] [int] NULL,
[af] [int] NULL,
[ag] [int] NULL,
[ah] [int] NULL,
[ai] [int] NULL,
[aj] [int] NULL,
[ak] [int] NULL,
[al] [int] NULL,
[am] [int] NULL,
[an] [int] NULL,
[ao] [int] NULL,
[ap] [int] NULL,
[aq] [int] NULL,
[ar] [int] NULL,
[as] [int] NULL,
[at] [int] NULL,
[au] [int] NULL,
[av] [int] NULL,
[aw] [int] NULL,
[ax] [int] NULL,
[ay] [int] NULL,
[az] [int] NULL,

Solution

This is not likely a permissions issue, at least not the type of permission you are thinking of. Typical permissions errors show up as follows:

Msg 262, Level 14, State 1, Line XXXXX
CREATE TABLE permission denied in database 'tempdb'.


Now that we have a more complete error message, we can see that indicates a "severity" of 19.

According to Microsoft SQL Server documentation:

Severity         Meaning

17-19          Indicate software errors that cannot be corrected by the user. Inform your system administrator of the problem.

19               Indicates that a nonconfigurable Database Engine limit has been exceeded and the current batch process has been terminated. Error messages with a severity level of 19 or higher stop the execution of the current batch. Severity level 19 errors are rare and must be corrected by the system administrator or your primary support provider. Contact your system administrator when a message with a severity level 19 is raised. Error messages with a severity level from 19 through 25 are written to the error log.

This sounds more like (hypothetically) using SQL Server Express and reaching the 10 GB DB limit (even a CREATE TABLE statement needs to add meta data) than it does a permissions problem.

With more info it will hopefully be possible to narrow down the specific source of this. Here is what testing has shown so far:

  • database is not read-only



  • user = dbo



  • able to run statements in question on several other identical instances of this exact database just fine. Just one local instance giving the error



  • unable to create a table using CREATE TABLE dbo.[_test] ([Col1] INT);. but able to edit tables using SSMS and also add rows



  • unable to create anything, not just Tables (View / Function / etc). get the same error.



  • The size of the database is 5008.00 MB and space available is 114.16 MB



  • able to create a temp table while in the problem DB: USE [problem_db]; CREATE TABLE #Bob (Col1 INT);



  • able to create a real table in tempdb: USE [tempdb]; CREATE TABLE dbo.Bob2 (Col1 INT);



  • DBCC TRACESTATUS(-1); shows no trace flags in use



  • Compatibility mode is SQL Server 2014 (120), but have also tried 2017 (140)



  • able to create a schema in the problem DB: CREATE SCHEMA [_DeleteMe];



  • UNable to create a table in the new schema: CREATE TABLE [_DeleteMe].[_test] ([Col1] INT);



  • Owner SID did not match between sys.databases and dbo user in the problem DB, but that has been fixed and still not able to create a table



  • TRUSTWORTHY is OFF, but also OFF on instance where this DB is just fine



Here are some places to check for things can cancel submitted operations:
SELECT * FROM sys.triggers;
SELECT DB_NAME(ts.[database_id]) AS [Database],
OBJECT_NAME(ts.[object_id], ts.[database_id]) AS [Trigger],
OBJECT_DEFINITION(ts.[object_id]) AS [Definition],
*
FROM sys.dm_exec_trigger_stats ts;

SELECT * FROM sys.database_audit_specifications;
SELECT * FROM sys.database_audit_specification_details;

SELECT * FROM sys.security_policies;

Code Snippets

Msg 262, Level 14, State 1, Line XXXXX
CREATE TABLE permission denied in database 'tempdb'.

Context

StackExchange Database Administrators Q#285135, answer score: 4

Revisions (0)

No revisions yet.