XML Backup or Restore Fails due to Could not read fields for Table
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.