Final Cut Pro automatically makes backups of your libraries as you go along.
We are going to take one of these backups.
1) Go to your Movies folder. Inside there is a Final Cut Backups folder, and inside that you should find a folder named after your problematic library. Inside this folder are the backups, with names that are timestamps. Something like this (in this example, "Batata" is the name of the library):
2) Copy the most recent backup to another location, and rename it in a meaningful way - say "Batata - New Generation".
3) Try to open this "Batata - New Generation". If things go well, it should open, and it should contain your events and projects, but the clips should appear offline. That is normal.
To restore the media, you have to tell us: Was the media stored inside the library, or outside?
If it is inside the library, we will need an extra step. If the media was stored outside the library, skip to step 5.
4)
In the Finder, locate the problematic library, control-click and choose Show Package Contents.
Open the Contents folder. Inside there are one folder for each event. Create a new folder somewhere else on the same drive - call it, say, "My media". COPY (do not move) all the event folders to this "My media" folder. It will be quick and not use double the space (due to a special technique called Copy on Write).
5) In FCP, select the "Batata - New Generation" library, and go to File->Relink Files->Original Media
Choose Missing or All (in this case, it should not matter), then click Locate. Navigate to the folder where your media is (that would be "My media" if you needed step 4). Then click Choose; and click Relink Files.
Done (we hope!)