Oracle export/import

Program/Oracle 2011. 12. 18. 20:01

1. NLS_CHARACTER 확인 (한글 문제)
- select name , value$ from props$ where name like 'NLS%';
으로 import할 oracle의 NLS_CHARACTER확인
- update props$ set value$ = '확인된 NLS_CHARACTERSET' where name = 'NLS_CHARACTERSET'
export할 oracle의 NLS_CHARACTER을 import할 oracle의 NLS_CHARACTER으로 맞쳐준다.(단, 기존 데이터가 있을 경우는 형식이 틀려지기 때문에 하지 말 것.)
- 바꾼 후 반드시 Oracle 재시작.

2.export
- grant exp_full_database to ID;
(export 권한이 없는 경우)
- exp id/pw file="파일경로\파일명" full=y
(해당 유저의 datafile export)

3.tablespace 생성
- create tablespace tablespace명 datafile '경로/tabledspace명01.dbf' size 1024m reuse autoextend on next 10M maxsize 4096m
-
최대 용량 4G의 현재 기본 1G의 tablespace를 만든다.(꽉찰때마다 10M만큼 늘린다.)
- 웬만하면 export할 db와 동일 명칭으로 생성
-
기존 용량을 따져 미리 만들어놓는다.(4G를 최대로 하여 필요한 경우 02.dbf로 추가 생성)
- Oracle에서 최대 사이즈는 4G를 권장.

4.user생성
- create user ID identified by PWD default tablespace "tablespace명";
grant connect,resource,(dba), imp_full_database to ID;

5.import
- imp id/pw file="파일경로\파일명" fromuser='export한 user' touser='import할 user'

**기존에 DB가 있어 NLS_CHARACTERSET를 바꿀 수 없는 경우
- alter table TABLE_NAME modify (COLUMN_NAME DATATYPE SIZE);
으로 column크기를 늘려 import한다.
AND