Код:
DECLARE
sql_stmt VARCHAR2 (100);
BEGIN
FOR c_rec IN (SELECT index_name FROM all_indexes
WHERE owner = 'SUPERMAG' AND TEMPORARY = 'N')
LOOP
sql_stmt:='ALTER INDEX SUPERMAG.' || c_rec.index_name || ' UNUSABLE';
EXECUTE IMMEDIATE sql_stmt;
END LOOP;
END;
/
Код:
DECLARE
sql_stmt VARCHAR2 (100);
BEGIN
FOR c_rec IN (SELECT table_name FROM all_tables
WHERE owner = 'SUPERMAG' AND TEMPORARY = 'N')
LOOP
sql_stmt:='ALTER TABLE SUPERMAG.' || c_rec.table_name || ' MOVE';
EXECUTE IMMEDIATE sql_stmt;
END LOOP;
END;
/
Код:
DECLARE
sql_stmt VARCHAR2 (100);
BEGIN
FOR c_rec IN (SELECT owner,index_name FROM all_indexes
WHERE owner != 'SYS' AND TEMPORARY = 'N')
LOOP
begin
EXECUTE IMMEDIATE 'ALTER INDEX '||c_rec.owner||'.'|| c_rec.index_name || ' UNUSABLE';
exception when others then null;
end;
END LOOP;
END;
/
Код:
BEGIN
FOR c_rec IN (SELECT owner,index_name FROM all_indexes
WHERE owner = 'IBS' AND TEMPORARY = 'N' and status='UNUSABLE')
LOOP
begin
EXECUTE IMMEDIATE 'ALTER INDEX '||c_rec.owner||'.'|| c_rec.index_name || ' REBUILD';
exception when others then null;
end;
END LOOP;
END;
/
Код:
DECLARE
sql_stmt VARCHAR2 (100);
BEGIN
FOR c_rec IN (SELECT index_name FROM all_indexes
WHERE owner = 'SUPERMAG' AND TEMPORARY = 'N' and status='UNUSABLE')
LOOP
sql_stmt:='ALTER INDEX SUPERMAG.' || c_rec.index_name || ' REBUILD';
EXECUTE IMMEDIATE sql_stmt;
END LOOP;
END;
/
Код:
DECLARE
sql_stmt VARCHAR2 (100);
BEGIN
FOR c_rec IN (SELECT owner,table_name FROM dba_tables
WHERE TEMPORARY = 'N' and iot_type is null and partitioned='NO')
LOOP
sql_stmt:='ANALYZE TABLE "'||c_rec.owner||'"."' || c_rec.table_name || '" VALIDATE STRUCTURE CASCADE';
dbms_output.put_line(sql_stmt);
EXECUTE IMMEDIATE sql_stmt;
END LOOP;
END;
/