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
- 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.
- Locate your Nexus 2.x application directory
- Locate your Nexus 2.x work directory
- 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.
- Stop Nexus.
- 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.
- Make sure no error in "<Nexus 2.x work directory>/nuget/odata.trace.db" file.
- Start Nexus.
- 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.
- Verify the NuGet API keys are still valid and your NuGet performance issue is resolved.