Restoring database dump


#1

Hello, I’m trying to get a system in place for backing up and restoring a db through docker (cockroachdb version is v2.0.3). I was able to get the backup using cockroach dump (dump-mode=both), but can’t get it to restore. I’m using
docker exec [containerid] ./cockroach sql --insecure --database="db_new" < /path/to/backup.sql
(using db_new for testing, it is a blank database), but when I run it nothing happens and no error appears in the terminal. I heard updating db version could help, but this db is already live and I read updating the db version could cause issues with old data.

Thanks for your time, any help would be appreciated!


(Ron Arévalo) #2

Hey @Torey,

Happy to help! Could you provide some more clarification on what you mean when you say:

Also, where is the path/to/backup.sql located, is it on the host machine or the docker container?

As far as I am aware, there shouldn’t be any issues with upgrading, do you have any specific concerns? Upgrading to v2.1 would allow you to import data hosted on cloud storage by importing it using IMPORT PGDUMP. We have some documentation on how to do that here. We also have some documentation on upgrading—which you can read more about here.

Thanks,

Ron


#3

Hello, sorry for delay responding.

  1. When i run that command in the terminal, it just immediately finishes and waits for my next terminal command.
  2. it’s on the host machine; it does seem to see the file, as it will complain if i give it an incorrect path.
  3. As far as specific concerns I just remember reading that upgrading can cause issues data to not longer be read in correctly (although that might have been an old issue). That documentation on upgrading seems perfect for my case though (v2.0.x to most recent), so I’ll try that

(Ron Arévalo) #4

Hey @Torey,

Sounds good, let us know how the upgrade goes!

Thanks,

Ron