How to transfer data from my production database to my intermediate database in the hero?

I am trying to transfer data from my production database to my intermediate database without success.

I follow the documentation for it: http://devcenter.heroku.com/articles/pgbackups#transfers

These are the commands that I followed ...

$ heroku addons:add pgbackups --remote staging $ heroku addons:add pgbackups --remote production $ heroku pgbackups:capture --remote production $ heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging 

And this is the message I get ...

 Usage: heroku pgbackups:restore [<DATABASE> [BACKUP_ID|BACKUP_URL]] restore a backup to a database if no DATABASE is specified, defaults to DATABASE_URL and latest backup if DATABASE is specified, but no BACKUP_ID, defaults to latest backup 

I seem to find something wrong, but I can’t understand.

I also tried the same command using the application name instead of the remote ...

 $ heroku pgbackups:restore DATABASE `heroku pgbackups:url --app myapp` --app myapp-staging 

But I get the same message without actually transmitting.

Any help is greatly appreciated.

+6
source share
2 answers

I don’t think you took it right. Always use --app instead of --remote

 $ heroku pgbackups:capture --app myapp $ heroku pgbackups:restore DATABASE `heroku pgbackups:url --app myapp` --app myapp-staging 
+11
source

Not sure Heroku has changed since they were published last January, but when I launched

 heroku pgbackups:restore DATABASE `heroku pgbackups:url --app myapp` --app myapp-staging 

I kept getting the error I just said

"Backup not found"

Despite the fact that when I ran the command on its own to get the url:

 heroku pgbackups:url --app myapp 

and then tried the url in the browser, that url was correct.

So instead, I just tried sending the copied / pasted URL to the command, for example:

 heroku pgbackups:restore DATABASE "http://urlgoeshere" --app myapp-staging 

I had to use DOUBLE quotes around the URL, not SINGLE. Otherwise, I got this error:

Invalid file name, directory name, or volume name. "Expires" is not recognized as an internal or external command, operating program, or batch file. "Signature" is not recognized as an internal or external command, operating program or batch file.

+4
source

Source: https://habr.com/ru/post/905661/


All Articles