<?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>user &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/user/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>Sat, 27 Jan 2018 20:54:17 +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>SQL Server: Msg 262, SHOWPLAN permission denied in database</title>
		<link>https://www.dbrnd.com/2018/02/sql-server-msg-262-showplan-permission-denied-in-database/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 16 Feb 2018 16:16:20 +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[Execution Plan Permission]]></category>
		<category><![CDATA[SHOWPLAN]]></category>
		<category><![CDATA[SQL Query]]></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[TSQL]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7098</guid>

					<description><![CDATA[If you are SQL DBA and managing database users, you might be facing this error. Mostly, when you created a read-only database user then additionally you should give SHOWPLAN permission. If the user is interested in checking the SQL Queries Execution Plan, it requires SHOWPLAN permission. Error: [crayon-6a9acd85ea6ec875250427/] Solution: [crayon-6a9acd85ea6ef680388335/]]]></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%2F02%2Fsql-server-msg-262-showplan-permission-denied-in-database%2F&amp;linkname=SQL%20Server%3A%20Msg%20262%2C%20SHOWPLAN%20permission%20denied%20in%20database" 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%2F02%2Fsql-server-msg-262-showplan-permission-denied-in-database%2F&amp;linkname=SQL%20Server%3A%20Msg%20262%2C%20SHOWPLAN%20permission%20denied%20in%20database" 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%2F02%2Fsql-server-msg-262-showplan-permission-denied-in-database%2F&amp;linkname=SQL%20Server%3A%20Msg%20262%2C%20SHOWPLAN%20permission%20denied%20in%20database" 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%2F02%2Fsql-server-msg-262-showplan-permission-denied-in-database%2F&amp;linkname=SQL%20Server%3A%20Msg%20262%2C%20SHOWPLAN%20permission%20denied%20in%20database" 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%2F02%2Fsql-server-msg-262-showplan-permission-denied-in-database%2F&amp;linkname=SQL%20Server%3A%20Msg%20262%2C%20SHOWPLAN%20permission%20denied%20in%20database" 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%2F02%2Fsql-server-msg-262-showplan-permission-denied-in-database%2F&amp;linkname=SQL%20Server%3A%20Msg%20262%2C%20SHOWPLAN%20permission%20denied%20in%20database" 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%2F02%2Fsql-server-msg-262-showplan-permission-denied-in-database%2F&#038;title=SQL%20Server%3A%20Msg%20262%2C%20SHOWPLAN%20permission%20denied%20in%20database" data-a2a-url="https://www.dbrnd.com/2018/02/sql-server-msg-262-showplan-permission-denied-in-database/" data-a2a-title="SQL Server: Msg 262, SHOWPLAN permission denied in database"></a></p><p>If you are SQL DBA and managing database users, you might be facing this error. </p>
<p>Mostly, when you created a read-only database user then additionally you should give SHOWPLAN permission. </p>
<p>If the user is interested in checking the SQL Queries Execution Plan, it requires SHOWPLAN permission. </p>
<p><strong>Error:</strong></p>
<pre class="crayon-plain-tag">Msg 262, Level 14, State 4, Line 9
SHOWPLAN permission denied in database 'database_name'.</pre> </p>
<p><strong>Solution:</strong></p>
<pre class="crayon-plain-tag">GRANT SHOWPLAN TO User_Name
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Script to find Database USER LOGIN Information</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-script-to-find-database-user-login-information-password-expiration-authentication-security/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 27 Jan 2018 16:16:44 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[login expiration]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4047</guid>

					<description><![CDATA[In this post, I am sharing one T-SQL Script to find SQL Server USER LOGIN Information. As a DBA, we should check the USER LOGIN Information to make sure about the user expiration, password expiration. Using password expiration information, you can also notify the user before its password expires. [crayon-6a9acd85ea9d6202933576/]]]></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%2F01%2Fsql-server-script-to-find-database-user-login-information-password-expiration-authentication-security%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Database%20USER%20LOGIN%20Information" 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%2F01%2Fsql-server-script-to-find-database-user-login-information-password-expiration-authentication-security%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Database%20USER%20LOGIN%20Information" 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%2F01%2Fsql-server-script-to-find-database-user-login-information-password-expiration-authentication-security%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Database%20USER%20LOGIN%20Information" 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%2F01%2Fsql-server-script-to-find-database-user-login-information-password-expiration-authentication-security%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Database%20USER%20LOGIN%20Information" 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%2F01%2Fsql-server-script-to-find-database-user-login-information-password-expiration-authentication-security%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Database%20USER%20LOGIN%20Information" 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%2F01%2Fsql-server-script-to-find-database-user-login-information-password-expiration-authentication-security%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Database%20USER%20LOGIN%20Information" 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%2F01%2Fsql-server-script-to-find-database-user-login-information-password-expiration-authentication-security%2F&#038;title=SQL%20Server%3A%20Script%20to%20find%20Database%20USER%20LOGIN%20Information" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-script-to-find-database-user-login-information-password-expiration-authentication-security/" data-a2a-title="SQL Server: Script to find Database USER LOGIN Information"></a></p><p>In this post, I am sharing one T-SQL Script to find SQL Server USER LOGIN Information. </p>
