Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Shadow
Jun 25, 2002
Forgive any ignorance as my backround in SQL is strongly in MSSQL and mySQL and I'm no longer an active developer (5 years~)

I have a SQL Server backup that I am trying to restore onto my Mac. I have Postgres installed and running and grabbed Postico for a GUI to connect to it so I could run some queries and populate an excel file. I'm having a lot of trouble figuring out how to restore the backup (been all over this: http://www.postgresql.org/docs/9.1/static/backup-dump.html#BACKUP-DUMP-RESTORE with no luck :()




I also tried the pg_restore command and had no luck.

Then I tried it here in Postico


Along with the CREATE but backup didn't work either...


Again forgive my ignorance. I did LAMP development with mySQL way back in 2001-2004, then moved into the .NET and MS SQL world. Doing this poo poo on a mac is silly enough but with postgres I'm just in completely unfamiliar territory. :(

Thanks in advance.

Adbot
ADBOT LOVES YOU

wash bucket
Feb 21, 2006

If the backup was made using pg_dump you'll have to manually recreate the users/roles and a blank database first and then restore with this command:
code:
psql dbname < file.backup
If it was made with pg_dumpall then all that stuff is already in there so you can retore to a fresh postgres install with this command:
code:
psql -f file.backup postgres
Also, for GUI stuff try PGAdmin. You can even try restoring with PGAdmin if you like.

wash bucket fucked around with this message at 21:10 on Apr 14, 2016

Shadow
Jun 25, 2002

McCracAttack posted:

If the backup was made using pg_dump you'll have to manually recreate the users/roles and a blank database first and then restore with this command:
code:
psql dbname < file.backup
If it was made with pg_dumpall then all that stuff is already in there so you can retore to a fresh postgres install with this command:
code:
psql -f file.backup postgres
Also, for GUI stuff try PGAdmin. You can even try restoring with PGAdmin if you like.

The backup was made from a SQL Server database and the .bak file was given to me. Is there a way to convert or map/migrate?

wash bucket
Feb 21, 2006

Shadow posted:

The backup was made from a SQL Server database and the .bak file was given to me. Is there a way to convert or map/migrate?

Sorry, I only know about backing up from and restoring to postgres. Might be possible but I can't say for sure. Good luck with it.

Edit: You might find a lead here.

Shadow
Jun 25, 2002
I might try that approach but I was able to get someone (ahem) to spin up a SQL Server instance and give me access to it. For my immediate purposes, this is going to solve the issue, but for my education, I'll try to remember to see if your suggestion works to be a good SHSC citizen! :eng101:

Adbot
ADBOT LOVES YOU

Lasalas
Feb 26, 2005
pg_restore is a UNIX terminal command, not an SQL statement keyword. Try running that same line in the terminal of the server you have the database on.

  • Locked thread