--1 NOLOGGIN QUERY 만들기 (FUNCTION BASE INDEX 가 있을경우 진행불가능)
SELECT 'ALTER TABLE OWNER명.테이블명 NOLOGGING;' FROM DUAL
UNION ALL
SELECT 'ALTER INDEX ' || OWNER ||'.' || INDEX_NAME || ' NOLOGGING;' FROM all_indexes WHERE table_name='테이블명' AND owner='OWNER명'
UNION ALL
SELECT 'FUNCTION BASE INDEX 있음' FROM all_indexes WHERE table_name='테이블명' AND owner='OWNER명' AND INDEX_TYPE LIKE 'FUNCTION%'
--2 ROW MOVEMENT ENABLE 만들기
SELECT 'ALTER TABLE OWNER명.테이블명 ENABLE ROW MOVEMENT;' FROM DUAL
ALTER TABLE OWNER명.테이블명 ENABLE ROW MOVEMENT;
-- 3-1 SHRINK SPACE CASCADE QUERY 만들기
SELECT 'ALTER TABLE OWNER명.테이블명 SHRINK SPACE CASCADE;' FROM DUAL
ALTER TABLE OWNER명.테이블명 SHRINK SPACE CASCADE;
-- 3-2 Shrink Space INDEX Table 각각 별도로 할 경우
SELECT 'ALTER TABLE OWNER명.테이블명 SHRINK SPACE;' FROM DUAL
UNION ALL
SELECT 'ALTER INDEX ' || OWNER ||'.' || INDEX_NAME || ' SHRINK SPACE;' FROM all_indexes WHERE table_name='테이블명' AND owner='OWNER명'
--4 ROW MOVEMENT DISABLE 만들기
SELECT 'ALTER TABLE OWNER명.테이블명 DISABLE ROW MOVEMENT;' FROM DUAL
ALTER TABLE OWNER명.테이블명 DISABLE ROW MOVEMENT;
--5 LOGGIN QUERY 만들기
SELECT 'ALTER TABLE OWNER명.테이블명 LOGGING;' FROM DUAL
UNION ALL
SELECT 'ALTER INDEX ' || OWNER ||'.' || INDEX_NAME || ' LOGGING;' FROM all_indexes WHERE table_name='테이블명' AND owner='OWNER명'
--6 원상복귀 확인
SELECT INDEX_NAME, LOGGING, '' FROM all_indexes WHERE table_name='테이블명' AND owner='OWNER명'
UNION ALL
SELECT TABLE_NAME, LOGGING, ROW_MOVEMENT FROM all_TABLEs WHERE table_name='테이블명' AND owner='OWNER명'
http://blog.naver.com/itisksc/30079446285
'오라클' 카테고리의 다른 글
lock tree 형식으로 조회 (0) | 2020.04.09 |
---|---|
Undo 사용량 확인 (0) | 2020.03.24 |
DBLink(DB Link 생성) (0) | 2019.08.22 |
oracle lock tree 확인 (0) | 2019.06.20 |
Table Size 확인(Index, Lob데이터포함) (0) | 2019.05.10 |