<blockquote><p>As a DBA, we should check the USER LOGIN Information to make sure about the user expiration, password expiration.<br />
Using password expiration information, you can also notify the user before its password expires. </p></blockquote>
<pre class="crayon-plain-tag">SELECT 
	SL.name AS LoginName 
	,LOGINPROPERTY (SL.name, 'PasswordLastSetTime') AS PasswordLastSetTime 
	,LOGINPROPERTY (SL.name, 'DaysUntilExpiration') AS DaysUntilExpiration 
	,DATEADD(dd, CONVERT(int, LOGINPROPERTY (SL.name, 'DaysUntilExpiration')) 
				, CONVERT(datetime, LOGINPROPERTY (SL.name, 'PasswordLastSetTime'))) AS PasswordExpiration 
	,SL.is_policy_checked AS IsPolicyChecked 
	,LOGINPROPERTY (SL.name, 'IsExpired') AS IsExpired 
	,LOGINPROPERTY (SL.name, 'IsMustChange') AS IsMustChange 
	,LOGINPROPERTY (SL.name, 'IsLocked') AS IsLocked 
	,LOGINPROPERTY (SL.name, 'LockoutTime') AS LockoutTime 
	,LOGINPROPERTY (SL.name, 'BadPasswordCount') AS BadPasswordCount 
	,LOGINPROPERTY (SL.name, 'BadPasswordTime') AS BadPasswordTime 
	,LOGINPROPERTY (SL.name, 'HistoryLength') AS HistoryLength 
