Removing corrupt environment without losing database data?

OK, I'm using Berkeley DB 4.3.28, Java API with no transactions or concurrency. We have several environments with multiple databases under them. Occasionally the environment gets corrupted. The original coder didn't understand this had to be coded for, so I'm trying to fix that.
Normally, all database environments are opened with the following settings:
setErrorPrefix(prefix);
setPanicHandler(new EmsPanicHandler(prefix));
setJoinEnvironment(true);
I've recreated the environment corruption and used the following code to remove and recreate the environment (as suggested here: http://www.oracle.com/technology/documentation/berkeley-db/db/ref/cam/fail.html)
          EnvironmentConfig env_config = new EmsEnvironmentConfig("CleanEnvironment");
          env_config.setAllowCreate(true);
                env_config.setErrorPrefix("string");
                env_config.setPanicHandler(new MyPanicHandler());
          Environment m_env_handle = null;
        try {
             File m_file = new File(environment);
             if (!m_file.exists())
                  System.err.println("Environment "+environment+" does not exist. Skipping");
                  return;
             System.out.println("Attempting to remove environment "+environment+" with recovery enabled");
              //m_env_handle = new Environment(m_file, env_config);
             Environment.remove(m_file, true, env_config);
             System.out.println("Attempting to recreate environment");
             m_env_handle = new Environment(m_file, env_config);
        } catch (Throwable t) {
            System.err.println("Exception trying to recover environment "+environment+": "+t.getLocalizedMessage());
        finally
             if (m_env_handle != null)
                  System.out.println("Closing environment "+environment);
                  try {
                       m_env_handle.close();
                       System.out.println("Environment "+environment+" closed successfully");
                  catch (Exception e)
                       System.err.println("Exception trying to close environment "+environment+": "+e.getLocalizedMessage());
        }This removes and recreates the environment without giving me an error message and apparently without touching any of the underlying databases.
Unfortunately, when I try using a database in the environment again, I can open the environment, but I get this error when trying to open the database:
java.lang.IllegalArgumentException: Invalid argument
        at com.sleepycat.db.internal.db_javaJNI.Db_open(Native Method)
        at com.sleepycat.db.internal.Db.open(Db.java:329)
        at com.sleepycat.db.DatabaseConfig.openDatabase(DatabaseConfig.java:478)
        at com.sleepycat.db.Environment.openDatabase(Environment.java:81)
        at com.nmss.db.berkeleydb.Name_Address_Map.open(Name_Address_Map.java:358)
        at com.nmss.db.berkeleydb.Name_Address_Map.retrieveAddress(Name_Address_Map.java:296)
        at com.nmss.framework.inventory.Command.add(Command.java:269)
        at com.nmss.framework.inventory.Command.processArgs(Command.java:59)
        at com.nmss.framework.inventory.Command.<init>(Command.java:39)
        at com.nmss.framework.inventory.Command.main(Command.java:483)The Environment config is the same one I posted at the start of the message:
setErrorPrefix(prefix);
setPanicHandler(new MyPanicHandler(prefix));
setJoinEnvironment(true);
The Database config is:
DatabaseConfig db_config = new DatabaseConfig();
db_config.setType(DatabaseType.BTREE);
db_config.setAllowCreate(true);
Can anyone tell why I would be getting this error? Or does removing the environment simply invalidate any database files that were underneath it?
db_verify used against the database returns 0.
Thanks,
Mike
Message was edited by:
msully
Message was edited by:
msully

So the latest - I totally removed my old databases and rebuilt my app, with the following environment config:
        setErrorPrefix(prefix.toUpperCase());
        setPanicHandler(new EmsPanicHandler(prefix));
        setInitializeCache(true);
        setTransactional(true);
        setInitializeLogging(true);
        setInitializeLocking(true);
        setAllowCreate(true);Now I am getting the error:
/var/tmp: no base system shared memory ID specified
java.lang.IllegalArgumentException: Invalid argument
        at com.sleepycat.db.internal.db_javaJNI.DbEnv_open(Native Method)
        at com.sleepycat.db.internal.DbEnv.open(DbEnv.java:235)
        at com.sleepycat.db.EnvironmentConfig.openEnvironment(EnvironmentConfig.java:714)
        at com.sleepycat.db.Environment.<init>(Environment.java:30)
        at com.nmss.db.berkeleydb.LogHandler.getEnvironment(LogHandler.java:226)
        at com.nmss.db.berkeleydb.LogHandler.open(LogHandler.java:197)
        at com.nmss.db.berkeleydb.LogHandler.store(LogHandler.java:235)
        at com.nmss.util.LogHandlerImpl.publish(LogHandlerImpl.java:45)
        at java.util.logging.Logger.log(Logger.java:452)
        at java.util.logging.Logger.doLog(Logger.java:474)
        at java.util.logging.Logger.logp(Logger.java:590)
        at com.nmss.util.Logger.log(Logger.java:87)
        at com.nmss.framework.inventory.Command.add(Command.java:306)
        at com.nmss.framework.inventory.Command.processArgs(Command.java:59)
        at com.nmss.framework.inventory.Command.<init>(Command.java:39)
        at com.nmss.framework.inventory.Command.main(Command.java:483)

Similar Messages

  • Any way to repair a corrupt ipod without losing data?

    I've only had my ipod nano a few months and apparently for some reason it has now corrupted, meaning that I have to restore it and thereby lose all my songs. Does anyone know of any way that I can fix this problem without losing the data? Or can anyone recommend a service provider that can help?

    You don't say which OS your iPod was formatted on. It may not be a hopeless situation if the iPod is recognized as a removeable drive in (say) Windows Explorer.

  • HT3728 My Time Capsule is working fine with ethernet connection, but it is no longer working with wifi, probably because of my wrong setting; is there a way to reset wifi setting without losing backuped data? Thanks you all

    y Time Capsule is working fine with ethernet connection, but it is no longer working with wifi, probably because of my wrong setting; is there a way to reset wifi setting without losing backuped data? Thanks you all

    Giancarlo Messalli wrote:
    1) are you sure a reset holding the reset button will not delete my data?
    Absolutely sure.. There is no connection at all.. reset is only the router side of the TC.
    For the hard disk to be erased you need to access the airport utility disk page.. request erase and confirm the operation.
    2) I can access to time capsule by ethernet but I am not able to input the corret setting by myself
    Thank you again
    I am uncertain why if you have access you cannot change settings.. but that is why you reset things so any of those problems should be fixed.
    Here is the Apple info on reset.
    http://support.apple.com/kb/ht3728
    And here is the quote from the horse's mouth so to speak.
    Factory default reset: Perform this reset if you wish to repurpose the AirPort Base Station or Time Capsule and want to remove all personal profiles and settings first. This reset resets the device to its state when you first purchased it. Data stored on internal or external hard drives connected to the device will not be erased. If you choose, you may manually erase the hard drive using AirPort Utility.

  • Migration from PC to Mac without losing application data (savegames etc.)

    Hello everyone,
    I am migrating from from my old Windows PC onto a MacBook Pro, and I'm having difficulties with iTunes and my iOS devices (iPhone 4, iPad 1). Maybe someone here can help me out, I'd be ever so grateful.
    I set up iTunes on my MBP yesterday and logged in to my account. I replaced the empty iTunes Media folder with my old one (which contains all my music, videos and applications) via an external hard drive.
    First problem: it wouldn't import these files into my new library automatically. Just showed me an empty library I think I imported the entire iTunes Media folder manually yesterday via "Add to folder". The status right now (after some experimentation) is old iTunes Media folder copied, but nothing imported (that is, I have an empty library).
    When I connected my iPhone and tried to synch, I first had to authorize the MacBook for the iPhone. So far, so good. However when I tried to synch iTunes warned me that if I synch, all data on the iPhone will be removed and replaced by the data from my new local library (which is, of couse a copy of my old library, but doesn't store application data like savegames).
    I tried to do it via "transfer purchased items from iPhone", which took forever, but yielded the same result: a warning that all data on the iPhone would be erased.
    So the question is: How do I connect my iPhone and iPad to iTunes on my new Mac without losing application data like settings and savegames? And why is this so complicated and intransparent? I should be able to just copy my media, say "authorize this Computer, then add iPhone to the registered devices" and then proceed like nothing ever changed.
    I searched the net until three in the morning yesterday, but couldn't find anything that sounded safe enough to give it a try.
    Thanks in advance and best Regards,
    Nate
    PS: I do have the backup-folders from my old PC on a USB stick - are those going to help?
    Message was edited by: Nathan1980 (Correction)
    Message was edited by: Nathan1980

    I was fighting this battle the past few days myself; but actually it is REALLY easy now. See here:
    http://www.macworld.com/article/146958/2010/03/moveitunes_windowsmac.html
    Then, once iTunes was on the Mac, I did this:
    1. On the Mac rename ...\iTunes\iTunes Library.itl as ...\iTunes\iTunes Library
    2. On the Mac delete ...\iTunes\iTunes Library Genius.itdb (Apparently the PC & Mac versions are not compatible - iTunes will just rebuild it later)
    3. Launch iTunes and immediately press & hold down the Option key until a dialog opens asking you to Choose a library. Navigate to the folder/drive you've copied from the PC and open ...\iTunes\iTunes Library.
    (thanks to turingtest2 for the above steps)
    That was it. Did it yesterday evening. All playlists, libraries, everything copied fine. No problems; no broken links. Perfect.

  • Delete iTunes duplicates songs without losing playlist data?

    i  have double tripped dupulicated songs  in my itunes ... how can i get rikd of  them and keep one song each.  but without losing playlist data?  which means my many playlist  are stay same without losing any songs..
    possible?
    this is furstarating   please someone help?
    thank you!!

    i have like 35-40 playlist..  could u explain to me how to do it simple way and  not losing sings from each playlist.. i know removing duplicate songs from entire library is great but i  dont want to lose songs from each playlist..
    could u help? thank you

  • How can I re-install firefox without losing my data. It is Infested with ADS BY bame.

    Firefox is infested with "Ads by name".
    How can I get rid of it or how can I
    Re-Install firefox without losing any data?

    Couple other suggestions:
    Open the Windows '''Control Panel''', Add/Remove Programs. After the list loads, click the "Installed on" column heading to group the infections, I mean, additions, by date. This can help surface innocent sounding bundle items that snuck in with some software you agreed to install. Take out as much trash as possible here.
    Also, could you check whether Firefox has a non-standard '''connection setting'''? You can do that here:
    "3-bar" menu button (or Tools menu) > Options > Advanced > Network mini-tab > "Settings" button
    The default "Use system proxy settings" should piggyback on your Windows/IE "LAN" settings. But you can try "No proxy" to see whether that makes any difference.
    Finally, our support article [[Troubleshoot Firefox issues caused by malware]] lists '''cleaning tools''' other Firefox users have found useful. These on-demand scanners are free and take considerable time to run. If they finish quickly and especially if they require payment, you may have a serious infection. I suggest the specialized forums listed in the article in that case.
    Success?

  • How do you stop an update on Pages without losing your data?

    how do you stop an update on Pages without losing your data? i've connected my ipad to my phone's internet network through tethering. it's been ages already. but Pages is still not fully updated and i just wanna stop it anyway without losing my work inside...can anyone please shed light on this? i'd be absolutely certainty definitely grateful!!!!!!!!!!!!!!!!

    You can try pausing the download by tapping on the Pages icon, but you may not be able to use Pages until the update completes. I don't know that for sure, but I wouldn't want to take the chance on corrupting the app and maybe the files.

  • Can I use two different devices with different apple ID for backing up data on one machine without losing any data that was backed up with one device earlier?

    Can I use two different devices with different apple ID for backing up data on one machine without losing any data that was backed up with one device earlier?

    The link is to a discussion started on 12/18 in the FiOS Internet forum.  Here's the link I get now, however it is different than the link I pulled a few hours ago.  If this system changes the link again, it may not work.
    http://forums.verizon.com/t5/FiOS-Internet/Frustration-and-just-confused-with-internet-help-please/t...
    You can also look for the topic, "frustration and just confused" in the FiOS Internet forum.
    Here's a link that is in the thread that gives more detail.
    https://secure.dslreports.com/faq/15984
    Good Luck!
    P.S.  "Copper Contributor" is my "rank."  gs0b is my user name.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.

  • Can I upgrade from snow leopard to mountain lion without losing my data?

    Have finished an upgrade to snow leopard without losing any data on each of 9 MacBook Pros so far.  (Have 9 more to go) Can I do the mountain lion upgrade on them without losing data or must I back up the detritus of 4 years use by teachers who despite all pleas have never backed up their documents?  Would appreciate a swift reply as everyone wants their mbp's back in their hands on Monday morning. My thanks in advance to any gurus who care to reply as my local gurus seem to have fled the ashram for the weekend.

    Installing a new version of OS X should not lead to any data loss. Of course, it's best to have a backup if anything 'goes wrong' but simply isntalling the new OS shouldn't damage any data.
    Clinton

  • My iPod dispalys this message: "Connect to a computer. Use iTunes to restore."  When I connect to a computer, iTunes doesn't recognise it.  The iPod 5th Gen does not work at all. How do I fix my iPod without losing any data?

    My iPod dispalys this message:
    "Connect to a computer. Use iTunes to restore."  When I connect to a computer, iTunes doesn't recognise it.  The iPod 5th Gen does not work at all. How do I fix my iPod without losing any data?
    I have seen the Apple webpage suggesting the "five R's" (including restore).  Before doing anything, I want to be sure that restoring or any other action is not going to delete or risk my data. 
    I would be very grateful if anyone can suggest a fix for this problem, in a way that will not risk my data. 
    Thanks in advance!

    Did you try a hard reset with the iPod still connected to your PC?  Have you tried multiple USB ports, preferably high powered USB 2.0 ports?
    To do a hard reset, first make sure the hold switch is in the Off position, then press and hold both the Select (Center) and Menu buttons together long enough for the Apple logo to appear.
    Have you also worked through each and every single troubleshooting suggestion in this Apple support document?
    iPod not recognized in 'My Computer' and in iTunes for Windows
    B-rock

  • My computer crashed.    How do I sync with a new computer without losing unsaved data?

    My computer crashed.    How do I sync with a new computer without losing unsaved data?

    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    For items you cannot get the above way use a third-party utility such as Phone to PC

  • I got a new computer and need to sync my iPhone and iPad on it, how do i do that without losing all data.

    I got a new computer and need to sync my iPhone and ipad on it, how do i do that without losing all data. I need help ASAP!

    If you still have the old computer see: http://support.apple.com/kb/HT4527
    If you don't have your old computer, but you made regular backups of it, restore the most recent backup using the backup software that you used to make the backup. You will have to read the instructions for it.
    If you don't have your old computer and you did not back it up regularly see: Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • How can i transfer my whatsapp chat from iphone 3gs to google nexus 5 without losing any data?

    How can i transfer my whatsapp chat from iphone 3gs to google nexus 5 without losing any data? I want to swtich from my iphone to google nexus 5.could anyone help me for this?

    steve359 wrote:
    Please pardon the intrusion…
    Hi, FoxFifth!
    Congratulations on advancing to Level 6!
    At the Water Cooler in the Level 6 Lounge, we are preparing your welcome. Would you care to join us at the Water Cooler?
    On the Discussions Home Page (https://discussions.apple.com/welcome), down at the bottom, you will, hopefully, soon find the Lounge link available to you. It should show up for you within the next 24 hours if all goes as it should.
    Hope to see you there soon!
    Thanks! I'll check that out as soon as it becomes available.

  • I forgot my password, and i want to unlock it without losing my data, can anyone help plz???

    i forgot my password, and i want to unlock it without losing my data, can anyone help plz???

    You can't. It is a good security feature. You have to connect the iPod to yur computer and restore via iTunes.

  • How can you delete an app without losing saved data/progress?

    How can you delete an app without losing saved data/progress? Is there a way through iCloud? I have an 8gb 4th gen iPod touch. I have a lot of music, so with 8gb, space is limited. Some apps I have take up 20-30 MB. Some of these games I don't play that much, but I don't delete them because I have made a lot of progress (levels, scores, acheivements). It would be nice to delete some of these 30 MB apps that take up precious space, and them redownload them in the future when I have more space, but without having to start the whole game over.
    Also, I read somewhere that there might be a way to do this with iCloud, but I don't really know how.
    Thanks!

    This is the only way I know of.  It is messy though.
    How to transfer game saves between iOS devices, without iTunes, and without jailbreaking | TUAW - The Unofficial Apple Weblog

Maybe you are looking for

  • F-54 - Down PAyment clearing

    Hi All, Does anyone know about a BAPI or BDC or Function module  or any updation program for the F-54 transaction. Its urgent Thanks & Regards Susan

  • Print Preview is no longer working. Windows pops and then closes.

    The Print Preview function no longer works. Clicking Print Preview results in (1) a small window pops open in the middle of the screen then disappears (2) then a large window opens (to preview the content as it once did) (3) then the new windows disa

  • Just updated my itouch 1st gen to 3.1.2... now it won't sync music.

    So. I have a Asus computer with Windows 7. My itouch is a 1st generation and today i decided to upgrade it. However it took like 10 tries.. and 7 hrs. I got the apps on my itouch done and ready, however now it won't sync my pictures or my music. It s

  • This PostScript file was created from an encrypted PDF file.

    I have a postscript file which has been created from secure or encrypted (opening restriction) pdf. Now when i use distiller to convert this postscript file to pdf then distiller cannot produce a pdf file. The log file contains following text: This P

  • Tried to Cancel, Convenient​ly Dropped Call, Another RIDICULOUS Bill

    I called on June 19th to cancel my service. My line (which had no phone attached to it) kept calling 911 and directory assistance... My bill is normally $55, and ended up $190. The next bill was $119. So after being on the phone and sent to several d