Nexus OrientDB数据库变为只读 storage is switched to 'read only' mode

错误消息 :

2021-01-15 16:23:06,604+0800 ERROR [event-6-thread-1396 <command>sql.select from browse_node where asset_id=:asset_id limit 1</command>] yw com.orientechnologies.orient.core.storage.cache.local.OWOWCache - $ANSI{grean {db=security}}checksum verification failed for page '2' of 'browse_node_3.pcl'.
2021-01-15 16:23:06,627+0800 WARN  [qtp1067566931-4517] yw org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: PUT /repository/maven-deploy/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar.md5 com.orientechnologies.orient.core.exception.OPageIsBrokenException: Following files and pages are detected to be broken ['browse_node_3.pc]' :2;], storage is switched to 'read only' mode. Any modifycation operations are prohibited. To restore database and make it fully operational you may export and import database to and from JSON.
        DB name="security"
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.CheckLowDiskSpaceRequestsAndReadOnlyConditions(OAbstractpaginatedStorage.java:5144)
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commit(OAbstractPaginatedStorage.java:1729)
        at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:541)
        at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:99)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2908)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2870)
        at org.sonatype.nexus.repository.storage.StorageTxImpl.commit(StorageTxImpl.java:179)
        ...

解决步骤:

  • 停止nexus进程
    ./nexus stop

  • 备份变成只读模式的数据库 ,我这里是 security 数据库
    cp -rv /opt/nexus/sonatype-work/nexus3/db/security /backup/

  • 运行OrientDB 数据库客户端
    java -jar /opt/nexus-3.12.1-01/lib/support/nexus-orient-console.jar

  • 连接出错数据库
    orientdb> connect PLOCAL:/opt/sonatype-work/nexus3/db/security admin admin

  • 导出数据库
    orientdb {db=security}> EXPORT DATABASE /backup/orientdb-security.export

  • 断开与数据库security 的连接
    orientdb {db=security}> DISCONNECT

  • 删除出问题的库
    orientdb> DROP DATABASE PLOCAL:/opt/sonatype-work/nexus3/db/security admin admin

  • 重新创建出问题的库
    orientdb> CREATE DATABASE PLOCAL:/opt/sonatype-work/nexus3/db/security admin admin

  • 导入之前的备份
    orientdb {db=security}> IMPORT DATABASE /backup/orientdb-security.export.gz

  • 关闭数据库连接
    orientdb {db=security}> DISCONNECT

  • 退出数据库客户端
    orientdb> EXIT

原文地址:https://www.cnblogs.com/fejerry/p/15533859.html