<?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>linux &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/linux/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>Thu, 26 Apr 2018 19:24:55 +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: Change the Default Data Directory in Linux</title>
		<link>https://www.dbrnd.com/2018/04/postgresql-change-the-default-data-directory-in-linux/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 28 Apr 2018 16:16:45 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[copy postgres data directory]]></category>
		<category><![CDATA[data directory]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[initdb]]></category>
		<category><![CDATA[linux]]></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>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7000</guid>

					<description><![CDATA[<div><img width="400" height="400" src="https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir.png" class="attachment-post-image size-post-image wp-post-image" alt="MySQL Move Data Dir" decoding="async" fetchpriority="high" srcset="https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir.png 400w, https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir-150x150.png 150w, https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir-300x300.png 300w, https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir-65x65.png 65w" sizes="(max-width: 400px) 100vw, 400px" /></div>In this post, I am sharing basic steps for changing the default Windows Data Directory of the PostgreSQL in Linux. When we install PostgreSQL on Linux operating system, by default it stores in “/var/lib/postgresql/[version]/data/” Always best practice is to store database data on the separate drive instead of the system drives. PostgreSQL: Change or Move [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="400" height="400" src="https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir.png" class="attachment-post-image size-post-image wp-post-image" alt="MySQL Move Data Dir" decoding="async" srcset="https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir.png 400w, https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir-150x150.png 150w, https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir-300x300.png 300w, https://www.dbrnd.com/wp-content/uploads/2017/07/MySQLMoveDataDir-65x65.png 65w" sizes="(max-width: 400px) 100vw, 400px" /></div><p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F04%2Fpostgresql-change-the-default-data-directory-in-linux%2F&amp;linkname=PostgreSQL%3A%20Change%20the%20Default%20Data%20Directory%20in%20Linux" 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%2F2018%2F04%2Fpostgresql-change-the-default-data-directory-in-linux%2F&amp;linkname=PostgreSQL%3A%20Change%20the%20Default%20Data%20Directory%20in%20Linux" 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%2F2018%2F04%2Fpostgresql-change-the-default-data-directory-in-linux%2F&amp;linkname=PostgreSQL%3A%20Change%20the%20Default%20Data%20Directory%20in%20Linux" 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%2F2018%2F04%2Fpostgresql-change-the-default-data-directory-in-linux%2F&amp;linkname=PostgreSQL%3A%20Change%20the%20Default%20Data%20Directory%20in%20Linux" 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%2F2018%2F04%2Fpostgresql-change-the-default-data-directory-in-linux%2F&amp;linkname=PostgreSQL%3A%20Change%20the%20Default%20Data%20Directory%20in%20Linux" 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%2F2018%2F04%2Fpostgresql-change-the-default-data-directory-in-linux%2F&amp;linkname=PostgreSQL%3A%20Change%20the%20Default%20Data%20Directory%20in%20Linux" 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%2F2018%2F04%2Fpostgresql-change-the-default-data-directory-in-linux%2F&#038;title=PostgreSQL%3A%20Change%20the%20Default%20Data%20Directory%20in%20Linux" data-a2a-url="https://www.dbrnd.com/2018/04/postgresql-change-the-default-data-directory-in-linux/" data-a2a-title="PostgreSQL: Change the Default Data Directory in Linux"></a></p><p>In this post, I am sharing basic steps for changing the default Windows Data Directory of the PostgreSQL in Linux.</p>
<p>When we install PostgreSQL on Linux operating system, by default it stores in “/var/lib/postgresql/[version]/data/”</p>
<p>Always best practice is to store database data on the separate drive instead of the system drives.</p>
<blockquote class="wp-embedded-content" data-secret="keiyJmNYhy"><p><a href="https://www.dbrnd.com/2016/08/postgresql-change-or-move-default-data-directory-in-windows-operating-system/">PostgreSQL: Change or Move Default Data Directory in Windows</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/08/postgresql-change-or-move-default-data-directory-in-windows-operating-system/embed/#?secret=keiyJmNYhy" data-secret="keiyJmNYhy" width="600" height="338" title="&#8220;PostgreSQL: Change or Move Default Data Directory in Windows&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Create a new directory:</strong></p>
<pre class="crayon-plain-tag">mkdir postgres_data_dir</pre> </p>
<p><strong>Give directory ownership to your Linux user:</strong></p>
<pre class="crayon-plain-tag">chown user_name postgres_data_dir</pre> </p>
<p><strong>Log in with your postgres user and initialize the database at the new location:</strong></p>
<pre class="crayon-plain-tag">initdb -D /postgres/test/postgres_data_dir</pre> </p>
<p><strong>OR</strong></p>
<p><strong>STOP and then START Postgres with new data directory:</strong></p>
<pre class="crayon-plain-tag">postgres -D /postgres/test/postgres_data_dir</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Move Main Data Directory in Linux (Ubuntu 16.4)</title>
		<link>https://www.dbrnd.com/2018/04/postgresql-move-main-data-directory-in-linux-ubuntu-16-4/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 27 Apr 2018 16:16:26 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[data directory]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[move data]]></category>
		<category><![CDATA[move directory]]></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[Ubuntu 16.04]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7004</guid>

					<description><![CDATA[In this post, I am sharing complete steps for moving main PostgreSQL data directory to any new location in Linux. When we install PostgreSQL on Linux operating system, by default it stores in “/var/lib/postgresql/[version]/data/” Always best practice is to store database data on the separate drive instead of the system drives. Check the current data [&#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%2F2018%2F04%2Fpostgresql-move-main-data-directory-in-linux-ubuntu-16-4%2F&amp;linkname=PostgreSQL%3A%20Move%20Main%20Data%20Directory%20in%20Linux%20%28Ubuntu%2016.4%29" 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%2F2018%2F04%2Fpostgresql-move-main-data-directory-in-linux-ubuntu-16-4%2F&amp;linkname=PostgreSQL%3A%20Move%20Main%20Data%20Directory%20in%20Linux%20%28Ubuntu%2016.4%29" 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%2F2018%2F04%2Fpostgresql-move-main-data-directory-in-linux-ubuntu-16-4%2F&amp;linkname=PostgreSQL%3A%20Move%20Main%20Data%20Directory%20in%20Linux%20%28Ubuntu%2016.4%29" 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%2F2018%2F04%2Fpostgresql-move-main-data-directory-in-linux-ubuntu-16-4%2F&amp;linkname=PostgreSQL%3A%20Move%20Main%20Data%20Directory%20in%20Linux%20%28Ubuntu%2016.4%29" 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%2F2018%2F04%2Fpostgresql-move-main-data-directory-in-linux-ubuntu-16-4%2F&amp;linkname=PostgreSQL%3A%20Move%20Main%20Data%20Directory%20in%20Linux%20%28Ubuntu%2016.4%29" 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%2F2018%2F04%2Fpostgresql-move-main-data-directory-in-linux-ubuntu-16-4%2F&amp;linkname=PostgreSQL%3A%20Move%20Main%20Data%20Directory%20in%20Linux%20%28Ubuntu%2016.4%29" 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%2F2018%2F04%2Fpostgresql-move-main-data-directory-in-linux-ubuntu-16-4%2F&#038;title=PostgreSQL%3A%20Move%20Main%20Data%20Directory%20in%20Linux%20%28Ubuntu%2016.4%29" data-a2a-url="https://www.dbrnd.com/2018/04/postgresql-move-main-data-directory-in-linux-ubuntu-16-4/" data-a2a-title="PostgreSQL: Move Main Data Directory in Linux (Ubuntu 16.4)"></a></p><p>In this post, I am sharing complete steps for moving main PostgreSQL data directory to any new location in Linux.</p>
<p>When we install PostgreSQL on Linux operating system, by default it stores in “/var/lib/postgresql/[version]/data/”</p>
<p>Always best practice is to store database data on the separate drive instead of the system drives.</p>
<p><strong>Check the current data directory:</strong></p>
<pre class="crayon-plain-tag">postgres=# SHOW data_directory;

        data_directory
------------------------------
 /var/lib/postgresql/9.6/main</pre> </p>
<p><strong>Stop the PostgreSQL Service:</strong></p>
<pre class="crayon-plain-tag">sudo systemctl stop postgresql</pre> </p>
<p><strong>Create a new directory:</strong></p>
<pre class="crayon-plain-tag">mkdir postgres_data_dir</pre> </p>
<p><strong>Give directory ownership to your Linux user:</strong></p>
<pre class="crayon-plain-tag">chown user_name postgres_data_dir</pre> </p>
<p><strong>Move existing PostgreSQL data/floder to the new location:</strong></p>
<pre class="crayon-plain-tag">sudo rsync -av /var/lib/postgresql /test/postgres_data_dir/</pre> </p>
<p><strong>Move old folder to the backup folder:</strong></p>
<pre class="crayon-plain-tag">sudo mv /var/lib/postgresql/9.6/main /tmp/pg_backup</pre> </p>
<p><strong>Change data folder in postgresql.conf file:</strong></p>
<pre class="crayon-plain-tag">data_directory = '/test/postgres_data_dir/postgresql/9.6/main'</pre> </p>
<p><strong>Start the service of PostgreSQL:</strong></p>
<pre class="crayon-plain-tag">sudo systemctl start postgresql</pre> </p>
<p><strong>Now check the data directory:</strong></p>
<pre class="crayon-plain-tag">postgres=# SHOW data_directory; 

 		  data_directory
--------------------------------------------
/test/postgres_data_dir/postgresql/9.6/main</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Install pgAdmin 4 Desktop Mode in Ubuntu 16.04</title>
		<link>https://www.dbrnd.com/2017/07/postgresql-install-pgadmin-4-desktop-mode-in-ubuntu-16-04/</link>
					<comments>https://www.dbrnd.com/2017/07/postgresql-install-pgadmin-4-desktop-mode-in-ubuntu-16-04/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 27 Jul 2017 16:16:37 +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[linux]]></category>
		<category><![CDATA[pgadmin 4]]></category>
		<category><![CDATA[pip]]></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[Ubuntu 16.04]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5708</guid>

					<description><![CDATA[<div><img width="458" height="166" src="https://www.dbrnd.com/wp-content/uploads/2017/07/pgadmin4.png" class="attachment-post-image size-post-image wp-post-image" alt="pgadmin4" decoding="async" loading="lazy" /></div>PostgreSQL recently launched the new pgAdmin 4 tool to access the PostgreSQL Database Server. In this post, I am sharing steps to install pgAdmin 4 desktop mode in Ubuntu 16.04. First, create a virtual environment: [crayon-6a9386ec7852d969848209/] Create pgadmin4 virtual environment: [crayon-6a9386ec7852f402960491/] Now, go to pgadmin4 and activate it: [crayon-6a9386ec78530334442221/] Download the pgadmin4: [crayon-6a9386ec78531004731081/] Just check [&#8230;]]]></description>
										<content:encoded><![CDATA[<div><img width="458" height="166" src="https://www.dbrnd.com/wp-content/uploads/2017/07/pgadmin4.png" class="attachment-post-image size-post-image wp-post-image" alt="pgadmin4" decoding="async" loading="lazy" /></div><p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F07%2Fpostgresql-install-pgadmin-4-desktop-mode-in-ubuntu-16-04%2F&amp;linkname=PostgreSQL%3A%20Install%20pgAdmin%204%20Desktop%20Mode%20in%20Ubuntu%2016.04" 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-install-pgadmin-4-desktop-mode-in-ubuntu-16-04%2F&amp;linkname=PostgreSQL%3A%20Install%20pgAdmin%204%20Desktop%20Mode%20in%20Ubuntu%2016.04" 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-install-pgadmin-4-desktop-mode-in-ubuntu-16-04%2F&amp;linkname=PostgreSQL%3A%20Install%20pgAdmin%204%20Desktop%20Mode%20in%20Ubuntu%2016.04" 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-install-pgadmin-4-desktop-mode-in-ubuntu-16-04%2F&amp;linkname=PostgreSQL%3A%20Install%20pgAdmin%204%20Desktop%20Mode%20in%20Ubuntu%2016.04" 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-install-pgadmin-4-desktop-mode-in-ubuntu-16-04%2F&amp;linkname=PostgreSQL%3A%20Install%20pgAdmin%204%20Desktop%20Mode%20in%20Ubuntu%2016.04" 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-install-pgadmin-4-desktop-mode-in-ubuntu-16-04%2F&amp;linkname=PostgreSQL%3A%20Install%20pgAdmin%204%20Desktop%20Mode%20in%20Ubuntu%2016.04" 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-install-pgadmin-4-desktop-mode-in-ubuntu-16-04%2F&#038;title=PostgreSQL%3A%20Install%20pgAdmin%204%20Desktop%20Mode%20in%20Ubuntu%2016.04" data-a2a-url="https://www.dbrnd.com/2017/07/postgresql-install-pgadmin-4-desktop-mode-in-ubuntu-16-04/" data-a2a-title="PostgreSQL: Install pgAdmin 4 Desktop Mode in Ubuntu 16.04"></a></p><p>PostgreSQL recently launched the new pgAdmin 4 tool to access the PostgreSQL Database Server.<br />
In this post, I am sharing steps to install pgAdmin 4 desktop mode in Ubuntu 16.04.</p>
<p><strong>First, create a virtual environment:</strong><br />
<pre class="crayon-plain-tag">sudo apt-get install virtualenv python-pip libpq-dev</pre>
<p><strong>Create pgadmin4 virtual environment:</strong><br />
<pre class="crayon-plain-tag">cd
virtualenv pgadmin4</pre>
<p><strong>Now, go to pgadmin4 and activate it:</strong><br />
<pre class="crayon-plain-tag">cd pgadmin4
source bin/activate</pre>
<p><strong>Download the pgadmin4:</strong><br />
<pre class="crayon-plain-tag">wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.4/pip/pgadmin4-1.4-py2.py3-none-any.whl</pre>
<p><strong>Just check the pgadmin4:</strong><br />
<pre class="crayon-plain-tag">ls -ltr
 
postgres@ip-172-31-27-19:~/pgadmin4$ ls -ltr
total 24
drwxrwxr-x 3 postgres postgres 4096 Jul 18 20:07 lib
drwxrwxr-x 2 postgres postgres 4096 Jul 18 20:07 include
drwxrwxr-x 3 postgres postgres 4096 Jul 18 20:07 share
drwxrwxr-x 2 postgres postgres 4096 Jul 18 20:07 local
-rw-rw-r-- 1 postgres postgres   60 Jul 18 20:07 pip-selfcheck.json
drwxrwxr-x 2 postgres postgres 4096 Jul 18 20:07 bin</pre>
<p><strong>Now install pgadmin4:</strong><br />
<pre class="crayon-plain-tag">pip install pgadmin4-1.4-py2.py3-none-any.whl</pre>
<p><strong>Do activate:</strong><br />
<pre class="crayon-plain-tag">cd ~/pgadmin4
source bin/activate</pre>
<p><strong>Execute require python script:</strong><br />
<pre class="crayon-plain-tag">python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py</pre>
<p><strong>Check the output:</strong><br />
<pre class="crayon-plain-tag">pgAdmin 4 - Application Initialisation
======================================
The configuration database - '/var/lib/postgresql/.pgadmin/pgadmin4.db' does not exist.
Entering initial setup mode...
NOTE: Configuring authentication for SERVER mode.
 
Enter the email address and password to use for the initial pgAdmin user account:
 
Email address: anveshpatel88@gmail.com
Password:
Retype password:
Password must be at least 6 characters. Please try again.
Password:
Retype password:
 
The configuration database has been created at /var/lib/postgresql/.pgadmin/pgadmin4.db
Starting pgAdmin 4. Please navigate to http://localhost:5050 in your browser.</pre>
<p><strong>Access pgadmin4 in a browser:</strong><br />
<pre class="crayon-plain-tag">http://localhost:5050</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/07/postgresql-install-pgadmin-4-desktop-mode-in-ubuntu-16-04/feed/</wfw:commentRss>
			<slash:comments>21</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server 2017: Start and Stop, Enable and Disable SQL Server Service on Linux</title>
		<link>https://www.dbrnd.com/2017/07/sql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 15 Jul 2017 16:16:42 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2017]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[systemctl]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5618</guid>

					<description><![CDATA[In this post, I am sharing few DBA commands to start, stop, enable, disable SQL Server Service on Linux. Microsoft released SQL Server 2017 with Linux so SQL DBA should know the basic commands of SQL Linux. SQL Server 2017: Microsoft released Community Technical Preview (CTP 2.0) on 19th April 2017 First, check the status [&#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%2Fsql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl%2F&amp;linkname=SQL%20Server%202017%3A%20Start%20and%20Stop%2C%20Enable%20and%20Disable%20SQL%20Server%20Service%20on%20Linux" 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%2Fsql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl%2F&amp;linkname=SQL%20Server%202017%3A%20Start%20and%20Stop%2C%20Enable%20and%20Disable%20SQL%20Server%20Service%20on%20Linux" 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%2Fsql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl%2F&amp;linkname=SQL%20Server%202017%3A%20Start%20and%20Stop%2C%20Enable%20and%20Disable%20SQL%20Server%20Service%20on%20Linux" 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%2Fsql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl%2F&amp;linkname=SQL%20Server%202017%3A%20Start%20and%20Stop%2C%20Enable%20and%20Disable%20SQL%20Server%20Service%20on%20Linux" 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%2Fsql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl%2F&amp;linkname=SQL%20Server%202017%3A%20Start%20and%20Stop%2C%20Enable%20and%20Disable%20SQL%20Server%20Service%20on%20Linux" 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%2Fsql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl%2F&amp;linkname=SQL%20Server%202017%3A%20Start%20and%20Stop%2C%20Enable%20and%20Disable%20SQL%20Server%20Service%20on%20Linux" 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%2Fsql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl%2F&#038;title=SQL%20Server%202017%3A%20Start%20and%20Stop%2C%20Enable%20and%20Disable%20SQL%20Server%20Service%20on%20Linux" data-a2a-url="https://www.dbrnd.com/2017/07/sql-server-2017-start-and-stop-enable-and-disable-sql-server-service-on-linux-systemctl/" data-a2a-title="SQL Server 2017: Start and Stop, Enable and Disable SQL Server Service on Linux"></a></p><p>In this post, I am sharing few DBA commands to start, stop, enable, disable SQL Server Service on Linux.<br />
Microsoft released SQL Server 2017 with Linux so SQL DBA should know the basic commands of SQL Linux. </p>
<blockquote class="wp-embedded-content" data-secret="VARsNk0B6U"><p><a href="https://www.dbrnd.com/2017/05/sql-server-2017-microsoft-released-community-technical-preview-ctp-2-0-on-19th-april-2017/">SQL Server 2017: Microsoft released Community Technical Preview (CTP 2.0) on 19th April 2017</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2017/05/sql-server-2017-microsoft-released-community-technical-preview-ctp-2-0-on-19th-april-2017/embed/#?secret=VARsNk0B6U" data-secret="VARsNk0B6U" width="600" height="338" title="&#8220;SQL Server 2017: Microsoft released Community Technical Preview (CTP 2.0) on 19th April 2017&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>First, check the status of SQL Server Service:</strong></p>
<pre class="crayon-plain-tag">systemctl status mssql-server</pre> </p>
<p><strong>Stop the SQL Server Service:</strong></p>
<pre class="crayon-plain-tag">sudo systemctl stop mssql-server</pre> </p>
<p><strong>Start the SQL Server Service:</strong></p>
<pre class="crayon-plain-tag">sudo systemctl Start mssql-server</pre> </p>
<p><strong>Disable the SQL Server Service:</strong></p>
<pre class="crayon-plain-tag">sudo systemctl stop mssql-server

sudo systemctl disable mssql-server</pre> </p>
<p><strong>Enable the SQL Server Service:</strong></p>
<pre class="crayon-plain-tag">sudo systemctl enable mssql-server

sudo systemctl start mssql-server</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Linux: Importance of first line comment &#8220;#!/bin/sh&#8221; in a shell script</title>
		<link>https://www.dbrnd.com/2017/06/linux-importance-of-first-line-comment-binsh-in-a-shell-script/</link>
					<comments>https://www.dbrnd.com/2017/06/linux-importance-of-first-line-comment-binsh-in-a-shell-script/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 11 Jun 2017 16:16:43 +0000</pubDate>
				<category><![CDATA[Bash Shell Script]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Bash shell script]]></category>
		<category><![CDATA[Crontab]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Linux Error]]></category>
		<category><![CDATA[Linux Programming]]></category>
		<category><![CDATA[Linux shell script]]></category>
		<category><![CDATA[Linux Tips and Tricks]]></category>
		<category><![CDATA[Unix shell]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4635</guid>

					<description><![CDATA[Recently, I started to configure few of my DBA shell scripts in Linux Crontab. Yesterday, I shared an important article on skip the execution of your shell script if it is running already. If you forget to put the first line of your shell script something like &#8220;#!/bin/sh&#8221; and bash shell script something like &#8220;#!/bin/bash&#8221;, [&#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%2F06%2Flinux-importance-of-first-line-comment-binsh-in-a-shell-script%2F&amp;linkname=Linux%3A%20Importance%20of%20first%20line%20comment%20%E2%80%9C%23%21%2Fbin%2Fsh%E2%80%9D%20in%20a%20shell%20script" 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%2F06%2Flinux-importance-of-first-line-comment-binsh-in-a-shell-script%2F&amp;linkname=Linux%3A%20Importance%20of%20first%20line%20comment%20%E2%80%9C%23%21%2Fbin%2Fsh%E2%80%9D%20in%20a%20shell%20script" 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%2F06%2Flinux-importance-of-first-line-comment-binsh-in-a-shell-script%2F&amp;linkname=Linux%3A%20Importance%20of%20first%20line%20comment%20%E2%80%9C%23%21%2Fbin%2Fsh%E2%80%9D%20in%20a%20shell%20script" 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%2F06%2Flinux-importance-of-first-line-comment-binsh-in-a-shell-script%2F&amp;linkname=Linux%3A%20Importance%20of%20first%20line%20comment%20%E2%80%9C%23%21%2Fbin%2Fsh%E2%80%9D%20in%20a%20shell%20script" 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%2F06%2Flinux-importance-of-first-line-comment-binsh-in-a-shell-script%2F&amp;linkname=Linux%3A%20Importance%20of%20first%20line%20comment%20%E2%80%9C%23%21%2Fbin%2Fsh%E2%80%9D%20in%20a%20shell%20script" 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%2F06%2Flinux-importance-of-first-line-comment-binsh-in-a-shell-script%2F&amp;linkname=Linux%3A%20Importance%20of%20first%20line%20comment%20%E2%80%9C%23%21%2Fbin%2Fsh%E2%80%9D%20in%20a%20shell%20script" 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%2F06%2Flinux-importance-of-first-line-comment-binsh-in-a-shell-script%2F&#038;title=Linux%3A%20Importance%20of%20first%20line%20comment%20%E2%80%9C%23%21%2Fbin%2Fsh%E2%80%9D%20in%20a%20shell%20script" data-a2a-url="https://www.dbrnd.com/2017/06/linux-importance-of-first-line-comment-binsh-in-a-shell-script/" data-a2a-title="Linux: Importance of first line comment “#!/bin/sh” in a shell script"></a></p><p>Recently, I started to configure few of my DBA shell scripts in Linux Crontab.</p>
<p>Yesterday, I shared an important article on skip the execution of your shell script if it is running already.</p>
<blockquote><p>If you forget to put the first line of your shell script something like &#8220;#!/bin/sh&#8221; and bash shell script something like &#8220;#!/bin/bash&#8221;, you cannot get the name of your running shell script.</p></blockquote>
<p>It&#8217;s called a shebang and tells the parent shell which interpreter should be used to execute the script.</p>
<blockquote><p>When you are running shell script in Linux, the operating system will look at the first few bytes of the file to decide the format of the program and how to execute it.</p></blockquote>
<blockquote><p>If you don&#8217;t use &#8220;#!/bin/sh&#8221; or &#8220;#!/bin/bash&#8221; on the first line, then the system will treat all the commands in that script as different commands.</p></blockquote>
<p>So I would suggest please start to add it.</p>
<p><strong>Check below screenshots without #!/bin/bash:</strong></p>
<p>I created sample running.bash file to explain the importance &#8220;#!/bin/sh&#8221; or &#8220;#!/bin/bash&#8221;.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4647" src="https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithoutFilenameShellScript.png" alt="" width="389" height="174" srcset="https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithoutFilenameShellScript.png 389w, https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithoutFilenameShellScript-300x134.png 300w, https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithoutFilenameShellScript-150x67.png 150w" sizes="auto, (max-width: 389px) 100vw, 389px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4646" src="https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithoutFilename.png" alt="" width="545" height="97" srcset="https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithoutFilename.png 545w, https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithoutFilename-300x53.png 300w, https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithoutFilename-150x27.png 150w" sizes="auto, (max-width: 545px) 100vw, 545px" /></p>
<p><strong>Check below screenshots with #!/bin/bash:</strong></p>
<p><strong><img loading="lazy" decoding="async" class="alignnone wp-image-4639" src="https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithFilenameShellScript.png" alt="Linux Process With Filename Shell Script" width="386" height="166" /></strong></p>
<p><strong><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4644" src="https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithFilename.png" alt="" width="587" height="80" srcset="https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithFilename.png 587w, https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithFilename-300x41.png 300w, https://www.dbrnd.com/wp-content/uploads/2017/02/LinuxProcessWithFilename-150x20.png 150w" sizes="auto, (max-width: 587px) 100vw, 587px" /></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/06/linux-importance-of-first-line-comment-binsh-in-a-shell-script/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Linux: If your shell script is running, skip the next execution and exit it</title>
		<link>https://www.dbrnd.com/2017/06/linux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 10 Jun 2017 16:16:05 +0000</pubDate>
				<category><![CDATA[Bash Shell Script]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[basename]]></category>
		<category><![CDATA[Bash shell script]]></category>
		<category><![CDATA[cron job]]></category>
		<category><![CDATA[Crontab]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Linux Error]]></category>
		<category><![CDATA[Linux Programming]]></category>
		<category><![CDATA[Linux shell script]]></category>
		<category><![CDATA[Linux Tips and Tricks]]></category>
		<category><![CDATA[pidof]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[Unix shell]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4631</guid>

					<description><![CDATA[We configured lots of cron job in our production Linux &#8211; PostgreSQL Server. Different schedules like monitor the database performance, monitor the backup process, take a database backup, replicate a database copy. We set few monitor cron jobs at every 5 minutes. Now the situation is, few monitoring scripts are running even more than 5 [&#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%2F06%2Flinux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job%2F&amp;linkname=Linux%3A%20If%20your%20shell%20script%20is%20running%2C%20skip%20the%20next%20execution%20and%20exit%20it" 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%2F06%2Flinux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job%2F&amp;linkname=Linux%3A%20If%20your%20shell%20script%20is%20running%2C%20skip%20the%20next%20execution%20and%20exit%20it" 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%2F06%2Flinux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job%2F&amp;linkname=Linux%3A%20If%20your%20shell%20script%20is%20running%2C%20skip%20the%20next%20execution%20and%20exit%20it" 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%2F06%2Flinux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job%2F&amp;linkname=Linux%3A%20If%20your%20shell%20script%20is%20running%2C%20skip%20the%20next%20execution%20and%20exit%20it" 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%2F06%2Flinux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job%2F&amp;linkname=Linux%3A%20If%20your%20shell%20script%20is%20running%2C%20skip%20the%20next%20execution%20and%20exit%20it" 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%2F06%2Flinux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job%2F&amp;linkname=Linux%3A%20If%20your%20shell%20script%20is%20running%2C%20skip%20the%20next%20execution%20and%20exit%20it" 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%2F06%2Flinux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job%2F&#038;title=Linux%3A%20If%20your%20shell%20script%20is%20running%2C%20skip%20the%20next%20execution%20and%20exit%20it" data-a2a-url="https://www.dbrnd.com/2017/06/linux-if-your-shell-script-is-running-skip-the-next-execution-and-exit-it-cron-job/" data-a2a-title="Linux: If your shell script is running, skip the next execution and exit it"></a></p><p>We configured lots of cron job in our production Linux &#8211; PostgreSQL Server. Different schedules like monitor the database performance, monitor the backup process, take a database backup, replicate a database copy. </p>
<blockquote><p>We set few monitor cron jobs at every 5 minutes. Now the situation is, few monitoring scripts are running even more than 5 minutes, and as per the scheduled, same script could start the execution after 5 minutes. </p>
<p>Now, the same script is running more than one time. </p></blockquote>
<blockquote><p>We should monitor this kind of situation, and we should prevent the next execution of the same script if it is already in running state. It also helps us to reduce an unnecessary load on the database server.</p></blockquote>
<p>I prepared below two options; you can embed any one of it in your shell script.</p>
<p><strong>Option script 1:</strong></p>
<pre class="crayon-plain-tag">if pidof -x $(basename $0) &gt; /dev/null; then
  for p in $(pidof -x $(basename $0)); do
    if [ $p -ne $$ ]; then
	echo "*****************************************************************"
	echo "  ***Warning*** Script $0 is already running...So existing...    "
	echo "*****************************************************************"
	exit 1
    fi
  done
fi</pre> </p>
<p><strong>Option script 2:</strong></p>
<pre class="crayon-plain-tag">isrunning=`ps -ef | grep $(basename $0) | grep -v $$ | grep -v grep | wc -l`
 
if [ "$isrunning" -ne 0 ]; then
   echo "**************************************************************"
   echo "  ***Warning*** Script $0 is already running... So exiting... "
   echo "**************************************************************"
   exit 1
fi</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Shell script to copy table data from one server to another server</title>
		<link>https://www.dbrnd.com/2017/03/postgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 02 Mar 2017 16:16:00 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Bash shell script]]></category>
		<category><![CDATA[Copy command]]></category>
		<category><![CDATA[data migration]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[linux]]></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>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4672</guid>

					<description><![CDATA[Recently, I shared one article on PostgreSQL schemas migration. PostgreSQL: Script to copy Table Data from one Schema to another Schema The migration activities are very common for all DBAs. I found lots of different questions on migration exercises. In this post, I am sharing a Linux shell script to copy your table data from [&#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%2F03%2Fpostgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20copy%20table%20data%20from%20one%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%2F03%2Fpostgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20copy%20table%20data%20from%20one%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%2F03%2Fpostgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20copy%20table%20data%20from%20one%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%2F03%2Fpostgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20copy%20table%20data%20from%20one%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%2F03%2Fpostgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20copy%20table%20data%20from%20one%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%2F03%2Fpostgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20copy%20table%20data%20from%20one%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%2F03%2Fpostgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration%2F&#038;title=PostgreSQL%3A%20Shell%20script%20to%20copy%20table%20data%20from%20one%20server%20to%20another%20server" data-a2a-url="https://www.dbrnd.com/2017/03/postgresql-shell-script-to-copy-table-data-from-one-server-to-another-server-psql-copy-command-data-migration/" data-a2a-title="PostgreSQL: Shell script to copy table data from one server to another server"></a></p><p>Recently, I shared one article on PostgreSQL schemas migration. </p>
<blockquote data-secret="dbPEectos8" class="wp-embedded-content"><p><a href="https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/">PostgreSQL: Script to copy Table Data from one Schema to another Schema</a></p></blockquote>
<p><iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2017/02/postgresql-script-to-copy-schema-table-data-to-another-schema-table-migration/embed/#?secret=dbPEectos8" data-secret="dbPEectos8" width="600" height="338" title="&#8220;PostgreSQL: Script to copy Table Data from one Schema to another Schema&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>The migration activities are very common for all DBAs. I found lots of different questions on migration exercises.<br />
In this post, I am sharing a Linux shell script to copy your table data from one PostgreSQL Server to another PostgreSQL Server using psql command line. </p>
<blockquote><p>I am just migrating the data; please create a blank table at your destination/second database server. </p>
<p>This is a utility script. Further, you can modify the script for generic use something like by adding parameters for host_name, database_name, table_name and others</p></blockquote>
<p><strong>Linux Bash Shell Script for data migration between PostgreSQL Servers:</strong></p>
<pre class="crayon-plain-tag">#!/bin/bash
psql \
    -X \
    -U user_name \
    -h host_name1 \
    -d database_name \
    -c "\\copy tbl_Students to stdout" \
| \
psql \
    -X \
    -U user_name \
    -h host_name2 \
    -d database_name \
    -c "\\copy tbl_Students from stdin"</pre> </p>
<p><strong>You can also filter the column list something like below script:</strong></p>
<pre class="crayon-plain-tag">#!/bin/bash
psql \
    -X \
    -U user_name \
    -h host_name1 \
    -d database_name \
    -c "\\copy (SELECT Rno, Studname FROM tbl_Students) to stdout" \
| \
psql \
    -X \
    -U user_name \
    -h host_name2 \
    -d database_name \
    -c "\\copy tbl_Students from stdin"</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Shell script to store psql SELECT output into Variable</title>
		<link>https://www.dbrnd.com/2017/03/postgresql-shell-script-to-store-psql-select-output-into-variable/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 01 Mar 2017 16:16:54 +0000</pubDate>
				<category><![CDATA[Bash Shell Script]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Bash shell script]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Linux Variable]]></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[Record count]]></category>
		<category><![CDATA[Shell script]]></category>
		<category><![CDATA[Tuple]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4666</guid>

					<description><![CDATA[In the previous post, I shared shell script like store psql result into record array. In this post, I am sharing one more shell script to store the result of psql SELECT query into a Variable of Bash Shell Script. This handy script is useful for a beginner who just started to write a PostgreSQL [&#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%2F03%2Fpostgresql-shell-script-to-store-psql-select-output-into-variable%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20SELECT%20output%20into%20Variable" 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%2F03%2Fpostgresql-shell-script-to-store-psql-select-output-into-variable%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20SELECT%20output%20into%20Variable" 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%2F03%2Fpostgresql-shell-script-to-store-psql-select-output-into-variable%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20SELECT%20output%20into%20Variable" 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%2F03%2Fpostgresql-shell-script-to-store-psql-select-output-into-variable%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20SELECT%20output%20into%20Variable" 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%2F03%2Fpostgresql-shell-script-to-store-psql-select-output-into-variable%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20SELECT%20output%20into%20Variable" 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%2F03%2Fpostgresql-shell-script-to-store-psql-select-output-into-variable%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20SELECT%20output%20into%20Variable" 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%2F03%2Fpostgresql-shell-script-to-store-psql-select-output-into-variable%2F&#038;title=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20SELECT%20output%20into%20Variable" data-a2a-url="https://www.dbrnd.com/2017/03/postgresql-shell-script-to-store-psql-select-output-into-variable/" data-a2a-title="PostgreSQL: Shell script to store psql SELECT output into Variable"></a></p><p>In the previous post, I shared shell script like store psql result into record array.<br />
In this post, I am sharing one more shell script to store the result of psql SELECT query into a Variable of Bash Shell Script. </p>
<p>This handy script is useful for a beginner who just started to write a PostgreSQL DBA Bash Shell Script. You need this kind of demonstration to store the result of psql query into variable mostly like count of records. </p>
<p>The value of this variable we can use for further validation something like data exists or not in the Table.</p>
<blockquote><p>In the below script, I used two variables to store the count of a table, but do not forget to notice option &#8216;-t&#8217; in the second query which returns only tuple value and without option &#8216;-t&#8217; it returns all formatted text as well like column name, returned a row count. </p>
<p>We need only tuple value so we must use &#8216;-t&#8217; option. Please check the below demonstration.
</p></blockquote>
<pre class="crayon-plain-tag">#!/bin/bash

DB_NAME=$1
RecordCount1=$( psql -d ${DB_NAME} -c "select count(1) from tbl_students" )
RecordCount2=$( psql -d ${DB_NAME} -t -c "select count(1) from tbl_students" )

echo "RecordCount1:"$RecordCount1
echo "RecordCount2:"$RecordCount2</pre> </p>
<p><strong>The result:</strong></p>
<pre class="crayon-plain-tag">RecordCount1: count ------- 9 (1 row)
RecordCount2: 9</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Shell script to store psql result in RECORD ARRAY using WHILE LOOP</title>
		<link>https://www.dbrnd.com/2017/02/postgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop/</link>
					<comments>https://www.dbrnd.com/2017/02/postgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 28 Feb 2017 16:16:46 +0000</pubDate>
				<category><![CDATA[Bash Shell Script]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Bash shell script]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[linux]]></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[RECORD ARRAY]]></category>
		<category><![CDATA[Shell script]]></category>
		<category><![CDATA[WHILE LOOP]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4664</guid>

					<description><![CDATA[Now a day, I am developing different Linux shell scripts to monitor the PostgreSQL database server. Later, I will share those shell scripts. But before that, I want to share few basic things which we can embed in any one of our Shell scripts. In this post, I am sharing a small shell script to [&#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%2F02%2Fpostgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20result%20in%20RECORD%20ARRAY%20using%20WHILE%20LOOP" 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%2F02%2Fpostgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20result%20in%20RECORD%20ARRAY%20using%20WHILE%20LOOP" 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%2F02%2Fpostgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20result%20in%20RECORD%20ARRAY%20using%20WHILE%20LOOP" 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%2F02%2Fpostgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20result%20in%20RECORD%20ARRAY%20using%20WHILE%20LOOP" 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%2F02%2Fpostgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20result%20in%20RECORD%20ARRAY%20using%20WHILE%20LOOP" 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%2F02%2Fpostgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop%2F&amp;linkname=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20result%20in%20RECORD%20ARRAY%20using%20WHILE%20LOOP" 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%2F02%2Fpostgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop%2F&#038;title=PostgreSQL%3A%20Shell%20script%20to%20store%20psql%20result%20in%20RECORD%20ARRAY%20using%20WHILE%20LOOP" data-a2a-url="https://www.dbrnd.com/2017/02/postgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop/" data-a2a-title="PostgreSQL: Shell script to store psql result in RECORD ARRAY using WHILE LOOP"></a></p><p>Now a day, I am developing different Linux shell scripts to monitor the PostgreSQL database server. Later, I will share those shell scripts.</p>
<p>But before that, I want to share few basic things which we can embed in any one of our Shell scripts.</p>
<p>In this post, I am sharing a small shell script to iterate the result of psql SELECT using RECORD ARRAY and WHILE LOOP.<br />
Using that, we can do further processing and validation on each record.</p>
<p><strong>Script to iterate the table result:</strong><br />
<pre class="crayon-plain-tag">#!/bin/bash

DB_NAME=$1
psql -d ${DB_NAME} -At -c "select rno, studname, studclass from tbl_students" \
    | while read -a Record ; do
    rno=${Record[0]}
    studname=${Record[1]}
    studclass=${Record[2]}

    echo "${rno} ${studname} ${studclass}"
done</pre>
<strong>The result:</strong><br />
<pre class="crayon-plain-tag">rno | studname
-----+----------+-----------
1 | Anvesh
2 | Neevan
3 | Toby
5 | Roy
4 | Jenny
6 | Kaviy
7 | Martin
8 | Laxmi
9 | Nion
(9 rows)</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/02/postgresql-shell-script-to-store-psql-result-in-record-array-using-while-loop/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: How to Install PostgreSQL 9.4 on Ubuntu 14.04?</title>
		<link>https://www.dbrnd.com/2016/04/postgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 21 Apr 2016 20:15:07 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL 9.4]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2260</guid>

					<description><![CDATA[&#160; PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. I am going to share few steps on how to install PostgreSQL 9.4 on Ubuntu 14.04. First, check the [&#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%2F2016%2F04%2Fpostgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Install%20PostgreSQL%209.4%20on%20Ubuntu%2014.04%3F" 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%2F2016%2F04%2Fpostgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Install%20PostgreSQL%209.4%20on%20Ubuntu%2014.04%3F" 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%2F2016%2F04%2Fpostgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Install%20PostgreSQL%209.4%20on%20Ubuntu%2014.04%3F" 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%2F2016%2F04%2Fpostgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Install%20PostgreSQL%209.4%20on%20Ubuntu%2014.04%3F" 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%2F2016%2F04%2Fpostgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Install%20PostgreSQL%209.4%20on%20Ubuntu%2014.04%3F" 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%2F2016%2F04%2Fpostgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04%2F&amp;linkname=PostgreSQL%3A%20How%20to%20Install%20PostgreSQL%209.4%20on%20Ubuntu%2014.04%3F" 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%2F2016%2F04%2Fpostgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04%2F&#038;title=PostgreSQL%3A%20How%20to%20Install%20PostgreSQL%209.4%20on%20Ubuntu%2014.04%3F" data-a2a-url="https://www.dbrnd.com/2016/04/postgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04/" data-a2a-title="PostgreSQL: How to Install PostgreSQL 9.4 on Ubuntu 14.04?"></a></p><p><a href="https://www.dbrnd.com/wp-content/uploads/2016/04/elephant-kruger.jpg" rel="attachment wp-att-2263"><img loading="lazy" decoding="async" class="alignleft wp-image-2263 size-medium" title="PostgreSQL Elephant" src="https://www.dbrnd.com/wp-content/uploads/2016/04/elephant-kruger-300x218.jpg" alt="PostgreSQL Elephant" width="300" height="218" srcset="https://www.dbrnd.com/wp-content/uploads/2016/04/elephant-kruger-300x218.jpg 300w, https://www.dbrnd.com/wp-content/uploads/2016/04/elephant-kruger-150x109.jpg 150w, https://www.dbrnd.com/wp-content/uploads/2016/04/elephant-kruger.jpg 622w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>&nbsp;</p>
<p><em><a href="http://www.postgresql.org/about/" target="_blank">PostgreSQL is a powerful,</a> open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness.</em></p>
<p>I am going to share few steps on how to install PostgreSQL 9.4 on Ubuntu 14.04.</p>
<p><strong>First, check the version of Ubuntu:</strong><br />
<pre class="crayon-plain-tag">lsb_release -sc</pre>
<p><strong>You need to add the latest PostgreSQL repository for the latest version, otherwise It will install PostgreSQL 9.3. This is for trusty version.</strong><br />
<pre class="crayon-plain-tag">sudo add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main"</pre>
<p><strong>Update and Install PostgreSQL 9.4:</strong><br />
<pre class="crayon-plain-tag">sudo apt-get update
sudo apt-get install postgresql-9.4</pre>
<p><strong>Default postgres super user and postgres database is created. You need to set a password for the postgres super user. </strong><br />
<pre class="crayon-plain-tag">ubuntu@:~$ sudo passwd postgres
Enter new UNIX password:****
Retype new UNIX password:****
passwd: password updated successfully</pre>
<p><strong>If service is not started, you can start the PostgreSQL service. </strong><br />
<pre class="crayon-plain-tag">sudo service postgresql start</pre>
<p><strong>Connect PostgreSQL server using postgres user:</strong><br />
<pre class="crayon-plain-tag">ubuntu@:~$ su postgres
Password:****</pre>
<p><strong>Create a sample database:</strong><br />
<pre class="crayon-plain-tag">createdb database_name</pre>
<p><strong>Connect to that database:</strong><br />
<pre class="crayon-plain-tag">psql -d database_name</pre>
<p><strong>Create a sample table:</strong><br />
<pre class="crayon-plain-tag">create table Test (rno integer);</pre>
<p><strong>Exit to database session:</strong><br />
<pre class="crayon-plain-tag">\q</pre>
<p><strong>Exit to PostgreSQL server:</strong><br />
<pre class="crayon-plain-tag">exit</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
