<?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>schema restore &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/schema-restore/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>Tue, 25 Jul 2017 13:31:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>PostgreSQL: Take Schema backup or Copy Schema into another Server</title>
		<link>https://www.dbrnd.com/2017/07/postgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 31 Jul 2017 16:16:13 +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[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[schema backup]]></category>
		<category><![CDATA[schema restore]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5725</guid>

					<description><![CDATA[Instead of a separate database, PostgreSQL DBAs are suggesting to create schemas in Postgres. The reason is cross database queries which is not supported in Postgres. In your database, you cannot select any data from another database of the same server. For that, you need to configure DB link which you can find in below [&#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%2F07%2Fpostgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore%2F&amp;linkname=PostgreSQL%3A%20Take%20Schema%20backup%20or%20Copy%20Schema%20into%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%2F07%2Fpostgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore%2F&amp;linkname=PostgreSQL%3A%20Take%20Schema%20backup%20or%20Copy%20Schema%20into%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%2F07%2Fpostgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore%2F&amp;linkname=PostgreSQL%3A%20Take%20Schema%20backup%20or%20Copy%20Schema%20into%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%2F07%2Fpostgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore%2F&amp;linkname=PostgreSQL%3A%20Take%20Schema%20backup%20or%20Copy%20Schema%20into%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%2F07%2Fpostgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore%2F&amp;linkname=PostgreSQL%3A%20Take%20Schema%20backup%20or%20Copy%20Schema%20into%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%2F07%2Fpostgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore%2F&amp;linkname=PostgreSQL%3A%20Take%20Schema%20backup%20or%20Copy%20Schema%20into%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%2F07%2Fpostgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore%2F&#038;title=PostgreSQL%3A%20Take%20Schema%20backup%20or%20Copy%20Schema%20into%20another%20Server" data-a2a-url="https://www.dbrnd.com/2017/07/postgresql-take-schema-backup-or-copy-schema-into-another-server-pg_dump-restore/" data-a2a-title="PostgreSQL: Take Schema backup or Copy Schema into another Server"></a></p><p>Instead of a separate database, PostgreSQL DBAs are suggesting to create schemas in Postgres. The reason is cross database queries which is not supported in Postgres.</p>
<p>In your database, you cannot select any data from another database of the same server. For that, you need to configure DB link which you can find in below article.</p>
<blockquote data-secret="JB9UhdGzLo" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2015/05/postgresql-cross-database-queries-using/">PostgreSQL [Video]: Cross Database Queries using DbLink Extension</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/05/postgresql-cross-database-queries-using/embed/#?secret=JB9UhdGzLo" data-secret="JB9UhdGzLo" width="600" height="338" title="&#8220;PostgreSQL [Video]: Cross Database Queries using DbLink Extension&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>So, I have seen most of the PostgreSQL servers where user created lots of schema for a different purpose.<br />
Previously, I shared an article on how to take table backup in PostgreSQL. </p>
<blockquote data-secret="V7c86Ex9yG" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2017/02/postgresql-how-to-take-a-backup-of-your-table-pg_dump-pg_admin/">PostgreSQL: How to take a backup of your Table?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2017/02/postgresql-how-to-take-a-backup-of-your-table-pg_dump-pg_admin/embed/#?secret=V7c86Ex9yG" data-secret="V7c86Ex9yG" width="600" height="338" title="&#8220;PostgreSQL: How to take a backup of your Table?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>Recently, I got one request from a developer like they need one schema backup from Production Server to Development Server.<br />
In this post, I am sharing the script to take backup of your Schema and using the single command you can also copy your schema from one server to another server.<br />
Here, I am using pg_dump utility to perform this exercise. </p></blockquote>
<p><strong>Take only schema backup in .sql file:</strong></p>
<pre class="crayon-plain-tag">pg_dump --schema=schema_name db_name &gt; backupfile.sql</pre> </p>
<p><strong>Restore schema from backup .sql file:</strong></p>
<pre class="crayon-plain-tag">psql -d db_name -h localhost -U user_name &lt; backupfile.sql</pre> </p>
<p><strong>Copy or Restore schema backup into another PostgreSQL Server:</strong></p>
<pre class="crayon-plain-tag">pg_dump source_db_name --schema schema_name | psql -h destination_hostname -U distination_user_name -d distination_db_name</pre> </p>
<p><em>Note: While copying the schema from one server to another, please make sure that require owner or roles created on the destination server. </em></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
