简体   繁体   English

删除列时Oracle中会发生什么?

[英]What happens in Oracle when I drop a column?

What are the various things that happen when I drop a column from a filled table. 当我从填充表中删除列时会发生什么样的事情。 In all_tab_columns, does the column_id of other columns get reset? 在all_tab_columns中,其他列的column_id是否会重置?

The actions will include at least the following: 这些行动至少包括以下内容:

  • The data stored in that column is lost. 存储在该列中的数据将丢失。
  • Views referencing that column are invalidated - but (according to Gary - thanks!) they're not dropped; 引用该列的视图无效 - 但(根据加里 - 谢谢!)它们没有丢弃; they stay invalid until revised to work with the modified schema. 它们保持无效,直到修改为使用修改后的模式。
  • Stored procedures referencing that column are invalidated - same caveat. 引用该列的存储过程无效 - 同样需要注意。
  • The column ID numbers of following columns will be reset. 以下列的列ID号将被重置。
  • Permissions granted on the column will be removed. 将删除对该列授予的权限。
  • Indexes referencing that column will be dropped. 引用该列的索引将被删除。

alter table drop column alter table drop column

will actually visit each block and remove the column data - and that's an expensive thing to do for a large table. 实际上将访问每个块并删除列数据 - 这对于大型表来说是一件昂贵的事情。

You might find it more prudent to issue: 你可能会发现更谨慎的问题:

alter table set unused alter table set unused

which just flags the column as "gone" in the dictionary. 它只是将列标记为字典中的“已消失”。 If you then still need to reclaim that space, you can schedule an "alter table drop unused" at a quiet time 如果您仍需要回收该空间,则可以在安静的时间安​​排“未使用alter table drop”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Oracle 19c 数据库中,当我们删除表时,使用该表的过程、触发器、索引会发生什么情况? - In Oracle 19c database, when we drop a table what happens to the procedures, triggers, index that uses this table? 限制 oracle 子查询时会发生什么 - What happens when limiting an oracle subquery 在Oracle JDBC驱动程序中,将Java日期写入TIMESTAMP列时,时区会发生什么? - In the Oracle JDBC driver, what happens to the time zone when you write a Java date to a TIMESTAMP column? 当您在 Oracle 中删除附加了外键的主键约束然后重新启用主键时会发生什么? - What happens when you drop a primary key constraint that has a foreign key attached to it in Oracle and then re-enable the primary key? oracle union caluse:如果列名不匹配会发生什么 - oracle union caluse: what happens if there is a column name mismatch Oracle SQL:当您更新不存在的记录时会发生什么? - Oracle SQL: What happens when you UPDATE a nonexistent record? Oracle 删除列和未使用的列 - Oracle drop column and unused column 当我们在oracle中删除表和包时会发生什么? - What happen when we drop table & package in oracle? 当您DROP USER但未指定CASCADE时,架构对象会发生什么? - What happens to schema objects when you DROP USER but don't specify CASCADE? 在Oracle中跟踪放置列的进度 - Tracking drop column progress in Oracle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM