<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Inherited privileges</title>
    <link>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/</link>
    <description>Recent content in Inherited privileges on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Admin: Enabling database inheritance</title>
      <link>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/enabling-db-inheritance/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/enabling-db-inheritance/</guid>
      <description>
        
        
        &lt;p&gt;By default, inherited privileges are enabled at the database level. You can toggle database-level inherited privileges with the DisableInheritedPrivileges &lt;a href=&#34;../../../../../en/sql-reference/config-parameters/security-parameters/&#34;&gt;configuration parameter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To enable inherited privileges:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER DATABASE &lt;span class=&#34;code-variable&#34;&gt;database_name&lt;/span&gt; SET DisableInheritedPrivileges = 0;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To disable inherited privileges:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER DATABASE &lt;span class=&#34;code-variable&#34;&gt;database_name&lt;/span&gt; SET DisableInheritedPrivileges = 1;
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Admin: Enabling schema inheritance</title>
      <link>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/enabling-schema-inheritance/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/enabling-schema-inheritance/</guid>
      <description>
        
        
        
&lt;div class=&#34;admonition caution&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Caution&lt;/h4&gt;

&lt;p&gt;Enabling inherited privileges with ALTER SCHEMA ... DEFAULT INCLUDE PRIVILEGES only affects &lt;em&gt;newly&lt;/em&gt; created tables, views, and models.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;This setting does not affect existing tables, views, and models&lt;/em&gt;.&lt;/p&gt;


&lt;/div&gt;

&lt;p&gt;By default, inherited privileges are disabled at the schema level. If inherited privileges are enabled at the database level, you can enable inheritance at the schema level with &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-schema/#&#34;&gt;CREATE SCHEMA&lt;/a&gt; and &lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-schema/#&#34;&gt;ALTER SCHEMA&lt;/a&gt;. For example, the following statement creates the schema my_schema with schema inheritance enabled:&lt;/p&gt;
&lt;p&gt;To create a schema with schema inheritance enabled:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE SCHEMA my_schema DEFAULT INCLUDE PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To enable schema inheritance for an existing schema:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER SCHEMA my_schema DEFAULT INCLUDE SCHEMA PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After schema-level privilege inheritance is enabled, privileges granted on the schema are automatically inherited by all newly created tables, views, and models in that schema. You can explicitly exclude a table, view, or model from privilege inheritance with the following statements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-table/#&#34;&gt;CREATE TABLE&lt;/a&gt;/&lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-view/#&#34;&gt;CREATE VIEW&lt;/a&gt;/&lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-view/#&#34;&gt;ALTER VIEW&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-model/#&#34;&gt;ALTER MODEL&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, to prevent my_table from inheriting the privileges of my_schema:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER TABLE my_schema.my_table EXCLUDE SCHEMA PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For information about which objects inherit privileges from which schemas, see &lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/inheriting-objects/#&#34;&gt;INHERITING_OBJECTS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For information about which privileges each object inherits, see &lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/inherited-privileges/#&#34;&gt;INHERITED_PRIVILEGES&lt;/a&gt;.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;p&gt;If inherited privileges are disabled for the database, enabling inheritance on its schemas has no effect. Attempts to do so return the following message:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Inherited privileges are globally disabled; schema parameter is set but has no effect.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;schema-inheritance-for-existing-objects&#34;&gt;Schema inheritance for existing objects&lt;/h2&gt;
&lt;p&gt;Enabling schema inheritance on an existing schema only affects newly created tables, views, and models in that schema. To allow an existing objects to inherit the privileges from their parent schema, you must explicitly set schema inheritance on each object with &lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt;, &lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-view/#&#34;&gt;ALTER VIEW&lt;/a&gt;, or &lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-model/#&#34;&gt;ALTER MODEL&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For example, my_schema contains my_table, my_view, and my_model. Enabling schema inheritance on my_schema does not affect the privileges of my_table and my_view. The following statements explicitly set schema inheritance on these objects:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER VIEW my_schema.my_view INCLUDE SCHEMA PRIVILEGES;
=&amp;gt; ALTER TABLE my_schema.my_table INCLUDE SCHEMA PRIVILEGES;
=&amp;gt; ALTER MODEL my_schema.my_model INCLUDE SCHEMA PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After enabling inherited privileges on a schema, you can grant privileges on it to users and roles with &lt;a href=&#34;../../../../../en/sql-reference/statements/grant-statements/grant-schema/#&#34;&gt;GRANT (schema)&lt;/a&gt;. The specified user or role then implicitly has these same privileges on the objects in the schema:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; GRANT USAGE, CREATE, SELECT, INSERT ON SCHEMA my_schema TO PUBLIC;
GRANT PRIVILEGE
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/admin/db-users-and-privileges/db-privileges/inherited-privileges/setting-privilege-inheritance-on-tables-and-views/#&#34;&gt;Setting privilege inheritance on tables and views&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/admin/db-users-and-privileges/db-privileges/granting-and-revoking-privileges/#&#34;&gt;Granting and revoking privileges&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Admin: Setting privilege inheritance on tables and views</title>
      <link>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/setting-privilege-inheritance-on-tables-and-views/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/setting-privilege-inheritance-on-tables-and-views/</guid>
      <description>
        
        
        
&lt;div class=&#34;admonition caution&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Caution&lt;/h4&gt;

&lt;p&gt;Enabling inherited privileges with ALTER SCHEMA ... DEFAULT INCLUDE PRIVILEGES only affects &lt;em&gt;newly&lt;/em&gt; created tables, views, and models.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;This setting does not affect existing tables, views, and models&lt;/em&gt;.&lt;/p&gt;


&lt;/div&gt;

&lt;p&gt;If inherited privileges are enabled for the database and a schema, privileges granted to the schema are automatically granted to all new tables and views in it. You can also explicitly exclude tables and views from inheriting schema privileges.&lt;/p&gt;
&lt;p&gt;For information about which tables and views inherit privileges from which schemas, see &lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/inheriting-objects/#&#34;&gt;INHERITING_OBJECTS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For information about which privileges each table or view inherits, see the &lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/inherited-privileges/#&#34;&gt;INHERITED_PRIVILEGES&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;set-privileges-inheritance-on-tables-and-views&#34;&gt;Set privileges inheritance on tables and views&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-table/#&#34;&gt;CREATE TABLE&lt;/a&gt;/&lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt; and &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-view/#&#34;&gt;CREATE VIEW&lt;/a&gt;/&lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-view/#&#34;&gt;ALTER VIEW&lt;/a&gt; can allow tables and views to inherit privileges from their parent schemas. For example, the following statements enable inheritance on schema s1, so new table s1.t1 and view s1.myview automatically inherit the privileges set on that schema as applicable:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE SCHEMA s1 DEFAULT INCLUDE PRIVILEGES;
CREATE SCHEMA
=&amp;gt; GRANT USAGE, CREATE, SELECT, INSERT ON SCHEMA S1 TO PUBLIC;
GRANT PRIVILEGE
=&amp;gt; CREATE TABLE s1.t1 ( ID int, f_name varchar(16), l_name(24));
WARNING 6978:  Table &amp;#34;t1&amp;#34; will include privileges from schema &amp;#34;s1&amp;#34;
CREATE TABLE
=&amp;gt; CREATE VIEW s1.myview AS SELECT ID, l_name FROM s1.t1
WARNING 6978:  View &amp;#34;myview&amp;#34; will include privileges from schema &amp;#34;s1&amp;#34;
CREATE VIEW
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Both CREATE statements omit the clause INCLUDE SCHEMA PRIVILEGES, so they return a warning message that the new objects will inherit schema privileges. CREATE statements that include this clause do not return a warning message.

