I'm a newbie and new to Postgresql. I'm following a tutorial online and after downloading and extracting the dvdrental.zip into dvdrental.tar . I changed directory to my postgres bin location. And tried to run
pg_restore -U postgres -d dvdrental '/Users/macbookair/Downloads/dvdrental/dvdrental.tar'
But I got this error:
pg_restore: [archiver (db)] connection to database "dvdrental" failed: FATAL: role "postgres" does not exist
Meanwhile my dvdrental database has a postgres role.
At first: you must create a database in SQL-Shell:
CREATE DATABASE newdvdrental;
look at first picture
Creating New DataBase
In the next step:
pg_restore --dbname=newdvdrental -U postgres --verbose C:\dvdrental\dvdrental.tar
look at second picture:
Restoring dvdrental.tar to new database
And by checking result in PgAdmin:
checking result
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With