I want to use another wallet.dat file with bitcoin-qt. Is this possible? my situation is the following: I have a laptop with not much space on disk and therefore using bitcoin on a stick (I start bitcoin-qt with the argument "-datadir=location/to/stick). Now I wanted to transfer some bitcoins from my mobile phone to that account. Accidentaly I typed in a wrong directory (which doesnt exist) and bitcoin-qt lead me to the standard bitcoin directory (which is ~/.bitcoin). I didn't realize this and transferred the bitcoins to that address.

Now I would like to change the wallet.dat file from the ~/.bitcoin/ directory with the wallet.dat file from the directory on my stick, because my stick has all the blockchain already loaded. Is this possible?

What I have tried so far:


simply changing the wallet.dat files: when I now start bitcoin-qt it goes in a very very long loop (probably even an endless-loop). It just says "Dursuche erneut..." (german), what means translated: "Researching..."
doing the above, but with the additional argument "-rescan" ("bitcoin-qt -rescan -datadir=/location/of/stick"): it happens the same as above
trying to backup the relevant wallet.dat file inside the console of bitcoin-qt: when trying to back it up i get the error: "Error: Wallet backup failed! (code: -4)"


Can someone help me with this problem? Thanks in advance!

Edit: I wanted to rewrite my problem in another (probably easier understandable) way: I would like to overwrite the wallet.dat file inside the ~/.bitcoin/ folder. But doing so, bitcoin-qt doesnt stop loading (it just says "Researching...". Is there another way to do what I want?
You're on the right track -- in fact you're already using the correct command line switch, which is "-rescan".  But your mistake is thinking this is a quick solution.  It's not.  Rescanning the blockchain will take hours, depending on your processor speed.

This is a task you'll want to leave running overnight.  If the problem persists even then, record the error message you get once the rescanning has completed, and ask another question with that error message.

Your next option would probably be to actually transfer the Bitcoins using a tool like pywallet, but I'd wait until you've left this rescanning overnight before you try that, and seek guidance on how to use pywallet.