XML Backup or Restore Fails due to Could not read fields for Table
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
During an xml backup or restore, one may see the following error:
The following errors may occur in the atlassian-jira.log
:
An exception occurred backing up: java.lang.RuntimeException: Could not read fields for table AO_563AEE_ACTIVITY_ENTITY
...
2012-06-25 16:29:40,773 JiraImportTaskExecutionThread-1 ERROR user 989x582x1 dm7jj8 137.183.232.24 /secure/admin/XmlRestore.jspa [jira.bc.dataimport.DefaultDataImportService] Error importing data: java.lang.RuntimeException: Could not read fields for table AO_563AEE_ACTIVITY_ENTITY
java.lang.RuntimeException: Could not read fields for table AO_563AEE_ACTIVITY_ENTITY
at net.java.ao.schema.helper.DatabaseMetaDataReaderImpl.getFields(DatabaseMetaDataReaderImpl.java:151)
at net.java.ao.schema.ddl.SchemaReader.readFields(SchemaReader.java:125)
at net.java.ao.schema.ddl.SchemaReader.readTable(SchemaReader.java:108)
...
Caused by: java.sql.SQLException: Invalid object name 'AO_563AEE_ACTIVITY_ENTITY'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
Cause
The currently only known cause of this error occurs with running JIRA on a MSSQL databases and specifically not setting a schema name. The database will default this value to dbo
, but this is not the same as setting the value to dbo
explicitly. This has also been known to happen during JIRA upgrades or migrations.
___ Database Configuration ________________
Loading entityengine.xml from : file:/C:/Program%20Files/Atlassian/JIRA/atlassian-jira/WEB-INF/classes/entityengine.xml
Entity model field type name : mssql
Entity model schema name :
Database Version : Microsoft SQL Server - 10.50.2500
Database Driver : jTDS Type 4 JDBC Driver for MS SQL Server and Sybase - 1.2.4
Database URL : jdbc:jtds:sqlserver://sqlsvr:1433/jiradb1
Database JDBC config : mssql jdbc:jtds:sqlserver://sqlsvr:1433/jiradb1
Resolution
In the database configuration a proper schema name should be set. See Incorrect MS SQL Schema Used for further information.