Summary
Nexus Repository 2 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 Repository 2 NuGet database
Prepare
-
Schedule downtime for the Repository
Modifications to the database must be performed when no other process has the database file open and the server is stopped. Scheduled tasks will need to complete after the server is restarted in order for hosted NuGet packages to be available. - Locate your Nexus Repository 2 application directory
- Locate your Nexus Repository 2 work directory
- Download this bash script to the host where the server is running. Examine the source and make it executable by the operating system user account that owns the server process.
Perform
- Stop Nexus Repository 2.
- Execute the bash script as the operating system user account that would own the server process. This ensures file permissions are not changed.
- Make sure no error in "<Nexus Repository 2 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.