pg_dump executed via windows command prompt

Asked

Viewed 2,741 times

1

I executed a dump with the following script:

C:\Arquivos de Programas\postgresql\10\bin>pg_dump.exe -h xxx.xxx.xxx.xxx -p 5432 -U postgres -W postgres
Senha:...

-- PostgreSQL database dump
--

-- Dumped from database version 10.1
-- Dumped by pg_dump version 10.1

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: postgres; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON DATABASE postgres IS 'default administrative connection database';


--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


--
-- Name: adminpack; Type: EXTENSION; Schema: -; Owner:
--

CREATE EXTENSION IF NOT EXISTS adminpack WITH SCHEMA pg_catalog;


--
-- Name: EXTENSION adminpack; Type: COMMENT; Schema: -; Owner:
--

COMMENT ON EXTENSION adminpack IS 'administrative functions for PostgreSQL';


--
-- PostgreSQL database dump complete
--

My question is, if the backup has been run, where is the file?

1 answer

2


You didn’t inform the parameter -f specifying the file, the dump was only displayed at the prompt, and not saved.

The correct command would be:

C:\Arquivos de Programas\postgresql\10\bin>pg_dump.exe -h xxx.xxx.xxx.xxx -p 5432 -U postgres -f C:\backup\meudump.dump database_nome

There’s an answer from me here: /a/250074/69359 showing how to dump.

Documentation of pg_dump: https://www.postgresql.org/docs/9.3/static/app-pgdump.html

  • Thanks, I made it! I saved by adding ". sql" to the end of "-f". This file generated by the dump, I can load it in Mysql to model the tables by Workbench?

  • is a postgresql dump file, so the commands present in it are specific to a postgres base. It certainly won’t work. Don’t forget to mark it as an answer

  • mark as response?

  • There’s a V just below the response vote, which you mark which one solved your problem. Take the tour to see how the community works: https://answall.com/tour

Browser other questions tagged

You are not signed in. Login or sign up in order to post.