[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-admin
Subject:    Re: [ADMIN] Import & Export DB table structure with data
From:       Luan Huynh <nnhluan () gmail ! com>
Date:       2017-07-19 8:00:51
Message-ID: CAAP3KKE7r=o_zTMcWiaFd9UeOG-QT9yp53Z573ub-f949-uORA () mail ! gmail ! com
[Download RAW message or body]

Please take a look at: pg_dump
<https://www.postgresql.org/docs/9.6/static/app-pgdump.html> , pg_restore
<https://www.postgresql.org/docs/9.6/static/app-pgrestore.html>

*For example*:

*pg_dump  -h localhost -p 5432 -U postgres  --format custom --no-password
 --encoding UTF8  --no-security-labels --no-tablespaces  --verbose
--table=public.sstb_account --file sstb_account.backup --schema public
postgres *


*pg_restore  -h localhost -p 5432 -U postgres --dbname=new_database
--role=postgres  --format custom --no-tablespaces --schema=public --verbose
sstb_account.backup*

On Wed, Jul 19, 2017 at 2:18 PM, Ashwani Kumar B <
ashwani.b.kumar@ericsson.com> wrote:

> Hi vinny
>
> Please give me syntax for PG_Dump
>
> Regards
> Ashwani
>
> -----Original Message-----
> From: vinny [mailto:vinny@xs4all.nl]
> Sent: Wednesday, July 19, 2017 12:47 PM
> To: Ashwani Kumar B
> Cc: pgsql-performance-owner@postgresql.org; pgsql-sql-owner@postgresql.org;
> pgsql-admin@postgresql.org; pgsql-admin-owner@postgresql.org
> Subject: Re: [ADMIN] Import & Export DB table structure with data
>
> On 2017-07-19 07:55, Ashwani Kumar B wrote:
> > Hi
> >
> > I have to import table structure from one DB  and create the same
> > table structure in another DB.
> >
> > Secondly I have to copy all the data from one DB to another DB
> >
> > Kindly suggest way forward.
> >
> > Regards
> >
> > Ashwani
>
> If both databases are PostgreSQL then you can just use pg_dump.
>
> If the databases are of different brands then you may need special tool,
> there are many conversion tools available, but not all free or inexpensive.
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

[Attachment #3 (text/html)]

<div dir="ltr">Please take a look at:  <a \
href="https://www.postgresql.org/docs/9.6/static/app-pgdump.html">pg_dump</a>  ,  <a \
href="https://www.postgresql.org/docs/9.6/static/app-pgrestore.html">pg_restore</a>  \
<div><u><br></u></div><div><u>For \
example</u>:</div><div><i><br></i></div><div><i>pg_dump   -h localhost -p 5432 -U \
postgres   --format custom --no-password   --encoding UTF8   --no-security-labels \
--no-tablespaces   --verbose --table=public.sstb_account --file sstb_account.backup \
--schema public postgres  </i><br></div><div><i><br></i></div><div><i>pg_restore   -h \
localhost -p 5432 -U postgres --dbname=new_database --role=postgres   --format custom \
--no-tablespaces --schema=public --verbose \
sstb_account.backup<br></i></div></div><div class="gmail_extra"><br><div \
class="gmail_quote">On Wed, Jul 19, 2017 at 2:18 PM, Ashwani Kumar B <span \
dir="ltr">&lt;<a href="mailto:ashwani.b.kumar@ericsson.com" \
target="_blank">ashwani.b.kumar@ericsson.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Hi vinny<br> <br>
Please give me syntax for PG_Dump<br>
<br>
Regards<br>
<span class="HOEnZb"><font color="#888888">Ashwani<br>
</font></span><span class="im HOEnZb"><br>
-----Original Message-----<br>
From: vinny [mailto:<a href="mailto:vinny@xs4all.nl">vinny@xs4all.nl</a>]<br>
Sent: Wednesday, July 19, 2017 12:47 PM<br>
To: Ashwani Kumar B<br>
Cc: <a href="mailto:pgsql-performance-owner@postgresql.org">pgsql-performance-owner@<wbr>postgresql.org</a>; \
<a href="mailto:pgsql-sql-owner@postgresql.org">pgsql-sql-owner@postgresql.org</a><wbr>; \
<a href="mailto:pgsql-admin@postgresql.org">pgsql-admin@postgresql.org</a>; <a \
href="mailto:pgsql-admin-owner@postgresql.org">pgsql-admin-owner@postgresql.<wbr>org</a><br>
                
Subject: Re: [ADMIN] Import &amp; Export DB table structure with data<br>
<br>
</span><div class="HOEnZb"><div class="h5">On 2017-07-19 07:55, Ashwani Kumar B \
wrote:<br> &gt; Hi<br>
&gt;<br>
&gt; I have to import table structure from one DB   and create the same<br>
&gt; table structure in another DB.<br>
&gt;<br>
&gt; Secondly I have to copy all the data from one DB to another DB<br>
&gt;<br>
&gt; Kindly suggest way forward.<br>
&gt;<br>
&gt; Regards<br>
&gt;<br>
&gt; Ashwani<br>
<br>
If both databases are PostgreSQL then you can just use pg_dump.<br>
<br>
If the databases are of different brands then you may need special tool, there are \
many conversion tools available, but not all free or inexpensive.<br> <br>
<br>
--<br>
Sent via pgsql-admin mailing list (<a \
href="mailto:pgsql-admin@postgresql.org">pgsql-admin@postgresql.org</a>)<br> To make \
changes to your subscription:<br> <a \
href="http://www.postgresql.org/mailpref/pgsql-admin" rel="noreferrer" \
target="_blank">http://www.postgresql.org/<wbr>mailpref/pgsql-admin</a><br> \
</div></div></blockquote></div><br></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic