若是你遇到了下面的錯誤信息,例如:sql
com.atlassian.confluence.importexport.ImportExportException: Unable to complete import because the data does not match the constraints in the Confluence schema. Cause: MySQLIntegrityConstraintViolationException: Duplicate entry '1475804-Edit' for key 'cps_unique_type'
上面表示在 XML 的備份文件中恢復的數據庫沒有正確的權限,一般是由於使用了第三方的插件的緣由。這個問題在 Confluence 3.5.2 的後續版本中已經修復了,請參考 CONF-22123 中的說明。若是你的版本已是新的版本了,你的導出文件可能須要手動進行修改來刪除掉重複權限實例,或者整個記錄都須要被刪除。下面的 SQL 能夠被用來找到這個記錄。數據庫
SELECT
*
FROM
CONTENT_PERM
WHERE
USERNAME
IS
NULL
AND
GROUPNAME
IS
NULL
;
FROM
CONTENT_PERM cp
SELECT
cps1.ID, cps1.CONTENT_ID, cps1.CONT_PERM_TYPE
FROM
CONTENT_PERM_SET cps1, CONTENT_PERM_SET cps2
SELECT
cp.ID, cp.CP_TYPE, cps.CONTENT_ID,
(
SELECT
scps.ID
FROM
CONTENT_PERM_SET scps
WHERE
scps.CONTENT_ID = cps.CONTENT_ID
AND
scps.CONT_PERM_TYPE = cp.CP_TYPE)
AS
suggested_cps_id
FROM
CONTENT_PERM cp, CONTENT_PERM_SET cps
FROM
CONTENT_PERM cp1, CONTENT_PERM_SET cps1, CONTENT_PERM cp2, CONTENT_PERM_SET cps2
WHERE
cp1.CPS_ID = cps1.ID
AND
cp2.CPS_ID = cps2.ID
AND
cp1.CP_TYPE = cp2.CP_TYPE
AND
FROM
CONTENT_PERM cp1, CONTENT_PERM_SET cps1, CONTENT_PERM cp2, CONTENT_PERM_SET cps2
WHERE
cp1.CPS_ID = cps1.ID
AND
cp2.CPS_ID = cps2.ID
AND
cp1.CP_TYPE = cp2.CP_TYPE
AND
SELECT
*
FROM
CONTENT_PERM_SET
WHERE
ID
NOT
IN
(
SELECT
DISTINCT
CPS_ID
FROM
CONTENT_PERM);
|
刪除全部找到的記錄,而後嘗試從新導出。eclipse
https://www.cwiki.us/display/CONFLUENCEWIKI/Troubleshooting+XML+backups+that+fail+on+restorespa