<?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>Extra Connections Ltd &#187; Oracle</title>
	<atom:link href="http://www.extraconnections.co.uk/blog/category/oracle/feed" rel="self" type="application/rss+xml" />
	<link>http://www.extraconnections.co.uk</link>
	<description>Oracle and Internet Solutions from Chris Hunt</description>
	<lastBuildDate>Tue, 05 Aug 2008 10:48:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Read Access to Package Bodies</title>
		<link>http://www.extraconnections.co.uk/blog/read-access-to-package-bodies</link>
		<comments>http://www.extraconnections.co.uk/blog/read-access-to-package-bodies#comments</comments>
		<pubDate>Thu, 31 Jan 2008 15:44:03 +0000</pubDate>
		<dc:creator>Chris Hunt</dc:creator>
				<category><![CDATA[Hints & Tips]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.extraconnections.co.uk/blog/read-access-to-package-bodies</guid>
		<description><![CDATA[I&#8217;ve recently been asked to grant a user permission to read a package body owned by another user. It&#8217;s surprisingly difficult to do. There&#8217;s no object privilege that you can grant that will do this, instead you have to grant read access on DBA_SOURCE to the second user for them to see the first user&#8217;s source [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been asked to grant a user permission to read a package body owned by another user. It&#8217;s surprisingly difficult to do.</p>
<p>There&#8217;s no object privilege that you can grant that will do this, instead you have to grant read access on DBA_SOURCE to the second user for them to see the first user&#8217;s source code. One problem with this is that you&#8217;ll grant them the right to read <em>everybody&#8217;s</em> code. If this is an issue (and it may well be) you&#8217;ll have to create a view which limits the rows that can be returned:</p>
<pre class="code">CREATE VIEW some_source AS
SELECT *
FROM   sys.dba_source
WHERE  owner = 'X'
AND    name = 'Y'</pre>
<p>Remember to follow my <a href="/blog/fun-with-oracle-permissions">earlier tip</a> with regard to granting permissions if you take this approach.</p>
<p>If you&#8217;re happy to grant the straight DBA view to the other user, and they want to view the package source using TOAD, there&#8217;s a bit more to do. Firstly, they&#8217;ll need access to DBA_OBJECTS as well. Secondly, they&#8217;ll need to tweak their TOAD setup as follows:</p>
<ol>
<li>Select View/Options from the menu.</li>
<li>Select &#8220;StartUp&#8221; from the tree view on the left.</li>
<li>Tick the &#8220;Check for access to DBA views&#8221; checkbox.</li>
</ol>
<p>Next time they log on they&#8217;ll be able to see package bodies.</p>
<p>Incidentally, there&#8217;s an important moral to this story: Comment your packages in the specification, not the body (well, OK, you should comment the body too). Most of the time you won&#8217;t want to do the above hacking, so people need to be able to work out what a packaged program unit does from looking at the part of the package they can see!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.extraconnections.co.uk/blog/read-access-to-package-bodies/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with Oracle Permissions</title>
		<link>http://www.extraconnections.co.uk/blog/fun-with-oracle-permissions</link>
		<comments>http://www.extraconnections.co.uk/blog/fun-with-oracle-permissions#comments</comments>
		<pubDate>Thu, 19 Apr 2007 10:30:12 +0000</pubDate>
		<dc:creator>Chris Hunt</dc:creator>
				<category><![CDATA[Hints & Tips]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.extraconnections.co.uk/blog/fun-with-oracle-permissions</guid>
		<description><![CDATA[Here&#8217;s an unexpected piece of Oracle behaviour that had me tearing my hair out last night until I figured out what was going on. It&#8217;s to do with object permissions as applied to views. Suppose you have an oracle user called TABLE_OWNER who grants select access on his table to a role which all users [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an unexpected piece of Oracle behaviour that had me tearing my hair out last night until I figured out what was going on. It&#8217;s to do with object permissions as applied to views.</p>
<p>Suppose you have an oracle user called TABLE_OWNER who grants select access on his table to a role which all users have. One of those user, let&#8217;s call him VIEW_OWNER, creates a view based on that table and also grants select access on it to everybody.</p>
<p>Now, what happens when a third user attempts to select from the view? They get an &#8220;ORA-1031: Insufficient Privileges&#8221; error. Remember, they have select permission on both the view and the underlying table, so what&#8217;s happening?</p>
<p>The answer is that it&#8217;s Oracle security going a bit overboard. VIEW_OWNER has permission to see TABLE_OWNER&#8217;s table, but by creating a view of it and granting other users permission to view it, he&#8217;s effectively granting them select permission on the table. You need permission to do that, and VIEW_OWNER doesn&#8217;t have it. Curiously, this check is made when others try to select the view, rather than when the grant is made.</p>
<p>The solution is for TABLE_OWNER to do this:</p>
<pre class="code">GRANT SELECT ON my_table TO view_owner WITH GRANT OPTION;</pre>
<p>That gives VIEW_OWNER permission to pass on the privilege, and thus other users permission to select from the view.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.extraconnections.co.uk/blog/fun-with-oracle-permissions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
