Oracle 重建所有表的索引的存储过程 (重建索引)
来源:互联网 发布:c 和java区别 编辑:程序博客网 时间:2024/06/06 05:26
create or replace procedure p_rebuild_all_index
(tablespace_name in varchar2,--这里是表空间名,如果不改变表空间,可以传入null
only_unusable in boolean) --是否仅对无效的索引操作
as
sqlt varchar(200);
begin
--只取非临时索引
for idx in (select index_name, tablespace_name, status from user_indexes where temporary = 'N') loop
--如果是如重建无效的索引,且当索引不是无效时,则跳过
if only_unusable = true and idx.status <> 'UNUSABLE' then
goto continue;
end if;
if (tablespace_name is null) or idx.status = 'UNUSABLE' then
--如果没有指定表空间,或索引无效,则在原表空间重建
sqlt := 'alter index ' || idx.index_name || ' rebuild ';
elsif upper(tablespace_name) <> idx.tablespace_name then
--如果指定的不同的表空间,则在指定表空间待建索引
sqlt := 'alter index ' || idx.index_name || ' rebuild tablespace ' || tablespace_name;
else
--如果表空间相同,则跳过
goto continue;
end if;
dbms_output.put_line(idx.index_name);
EXECUTE IMMEDIATE sqlt;
<<continue>>
null;
end loop;
end;
/*
功能:重建索引。
说明:如果表空间参数传入null,则在原表空间内重建索引,否则在目标表空间重建索引。
如果表空间相同,则跳过。
only_unusable表示是否只对无效的索引进行重建
作者:81, 2007年6月26日
*/
- Oracle 重建所有表的索引的存储过程 (重建索引)
- Oracle 重建所有表的索引的存储过程 (重建索引)
- Oracle 重建所有表的索引的存储过程 (重建索引)
- sqlserver重建所有索引的存储过程
- 重建所有表的索引的存储过程
- ORACLE重建所有的索引
- 重建(重新组织)索引的存储过程
- 重建所有索引(Oracle)
- 重建索引存储过程
- sqlserver重建所有索引存储过程
- 存储过程中动态重建指定表的索引
- 重建+重组索引的过程
- 重建所有表索引
- Oracle 重建索引的必要性
- Oracle 重建索引的必要性
- [Oracle] ORACLE表与索引的分析及索引重建
- T-SQL重建所有数据库的所有表的索引
- Oracle表与索引的分析及索引重建
- JavaScript中Date.parse 函数用法
- CAS client配置示例
- 在Hibernate里面动态切换SChema实现访问不同的数据库的几种方法
- 2008年度中国最佳MBA排行榜
- cin深入分析
- Oracle 重建所有表的索引的存储过程 (重建索引)
- 项目经理开门七件事
- mvc保存图片和doc文件
- javascript中replace()
- 在VS6.0工程中创建系统状态栏图标显示?
- Hibernate学习笔记:HQL
- 实现Profile购物车的匿名用户迁移
- C#实现DES加密解密,AES加密解密
- Copy文件的方法