Reset and Compact NuGet package database


Nexus Repository Manager 2.x stores NuGet package metadata information and NuGet API Keys in a single h2 database. 

Sometimes resetting the NuGet package metadata may be required to solve a performance issue identified by Sonatype Support.

How to reset the Nexus 2.x NuGet database


  1. Schedule downtime for repository manager
    Modifications to the database must be performed when no other process has the database file open and Nexus is stopped. Scheduled tasks will need to complete after Nexus is restarted in order for hosted NuGet packages to be available.
  2. Locate your Nexus 2.x application directory
  3. Locate your Nexus 2.x work directory
  4. Download this bash script to the host where Nexus 2.x is running. Examine the source and make it executable by the operating system user account that owns the repository manager process.


  1. Stop Nexus.
  2. Execute the bash script as the operating system user account that would own the Nexus Repository Manager process. This ensures file permissions are not changed.
  3. Make sure no error in "<Nexus 2.x work directory>/nuget/odata.trace.db" file.
  4. Start Nexus.
  5. Important: Run a Rebuild NuGet Feed task against each NuGet hosted repository, one at a time. NuGet hosted repository package retrieval will not work until this is complete.
  6. Verify the NuGet API keys are still valid and your NuGet performance issue is resolved.



Have more questions? Submit a request


Article is closed for comments.