Confluence 6 針對 key "cp_" 或 "cps_"

若是你遇到了下面的錯誤信息,例如:數據庫

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 能夠被用來找到這個記錄。spa

SELECT * FROM CONTENT_PERM WHERE USERNAME IS NULL AND GROUPNAME IS NULL;插件

 

SELECT cp.ID, cp.CP_TYPE, cp.USERNAME, cp.GROUPNAME, cp.CPS_ID, cp.CREATOR,rest

cp.CREATIONDATE, cp.LASTMODIFIER, cp.LASTMODDATEcode

FROM CONTENT_PERM cpci

WHERE cp.USERNAME IS NOT NULL AND cp.GROUPNAME IS NOT NULL;get

 

SELECT cps1.ID, cps1.CONTENT_ID, cps1.CONT_PERM_TYPE FROM CONTENT_PERM_SET cps1, CONTENT_PERM_SET cps2it

WHERE cps1.ID <> cps2.ID ANDio

cps1.CONTENT_ID = cps2.CONTENT_ID ANDtable

cps1.CONT_PERM_TYPE = cps2.CONT_PERM_TYPE

ORDER BY cps1.CONTENT_ID, cps1.CONT_PERM_TYPE, cps1.CREATIONDATE ASC;

 

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

WHERE cp.CPS_ID = cps.ID AND

cp.CP_TYPE <> cps.CONT_PERM_TYPE;

 

SELECT DISTINCT cp1.ID, cp1.CP_TYPE, cp1.USERNAME, cp1.GROUPNAME, cp1.CPS_ID,

cp1.CREATOR, cp1.CREATIONDATE, cp1.LASTMODIFIER, cp1.LASTMODDATE

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.ID <> cp2.ID AND

cps1.CONTENT_ID = cps2.CONTENT_ID AND

cp1.CP_TYPE = cp2.CP_TYPE AND

cp1.USERNAME = cp2.USERNAME

ORDER BY cp1.CPS_ID, cp1.CP_TYPE, cp1.USERNAME, cp1.CREATIONDATE;

 

SELECT DISTINCT cp1.ID, cp1.CP_TYPE, cp1.USERNAME, cp1.GROUPNAME, cp1.CPS_ID,

cp1.CREATOR, cp1.CREATIONDATE, cp1.LASTMODIFIER, cp1.LASTMODDATE

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.ID <> cp2.ID AND

cps1.CONTENT_ID = cps2.CONTENT_ID AND

cp1.CP_TYPE = cp2.CP_TYPE AND

cp1.GROUPNAME = cp2.GROUPNAME

ORDER BY cp1.CPS_ID, cp1.CP_TYPE, cp1.GROUPNAME, cp1.CREATIONDATE;

 

SELECT * FROM CONTENT_PERM_SET

WHERE ID NOT IN (SELECT DISTINCT CPS_ID FROM CONTENT_PERM);

刪除全部找到的記錄,而後嘗試從新導出。

 

https://www.cwiki.us/display/CONFLUENCEWIKI/Troubleshooting+XML+backups+that+fail+on+restore

相關文章
相關標籤/搜索