doc-exports/docs/dws/dev/dws_06_0136.html
Lu, Huayi a24ca60074 DWS DEVELOPER 811 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2023-01-19 13:37:49 +00:00

62 lines
8.7 KiB
HTML

<a name="EN-US_TOPIC_0000001145510967"></a><a name="EN-US_TOPIC_0000001145510967"></a>
<h1 class="topictitle1">ALTER SCHEMA</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001145510967__s27c57ef82c7b4944b09014aac5f06429"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001145510967__aa294ee5c393c42bf8e5bb6c9ecc9ca18"><strong id="EN-US_TOPIC_0000001145510967__b119629017235646">ALTER SCHEMA</strong> changes the attributes of a schema.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510967__s6c98c237e539413383325a777ed0f75a"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001145510967__p26534795155132">Only the owner of an index or a system administrator can run this statement.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510967__sd37d6b1a796d41e5a806ef20c719825e"><h4 class="sectiontitle">Syntax</h4><ul id="EN-US_TOPIC_0000001145510967__u9270c80303aa4f39a5ac3a520d39eb37"><li id="EN-US_TOPIC_0000001145510967__ld37dafcd0e2440e68823a6264a0dcf16">Rename a schema.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510967__sc567b311b32641e183678b6221d8d9de"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="k">schema_name</span><span class="w"> </span>
<span class="w"> </span><span class="k">RENAME</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">new_name</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li><li id="EN-US_TOPIC_0000001145510967__l2ee40ea2c07340848e6e35ace34f7c38">Changes the owner of a schema.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510967__s626e6a8a81ba4743a520a0fa18b8c31c"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="k">schema_name</span><span class="w"> </span>
<span class="w"> </span><span class="k">OWNER</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">new_owner</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<ul id="EN-US_TOPIC_0000001145510967__ul1517013256431"><li id="EN-US_TOPIC_0000001145510967__li1939814337438">Changes the storage space limit of the permanent table in the schema.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510967__screen1039853318437"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="k">schema_name</span><span class="w"> </span>
<span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="n">PERM</span><span class="w"> </span><span class="k">SPACE</span><span class="w"> </span><span class="s1">'space_limit'</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
<div class="section" id="EN-US_TOPIC_0000001145510967__s0191c80e5cb0437cb114af4c634251fd"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001145510967__u6ca2b96c60b54897a301d102ad4062e8"><li id="EN-US_TOPIC_0000001145510967__l61724f6acdf04bef9630a8ea48dd2467"><strong id="EN-US_TOPIC_0000001145510967__a9a231db7d5bd4073a0cb6119f6e44b4d">schema_name</strong><p id="EN-US_TOPIC_0000001145510967__a725f6c325d404a46b66596a24e9d8847">Indicates the name of the current schema.</p>
<p id="EN-US_TOPIC_0000001145510967__a15a8753e8e2047c5a871350cee902e44">Value range: An existing schema name.</p>
</li><li id="EN-US_TOPIC_0000001145510967__l0476b0085ebc484dbf3017668b779b4f"><strong id="EN-US_TOPIC_0000001145510967__ac4ff9db7f68a44738f3a3c59a36b3e3c">RENAME TO new_name</strong><p id="EN-US_TOPIC_0000001145510967__a388b728c69524626ace06036adba9823">Renames a schema.</p>
<p id="EN-US_TOPIC_0000001145510967__aa383d4c09cbf460bb6a70df2ef52fcb6"><strong id="EN-US_TOPIC_0000001145510967__b152405205735646">new_name</strong>: new name of the schema</p>
<p id="EN-US_TOPIC_0000001145510967__a4f9e8f092a714f708964ec19da00150c">Value range: A string. It must comply with the naming convention.</p>
</li><li id="EN-US_TOPIC_0000001145510967__lbf7e69c75df24d37ad2922bb9d17e590"><strong id="EN-US_TOPIC_0000001145510967__a00070e9c7e5e42c88e4150bd8912eb28">OWNER TO new_owner</strong><p id="EN-US_TOPIC_0000001145510967__aabfaf2633a9841648c5d8beac87fdf30">Changes the owner of a schema. To do this as a non-administrator, you must be a direct or indirect member of the new owning role, and that role must have CREATE permission in the database.</p>
<p id="EN-US_TOPIC_0000001145510967__a9c477a4f91884874a57b12961b7e8eac"><strong id="EN-US_TOPIC_0000001145510967__b131375407135646">new_owner</strong>: new owner of a schema</p>
<p id="EN-US_TOPIC_0000001145510967__a1bea7a4519424218bc266aa70bd22aa2">Value range: An existing user name/role.</p>
</li><li id="EN-US_TOPIC_0000001145510967__li96469714414"><strong id="EN-US_TOPIC_0000001145510967__b119816191910">WITH PERM SPACE</strong><p id="EN-US_TOPIC_0000001145510967__p3646572440">Changes the storage upper limit of the permanent table in the schema. If a non-administrator user wants to change the storage upper limit, the user must be a direct or indirect member of all new roles, and the member must have the CREATE permission on the database.</p>
<p id="EN-US_TOPIC_0000001145510967__p364617716442"><strong id="EN-US_TOPIC_0000001145510967__b14252195133217">new_owner</strong>: new owner of a schema</p>
<p id="EN-US_TOPIC_0000001145510967__p140915113451">Value range: A string consists of an integer and unit. The unit can be K/M/G/T/P currently. The unit of parsed value is K and cannot exceed the range that can be expressed in 64 bits, which is 1 KB to 9007199254740991 KB.</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510967__s378bf7cf08114c269f8947e5a942a8ee"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001145510967__p127171434173615">Rename the <strong id="EN-US_TOPIC_0000001145510967__b11790115315914">ds</strong> schema to <strong id="EN-US_TOPIC_0000001145510967__b1779511539912">ds_new</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510967__screen1956155013916"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="n">ds</span><span class="w"> </span><span class="k">RENAME</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">ds_new</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001145510967__p77163349361">Change the owner of <strong id="EN-US_TOPIC_0000001145510967__b2197161191017">ds_new</strong> to <strong id="EN-US_TOPIC_0000001145510967__b171971613107">jack</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510967__screen10830141344011"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="n">ds_new</span><span class="w"> </span><span class="k">OWNER</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">jack</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510967__s2665b4986ada44fd9ae772c020546e43"><h4 class="sectiontitle">Helpful Links</h4><p id="EN-US_TOPIC_0000001145510967__a2a911ebe5e3c4aa386d1fe3cb8261b8d"><a href="dws_06_0173.html">CREATE SCHEMA</a>, <a href="dws_06_0204.html">DROP SCHEMA</a></p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0118.html">DDL Syntax</a></div>
</div>
</div>