<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Migrate table data &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/migrate-table-data/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Fri, 14 Apr 2017 20:47:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>PostgreSQL: Use pg_dump &#124; SSH &#124; psql, Copy Table data from a Server to another Server</title>
		<link>https://www.dbrnd.com/2017/04/postgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server/</link>
					<comments>https://www.dbrnd.com/2017/04/postgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 24 Apr 2017 16:16:47 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Migrate table data]]></category>
		<category><![CDATA[pg_dump]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[psql]]></category>
		<category><![CDATA[SSH]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5065</guid>

					<description><![CDATA[The migration of data and tables between the server are a very common task for Database Administrator. In this post, I am sharing few options to migrate your data between servers such a way that you do not require to create any additional table backup file. Using pg_dump, SSH and PSQL, you can directly copy [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fpostgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server%2F&amp;linkname=PostgreSQL%3A%20Use%20pg_dump%20%7C%20SSH%20%7C%20psql%2C%20Copy%20Table%20data%20from%20a%20Server%20to%20another%20Server" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fpostgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server%2F&amp;linkname=PostgreSQL%3A%20Use%20pg_dump%20%7C%20SSH%20%7C%20psql%2C%20Copy%20Table%20data%20from%20a%20Server%20to%20another%20Server" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fpostgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server%2F&amp;linkname=PostgreSQL%3A%20Use%20pg_dump%20%7C%20SSH%20%7C%20psql%2C%20Copy%20Table%20data%20from%20a%20Server%20to%20another%20Server" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fpostgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server%2F&amp;linkname=PostgreSQL%3A%20Use%20pg_dump%20%7C%20SSH%20%7C%20psql%2C%20Copy%20Table%20data%20from%20a%20Server%20to%20another%20Server" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fpostgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server%2F&amp;linkname=PostgreSQL%3A%20Use%20pg_dump%20%7C%20SSH%20%7C%20psql%2C%20Copy%20Table%20data%20from%20a%20Server%20to%20another%20Server" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fpostgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server%2F&amp;linkname=PostgreSQL%3A%20Use%20pg_dump%20%7C%20SSH%20%7C%20psql%2C%20Copy%20Table%20data%20from%20a%20Server%20to%20another%20Server" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fpostgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server%2F&#038;title=PostgreSQL%3A%20Use%20pg_dump%20%7C%20SSH%20%7C%20psql%2C%20Copy%20Table%20data%20from%20a%20Server%20to%20another%20Server" data-a2a-url="https://www.dbrnd.com/2017/04/postgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server/" data-a2a-title="PostgreSQL: Use pg_dump | SSH | psql, Copy Table data from a Server to another Server"></a></p><p>The migration of data and tables between the server are a very common task for Database Administrator.</p>
<p>In this post, I am sharing few options to migrate your data between servers such a way that you do not require to create any additional table backup file.</p>
<p>Using pg_dump, SSH and PSQL, you can directly copy your table data from one server to another server.</p>
<blockquote><p>Recently, I had taken PostgreSQL DBA interview and asked question like &#8220;How to migrate table data from one server to another in PostgreSQL?&#8221;</p>
<p>A candidate said, create table backup file using pg_dump -&gt; copy that file in source server -&gt; use pg_restore to restore it.<br />
Don&#8217;t you think, so that above process is very long? Check the below few options, and you can migrate your data without any table backup file.</p></blockquote>
<p><strong>My Destination information:</strong></p>
<ul>
<li>Host: pgtest1.dbrnd.com</li>
<li>Table: public.tbl_stud</li>
<li>User: anvesh</li>
<li>Database: Students</li>
</ul>
<p><strong>My Source information:</strong></p>
<ul>
<li>Host: pgtest2.dbrnd.com</li>
<li>Table: public.tbl_stud</li>
<li>User: anvesh</li>
<li>Database: Students_test</li>
</ul>
<p><strong>Important Note:</strong></p>
<blockquote><p>Both the side table structure must be same like number columns and datatype of a column.</p></blockquote>
<p><strong>Option #1: Using SSH | PSQL</strong><br />
Use pg_dump with SSH | PSQL, and execute below command. It will ask password for pgtest2.dbrnd.com, and I set database password using variable PGPASSWORD. It will migrate only table data between server.</p><pre class="crayon-plain-tag">pg_dump --data-only --table=public.tbl_stud Students | ssh anvesh@pgtest2.dbrnd.com "PGPASSWORD=mypass psql -h pgtest2.dbrnd.com -U anvesh Students_test"</pre><p>
<strong>Option #2: Using only PSQL (Transfer data only)</strong><br />
Option -a is for data only.</p><pre class="crayon-plain-tag">pg_dump -t public.tbl_stud -a Students | psql -h pgtest2.dbrnd.com -p 5432 -d Students_test</pre><p>
<strong>Option #3: Using only PSQL (Transfer table structure with data)</strong></p><pre class="crayon-plain-tag">pg_dump -t public.tbl_stud Students | psql -h pgtest2.dbrnd.com -p 5432 -d Students_test</pre><p>
<strong>You can access below other related articles:</strong></p>
<ul>
<li><a href="https://www.dbrnd.com/2017/02/postgresql-how-to-take-a-backup-of-your-table-pg_dump-pg_admin/" target="_blank">Take a backup of your table:</a></li>
<li><a href="https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/" target="_blank">Copy data between your schemas:</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/04/postgresql-use-pg_dump-ssh-psql-copy-table-data-from-a-server-to-another-server/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
