Notice
Recent Posts
Recent Comments
Link
250x250
반응형
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 실제플랜조회
- sqlp시험일정
- PROFILE EXPDP
- DATABASELINK
- sqlp공부방법
- 리눅스
- 대량dml튜닝
- 오라클인덱스힌트
- 오라클기동
- 티스토리챌린지
- inlist
- job관리
- 통계정보복구
- 통계정보백업
- Linux
- 오라클
- postgreql 오브젝트 조회
- ssh접속오류
- num_index_keys
- 오블완
- MariaDB기본디렉토리변경
- mariaDB설치오류
- mariaDB
- public synonym EXPDP
- sqlp합격후기
- Connect Storage Engine
- oracle
- autocommit설정
- 데이터csv생성
- datadir 변경
Archives
- Today
- Total
IT study
[Oracle] interval partition table 주기적으로 파티션 삭제하기 본문
728x90
반응형
인터벌 파티션 테이블로 생성된 테이블의 일정 보관 기간이 지나면 데이터 삭제가 필요.
oracle job 통해 배치 생성하여 주기적으로 데이터 관리 진행함
declare
cursor c_del_partition is
select object_name as tb_nm,
subobject_name as partition_nm
from ALL_OBJECTS
where owner = [스키마명]
and object_type = 'TABLE PARTITION'
and generated = 'Y' -- 시스템생성여부 : 인터벌파티션의 경우 자동생성되므로 시스템생성여부가 Y임
and ( object_name = [인터벌파티션테이블명] and created < trunc(sysdate)-10 ) ; --10일보관
;
begin
for c in c_del_partition
loop
l_ddl_str := 'alter table '||c.tb_nm||' drop partition '||c.partition_nm||'';
begin
execute immediate l_ddl_str;
exception
when others then
l_err_code := ''||SQLCODE;
l_err_msg := SQLERRM || ' ( ' || c.partition_nm || ' ) ' ;
insert into TB_ERR_LOG (wrk_tbl_nm, err_cd, err_msg) values (c.tb_nm,l_err_code,l_err_msg);
commit;
end;
end loop;
end;
all_object의 generated, created 컬럼 활용하여 삭제 대상 파티션 선정 후
파티션 삭제 진행
728x90
반응형
'DATABASE > Oracle' 카테고리의 다른 글
[Oracle] 파라미터 변경 방법 (0) | 2023.08.25 |
---|---|
[Oracle] 파라미터 파일 (spfile, pfile) (0) | 2023.08.25 |
[Oracle] SYS_CONTEXT 오라클 현재 세션 정보 확인 (0) | 2023.07.05 |
[Oracle] impdp 시 에러 해결 ORA-14460: only one COMPRESS or NOCOMPRESS clause may be specified (0) | 2023.06.27 |
[Oracle] V$SQL 활용한 SQL 성능 분석 (0) | 2023.06.13 |