FROM sys.sql_logins AS SL 
WHERE is_expiration_checked = 1 
ORDER BY LOGINPROPERTY (SL.name, 'PasswordLastSetTime') DESC</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Find total number of Sessions of a Database</title>
		<link>https://www.dbrnd.com/2018/01/sql-server-find-total-number-of-sessions-of-a-database/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 24 Jan 2018 16:16:11 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 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[dm_tran_locks]]></category>
		<category><![CDATA[Session]]></category>
		<category><![CDATA[SQL Query]]></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[TSQL]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6982</guid>

					<description><![CDATA[In this post, I am sharing a script for getting a total number of connected sessions of a SQL Server Database. There are multiple ways for getting the information of connected users, but I am sharing one of the handy DBA scripts which they can use in their day to day work. Check the 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%2F2018%2F01%2Fsql-server-find-total-number-of-sessions-of-a-database%2F&amp;linkname=SQL%20Server%3A%20Find%20total%20number%20of%20Sessions%20of%20a%20Database" 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%2F01%2Fsql-server-find-total-number-of-sessions-of-a-database%2F&amp;linkname=SQL%20Server%3A%20Find%20total%20number%20of%20Sessions%20of%20a%20Database" 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%2F01%2Fsql-server-find-total-number-of-sessions-of-a-database%2F&amp;linkname=SQL%20Server%3A%20Find%20total%20number%20of%20Sessions%20of%20a%20Database" 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%2F01%2Fsql-server-find-total-number-of-sessions-of-a-database%2F&amp;linkname=SQL%20Server%3A%20Find%20total%20number%20of%20Sessions%20of%20a%20Database" 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%2F01%2Fsql-server-find-total-number-of-sessions-of-a-database%2F&amp;linkname=SQL%20Server%3A%20Find%20total%20number%20of%20Sessions%20of%20a%20Database" 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%2F01%2Fsql-server-find-total-number-of-sessions-of-a-database%2F&amp;linkname=SQL%20Server%3A%20Find%20total%20number%20of%20Sessions%20of%20a%20Database" 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%2F01%2Fsql-server-find-total-number-of-sessions-of-a-database%2F&#038;title=SQL%20Server%3A%20Find%20total%20number%20of%20Sessions%20of%20a%20Database" data-a2a-url="https://www.dbrnd.com/2018/01/sql-server-find-total-number-of-sessions-of-a-database/" data-a2a-title="SQL Server: Find total number of Sessions of a Database"></a></p><p>In this post, I am sharing a script for getting a total number of connected sessions of a SQL Server Database. </p>
<p>There are multiple ways for getting the information of connected users, but I am sharing one of the handy DBA scripts which they can use in their day to day work. </p>
<p><strong>Check the below script: </strong></p>
<pre class="crayon-plain-tag">select
       db_name (resource_database_id) as DatabaseName
       ,count (*) as TotalSessions
from sys.dm_tran_locks
where resource_type = 'DATABASE'
	and db_name (resource_database_id) = 'Database_Name'
group by db_name (resource_database_id)
order by db_name (resource_database_id)</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Greenplum: Script to find Role information with associated Resource Queue</title>
		<link>https://www.dbrnd.com/2017/06/greenplum-script-to-find-role-information-with-associated-resource-queue/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 15 Jun 2017 16:16:33 +0000</pubDate>
				<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Greenplum 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[Greenplum Administrator]]></category>
		<category><![CDATA[Greenplum Error]]></category>
		<category><![CDATA[Greenplum Monitoring]]></category>
		<category><![CDATA[Greenplum Performance Tuning]]></category>
		<category><![CDATA[Greenplum Programming]]></category>
		<category><![CDATA[Greenplum Query]]></category>
		<category><![CDATA[Greenplum Tips and Tricks]]></category>
		<category><![CDATA[PostgreSQL 8.2]]></category>
		<category><![CDATA[Resource Queues]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5409</guid>

					<description><![CDATA[In this post, I am sharing a script to find Greenplum user role information with their associated Resource Queue. You can also find other details like type of user and its validity. We can also use this script to prepare an audit on a list of available users/roles of Greenplum. [crayon-6a9acd85eb70e159809768/]]]></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%2Fgreenplum-script-to-find-role-information-with-associated-resource-queue%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Role%20information%20with%20associated%20Resource%20Queue" 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%2Fgreenplum-script-to-find-role-information-with-associated-resource-queue%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Role%20information%20with%20associated%20Resource%20Queue" 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%2Fgreenplum-script-to-find-role-information-with-associated-resource-queue%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Role%20information%20with%20associated%20Resource%20Queue" 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%2Fgreenplum-script-to-find-role-information-with-associated-resource-queue%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Role%20information%20with%20associated%20Resource%20Queue" 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%2Fgreenplum-script-to-find-role-information-with-associated-resource-queue%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Role%20information%20with%20associated%20Resource%20Queue" 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%2Fgreenplum-script-to-find-role-information-with-associated-resource-queue%2F&amp;linkname=Greenplum%3A%20Script%20to%20find%20Role%20information%20with%20associated%20Resource%20Queue" 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%2Fgreenplum-script-to-find-role-information-with-associated-resource-queue%2F&#038;title=Greenplum%3A%20Script%20to%20find%20Role%20information%20with%20associated%20Resource%20Queue" data-a2a-url="https://www.dbrnd.com/2017/06/greenplum-script-to-find-role-information-with-associated-resource-queue/" data-a2a-title="Greenplum: Script to find Role information with associated Resource Queue"></a></p><p>In this post, I am sharing a script to find Greenplum user role information with their associated Resource Queue. You can also find other details like type of user and its validity.<br />
We can also use this script to prepare an audit on a list of available users/roles of Greenplum.</p>
<pre class="crayon-plain-tag">SELECT rolname as RoleName
   ,case
	  when rolsuper = 't' then
		   'SUPERUSER'
	  else
		   'NORMAL'
	  end as SuperUser
   ,case
	  when rolcanlogin = 't' then
		   'LOGIN'
	  else
		   'GROUP'
   end as RoleType
   ,rolvaliduntil as RoleValidUntill
   ,rsqname as RQName
FROM pg_roles, gp_toolkit.gp_resqueue_status
WHERE pg_roles.rolresqueue=gp_toolkit.gp_resqueue_status.queueid
order by rolname;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Who dropped a Table and Which Table has been dropped</title>
		<link>https://www.dbrnd.com/2016/12/sql-server-who-dropped-a-table-and-which-table-has-been-dropped/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 12 Dec 2016 20:14:17 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[CDC]]></category>
		<category><![CDATA[Change data capture]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DDL Trii]]></category>
		<category><![CDATA[drop]]></category>
		<category><![CDATA[drop table]]></category>
		<category><![CDATA[fn_dblog()]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[transaction log]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4063</guid>

					<description><![CDATA[SQL Server provides different types of database auditing option like: CDC, Database Audit. Recently, I have shared one article about, change your database DDL changes using Encrypted DDL triggers. SQL Server: Encrypted DDL Trigger to Track all Database Changes Database Administrators are responsible for database security and Periodically, They have to track all the database [&#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%2F12%2Fsql-server-who-dropped-a-table-and-which-table-has-been-dropped%2F&amp;linkname=SQL%20Server%3A%20Who%20dropped%20a%20Table%20and%20Which%20Table%20has%20been%20dropped" 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%2F12%2Fsql-server-who-dropped-a-table-and-which-table-has-been-dropped%2F&amp;linkname=SQL%20Server%3A%20Who%20dropped%20a%20Table%20and%20Which%20Table%20has%20been%20dropped" 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%2F12%2Fsql-server-who-dropped-a-table-and-which-table-has-been-dropped%2F&amp;linkname=SQL%20Server%3A%20Who%20dropped%20a%20Table%20and%20Which%20Table%20has%20been%20dropped" 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%2F12%2Fsql-server-who-dropped-a-table-and-which-table-has-been-dropped%2F&amp;linkname=SQL%20Server%3A%20Who%20dropped%20a%20Table%20and%20Which%20Table%20has%20been%20dropped" 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%2F12%2Fsql-server-who-dropped-a-table-and-which-table-has-been-dropped%2F&amp;linkname=SQL%20Server%3A%20Who%20dropped%20a%20Table%20and%20Which%20Table%20has%20been%20dropped" 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%2F12%2Fsql-server-who-dropped-a-table-and-which-table-has-been-dropped%2F&amp;linkname=SQL%20Server%3A%20Who%20dropped%20a%20Table%20and%20Which%20Table%20has%20been%20dropped" 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%2F12%2Fsql-server-who-dropped-a-table-and-which-table-has-been-dropped%2F&#038;title=SQL%20Server%3A%20Who%20dropped%20a%20Table%20and%20Which%20Table%20has%20been%20dropped" data-a2a-url="https://www.dbrnd.com/2016/12/sql-server-who-dropped-a-table-and-which-table-has-been-dropped/" data-a2a-title="SQL Server: Who dropped a Table and Which Table has been dropped"></a></p><p>SQL Server provides different types of database auditing option like: CDC, Database Audit.<br />
Recently, I have shared one article about, change your database DDL changes using Encrypted DDL triggers. </p>
<blockquote class="wp-embedded-content" data-secret="0nSvSWs9bx"><p><a href="https://www.dbrnd.com/2016/10/sql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security/">SQL Server: Encrypted DDL Trigger to Track all Database Changes</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/10/sql-server-encrypted-ddl-trigger-to-track-all-database-changes-to-ensure-database-object-security/embed/#?secret=0nSvSWs9bx" data-secret="0nSvSWs9bx" width="600" height="338" title="&#8220;SQL Server: Encrypted DDL Trigger to Track all Database Changes&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>Database Administrators are responsible for database security and Periodically, They have to track all the database related changes and make sure that everything is working fine. </p></blockquote>
<blockquote><p>But still sometimes, I used to track database changes from the SQL Server log files using fn_dblog().<br />
I am sharing one way to find a person who dropped a table and also can get the name of that dropped table without enabling any auditing option of SQL Server.</p></blockquote>
<p><strong>Script to find the log of dropped objects:</strong></p>
<blockquote><p>Using this script, you can find a list of dropped tables and login name information, but you cannot get table name directly.<br />
You can find the transaction id for each record and using this transaction ID, you can find the table name.</p></blockquote>
<pre class="crayon-plain-tag">SELECT 
	[Transaction Id]
	,[Begin Time]
	,SUSER_SNAME ([Transaction SID]) AS [LoginName] 
FROM fn_dblog (NULL, NULL)  
WHERE [Transaction Name] = N'DROPOBJ';</pre> </p>
<p><strong>Find Table name using TransactionID:</strong></p>
<pre class="crayon-plain-tag">SELECT TOP 1 
	[Lock Information] 
FROM fn_dblog (NULL, NULL)  
WHERE [Transaction Id] = '0000:0015d6b3'  
AND [Lock Information] LIKE '%SCH_M OBJECT%';</pre> </p>
<p><strong>The result:</strong><br />
To get the table name, you can copy the number and search into sys.objects table.</p>
<pre class="crayon-plain-tag">HoBt 0:ACQUIRE_LOCK_SCH_M OBJECT: 8:1015674666:0</pre> </p>
<p><strong>Find your dropped table:</strong><br />
Please do not start to search your dropped table in your current database because Table already dropped.<br />
You must restore the last backup of the database and you should search your dropped table in that database. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.objects 
WHERE Object_ID ='1015674666'</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: pg_ident.conf to map Operating System Username and Database Username</title>
		<link>https://www.dbrnd.com/2016/12/postgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password/</link>
					<comments>https://www.dbrnd.com/2016/12/postgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 08 Dec 2016 18:19:29 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[pg_hba.conf]]></category>
		<category><![CDATA[pg_ident.conf]]></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 Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4013</guid>

					<description><![CDATA[If you do not know about the role of pg_hba.conf file, visit the below link. PostgreSQL: How to Allow Remote Connection to Connect Database PostgreSQL also has a one more file related user access permission and that is pg_ident.conf. PostgreSQL provides Ident-based authentication and It works by obtaining the client&#8217;s operating system user name and [&#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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&#038;title=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" data-a2a-url="https://www.dbrnd.com/2016/12/postgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password/" data-a2a-title="PostgreSQL: pg_ident.conf to map Operating System Username and Database Username"></a></p><p>If you do not know about the role of pg_hba.conf file, visit the below link.</p>
<blockquote class="wp-embedded-content" data-secret="JrH3IqJXlV"><p><a href="https://www.dbrnd.com/2016/01/postgresql-how-to-allow-remote-connection-to-connect-database/">PostgreSQL: How to Allow Remote Connection to Connect Database</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/01/postgresql-how-to-allow-remote-connection-to-connect-database/embed/#?secret=JrH3IqJXlV" data-secret="JrH3IqJXlV" width="600" height="338" title="&#8220;PostgreSQL: How to Allow Remote Connection to Connect Database&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>PostgreSQL also has a one more file related user access permission and that is pg_ident.conf.<br />
PostgreSQL provides Ident-based authentication and It works by obtaining the client&#8217;s operating system user name and using it as the allowed database user name with an optional user name mapping.</p></blockquote>
<blockquote><p>When we are using an external authentication system, system username might not be the same as database username. </p></blockquote>
<blockquote><p>To allow external authentication, We should map the system username with database username and we can also set a map name to hide the system username and database username related detail.</p></blockquote>
<p>For example, </p>
<p><strong>Go to the PostgreSQL data directory and Open pg_ident.conf file.</strong><br />
<strong>You can find below lines:</strong></p>
<pre class="crayon-plain-tag"># Put your actual configuration here
# ----------------------------------
# MAPNAME       SYSTEM-USERNAME         PG-USERNAME</pre> </p>
<p><strong>You can add value to map system username and database username:</strong></p>
<pre class="crayon-plain-tag"># Put your actual configuration here
# ----------------------------------
# MAPNAME       SYSTEM-USERNAME         PG-USERNAME
User123         LinuxUser               PGUser</pre> </p>
<blockquote><p>Once you map your system user and database user in pg_ident.conf file, you can use map name in pg_hba.conf file to allow external authentication.</p></blockquote>
<p><strong>Go to your PostgreSQL data directory and open a pg_hba.conf file.</strong></p>
<p>You can add the map name of system user and database user in METHOD column.<br />
For Example, </p>
<pre class="crayon-plain-tag"># TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             120.172.0.0/16          ident map=User123</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/12/postgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Find which object assigns to which user or role and vice versa</title>
		<link>https://www.dbrnd.com/2016/10/postgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 05 Oct 2016 16:16:25 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[access privileges]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[has_table_privilege()]]></category>
		<category><![CDATA[object permission]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[pg_has_role()]]></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 Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[REVOKE]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3699</guid>

					<description><![CDATA[As a Database Administrator, we are following common practice by creating Database User or Role and assign only require permission to it. When we are assigning different object level permission to particular Database Role, It is also important check total assigned object to particular Database Role or Which object assigned to which Role/User? Most of [&#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%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" 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%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" 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%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" 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%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" 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%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" 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%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" 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%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&#038;title=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" data-a2a-url="https://www.dbrnd.com/2016/10/postgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list/" data-a2a-title="PostgreSQL: Find which object assigns to which user or role and vice versa"></a></p><p>As a Database Administrator, we are following common practice by creating Database User or Role and assign only require permission to it. </p>
<blockquote><p>When we are assigning different object level permission to particular Database Role, It is also important check total assigned object to particular Database Role or Which object assigned to which Role/User?</p></blockquote>
<blockquote><p>Most of the Database Administrators do not have practice to audit the list of assigned permissions of particular Database User/Role. </p></blockquote>
<blockquote><p>It is fine that we are securing database access using specific role, but that is also similarly important to check information about the assigned object and Database Role.<br />
Periodically, Database Administrator should review the list of permissions which assigned to a Database Role/User.</p></blockquote>
<blockquote><p>PostgreSQL provides list of system functions for auditing User, Role, and its permissions.</p></blockquote>
<p>In PostgreSQL, these functions called as Access Privilege Inquiry Functions.<br />
<a href="https://www.postgresql.org/docs/9.1/static/functions-info.html" target="_blank">You can find list of functions in this official document. </a></p>
<p>I have also prepared a small demonstration of this.</p>
<p><strong>First, Create a sample restricted database ROLE:</strong></p>
<pre class="crayon-plain-tag">CREATE ROLE Test_User WITH LOGIN PASSWORD 'Test1234' 
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity';</pre> </p>
<p><strong>Assign SELECT, INSERT permission on one sample tbl_employees table:</strong></p>
<pre class="crayon-plain-tag">GRANT SELECT,INSERT ON tbl_employees TO Test_User;</pre> </p>
<p><strong>Using has_table_privilege(), Script to find list of Users or Roles, who have a INSERT permission on tbl_employees. </strong></p>
<pre class="crayon-plain-tag">SELECT rolname 
FROM pg_roles 
WHERE has_table_privilege(rolname, 'tbl_employees', 'INSERT');</pre> </p>
<p><strong>Using pg_has_role(), Script to find list of objects, on which particular User or Role have INSERT permission. </strong></p>
<pre class="crayon-plain-tag">SELECT 
	DISTINCT relname
FROM pg_roles CROSS JOIN pg_class
WHERE pg_has_role('test_user', rolname, 'MEMBER')
	AND has_table_privilege(rolname, pg_class.oid, 'INSERT');</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Script to Create a Read-Only Database User</title>
		<link>https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/</link>
					<comments>https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 22 Oct 2015 16:20:45 +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[permission]]></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 Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[PostgreSQL Tuning]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=911</guid>

					<description><![CDATA[In this post, I am sharing the help on how to create, a read-only user with limited access in PostgreSQL Database Server?. As a Database Administrator, you should create different database users for the different purposes. In the standard application, there are a few various types of Database Users like Application user, Read-only user, Admin [&#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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%20User" 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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%20User" 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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%20User" 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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%20User" 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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%20User" 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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%20User" 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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&#038;title=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%20User" data-a2a-url="https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/" data-a2a-title="PostgreSQL: Script to Create a Read-Only Database User"></a></p><p>In this post, I am sharing the help on how to create, a read-only user with limited access in PostgreSQL Database Server?.</p>
<p>As a Database Administrator, you should create different database users for the different purposes.<br />
In the standard application, there are a few various types of Database Users like Application user, Read-only user, Admin user.</p>
<p><strong>You should always create a shared database role group and assign roles to the user. </strong></p>
<p>Here, I am sharing one script to create the read only user with limited access to PostgreSQL Database. This user can only SELECT table data and also restricted by schema access. </p>
<p><strong>Create the Read-Only user:</strong></p>
<pre class="crayon-plain-tag">CREATE ROLE Read_Only_User WITH LOGIN PASSWORD 'Test1234' 
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity';</pre> </p>
<p><strong>Assign permissions to the read only user:</strong></p>
<pre class="crayon-plain-tag">GRANT CONNECT ON DATABASE YourDatabaseName TO Read_Only_User;
GRANT USAGE ON SCHEMA public TO Read_Only_User;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO Read_Only_User;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO Read_Only_User;</pre> </p>
<p>In the above script, you can find that I restricted user by Database, Schema and gave only SELECT permission for tables. </p>
<p><strong>If you need to give any additional permission like EXECUTE permission for functions, use below script. </strong></p>
<pre class="crayon-plain-tag">GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO Read_Only_User;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
