Concat 함수
특정 문자열을 합치기 위해 활용되는 함수
-> 실제 실무에서 많이 활용되므로 다양하게 추출하는 방법 테스트 필요
1. export 스크립트 추출
select 'expdp username/password job_name=export_table_'|| table_name ||' '||''||'directory=:v_directory_name dumpfile='|| table_name ||'.dmp'||' '||'logfile=export_table_'|| table_name ||'.log'||' '||'tables='|| owner ||'.'|| table_name ||' '||''||'include=table' from dba_tables where table_name like ':v_table_name';
2. import 스크립트 추출
- 해당 import 구문은 원본스키마_특정문구 > 원본스키마로 remap 추출 후 import하는 내용
select 'impdp username/password job_name=import_table_'|| table_name ||' '||''||'directory=:v_directory_name dumpfile='|| table_name ||'.dmp'||' '||'logfile=import_table_'|| table_name ||'.log'||' '||'remap_table='|| owner ||'.'|| table_name ||''||':'||''|| substr(table_name,1,REGEXP_instr(table_name,'_')-1) ||' '||''||'table_exists_action=[APPEND|REPLACE|TRUNCATE] data_options=skip_constraint_errors'
from dba_tables
where table_name like ':v_table_name';
3. drop 구문 스크립트 추출
select 'drop table '|| owner ||'.'|| table_name ||' purge;'
from dba_tables
where table_name like ':v_table_name';
'DB > Oracle' 카테고리의 다른 글
[Backup&Recovery] (1) pfile,spfile을 이용한 control file 관리 (0) | 2023.03.14 |
---|---|
[SQL] SQL 수행시간 측정 (0) | 2023.03.14 |
[SHELL] Archive log 경과 일 수 지난 파일 삭제하는 bat (0) | 2023.03.14 |
[SQL] Tablespace별 용량 확인 (0) | 2023.03.10 |
[SQL] ASM Disk 사용량 조회 (0) | 2023.03.10 |