&lt;/div&gt;
&lt;p&gt;If the schema already exists, you can use ALTER SCHEMA to have all &lt;em&gt;newly created tables and views&lt;/em&gt; inherit the privileges of the schema. Tables and views created on the schema before this statement, however, are not affected:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE SCHEMA s2;
CREATE SCHEMA
=&amp;gt; CREATE TABLE s2.t22 ( a int );
CREATE TABLE
...
=&amp;gt; ALTER SCHEMA S2 DEFAULT INCLUDE PRIVILEGES;
ALTER SCHEMA
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this case, inherited privileges were enabled on schema s2 after it already contained table s2.t22. To set inheritance on this table and other existing tables and views, you must explicitly set schema inheritance on them with &lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt; and &lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-view/#&#34;&gt;ALTER VIEW&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER TABLE s2.t22 INCLUDE SCHEMA PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a name=&#34;Exclude&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;exclude-privileges-inheritance-from-tables-and-views&#34;&gt;Exclude privileges inheritance from tables and views&lt;/h2&gt;
&lt;p&gt;You can use &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-table/#&#34;&gt;CREATE TABLE&lt;/a&gt;/&lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-table/#&#34;&gt;ALTER TABLE&lt;/a&gt; and &lt;a href=&#34;../../../../../en/sql-reference/statements/create-statements/create-view/#&#34;&gt;CREATE VIEW&lt;/a&gt;/&lt;a href=&#34;../../../../../en/sql-reference/statements/alter-statements/alter-view/#&#34;&gt;ALTER VIEW&lt;/a&gt; to prevent table and views from inheriting schema privileges.&lt;/p&gt;
&lt;p&gt;The following example shows how to create a table that does not inherit schema privileges:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE s1.t1 ( x int) EXCLUDE SCHEMA PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can modify an existing table so it does not inherit schema privileges:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER TABLE s1.t1 EXCLUDE SCHEMA PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Admin: Example usage: implementing inherited privileges</title>
      <link>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/example-usage-implementing-inherited-privileges/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/admin/db-users-and-privileges/db-privileges/inherited-privileges/example-usage-implementing-inherited-privileges/</guid>
      <description>
        
        
        &lt;p&gt;The following steps show how user &lt;code&gt;Joe&lt;/code&gt; enables inheritance of privileges on a given schema so other users can access tables in that schema.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Joe&lt;/code&gt; creates schema &lt;code&gt;schema1&lt;/code&gt;, and creates table &lt;code&gt;table1&lt;/code&gt; in it:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt;\c - Joe
You are now connected as user Joe
=&amp;gt; CREATE SCHEMA schema1;
CRDEATE SCHEMA
=&amp;gt; CREATE TABLE schema1.table1 (id int);
CREATE TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Joe&lt;/code&gt; grants USAGE and CREATE privileges on &lt;code&gt;schema1&lt;/code&gt; to &lt;code&gt;Myra&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; GRANT USAGE, CREATE ON SCHEMA schema1 to Myra;
GRANT PRIVILEGE
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Myra&lt;/code&gt; queries &lt;code&gt;schema1.table1&lt;/code&gt;, but the query fails:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt;\c - Myra
You are now connected as user Myra
=&amp;gt; SELECT * FROM schema1.table1;
ERROR 4367: Permission denied for relation table1
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Joe&lt;/code&gt; grants &lt;code&gt;Myra&lt;/code&gt; &lt;code&gt;SELECT ON SCHEMA&lt;/code&gt; privileges on &lt;code&gt;schema1&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt;\c - Joe
You are now connected as user Joe
=&amp;gt; GRANT SELECT ON SCHEMA schema1 to Myra;
GRANT PRIVILEGE
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Joe&lt;/code&gt; uses &lt;code&gt;ALTER TABLE&lt;/code&gt; to include SCHEMA privileges for &lt;code&gt;table1&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; ALTER TABLE schema1.table1 INCLUDE SCHEMA PRIVILEGES;
ALTER TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Myra&lt;/code&gt;&#39;s query now succeeds:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt;\c - Myra
You are now connected as user Myra
=&amp;gt; SELECT * FROM schema1.table1;
id
---
(0 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Joe&lt;/code&gt; modifies &lt;code&gt;schema1&lt;/code&gt; to include privileges so all tables created in &lt;code&gt;schema1&lt;/code&gt; inherit schema privileges:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt;\c - Joe
You are now connected as user Joe
=&amp;gt; ALTER SCHEMA schema1 DEFAULT INCLUDE PRIVILEGES;
ALTER SCHEMA
=&amp;gt; CREATE TABLE schema1.table2 (id int);
CREATE TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;With inherited privileges enabled, &lt;code&gt;Myra&lt;/code&gt; can query &lt;code&gt;table2&lt;/code&gt; without &lt;code&gt;Joe&lt;/code&gt; having to explicitly grant privileges on the table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt;\c - Myra
You are now connected as user Myra
=&amp;gt; SELECT * FROM schema1.table2;
id
---
(0 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

      </description>
    </item>
    
  </channel>
</rss>
