반응형


오라클에서 


EXP -> IMP 하는 방식에는


exp 테이블 스키마 추출

exp id/passwd file=./temp.dmp log=./log.log compress=n rows=n


 imp id/passwd indexfile=create.sql full=y 옵션을 주어


입력하지는 않고 create.sql을 만들어


스크립트 형태로 수동으로 돌릴 수 있다.


다만,


그냥 import 했을 때는


커져버린 초기값을 만나게 되는데...


이것을 수정하는 방법은


initial, next 값 수정!


- 테이블 스페이스 생성시 local로 생성해야만 함 ~

확인 쿼리

SELECT initial_extent, next_extent, pct_increase,

            extent_management, allocation_type

     FROM DBA_TABLESPACES

     WHERE tablespace_name=upper('테이블스페이스명');


- initial 값 수정


1. 분석하기 (emp1 테이블 분석)


analyze table emp1 compute statistics;


2. 분석을 기준으로 사용하지 않는 불럭 초기화

alter table emp1 deallocate unused keep 0;


3. 블럭 사이즈  확인 하는 법

select table_name, initial_extent from user_tables;


** 다른 방법


1. alter and move the table to another tablespace. e.g. (다른 테이블 스페이스로 옮기기)

ALTER TABLE MY_TABLE MOVE TABLESPACE ANOTHER_TABLESPLACE STORAGE (INITIAL 2M NEXT 2M PCTINCREASE 0);

2. alter and move the table back to the original tablesace with the desired initial extent size, e.g. (원 테이블 스페이스에 옮기기)

ALTER TABLE MY_TABLE MOVE TABLESPACE ORIGINAL_TABLESPACE STORAGE (INITIAL 256M NEXT 2M PCTINCREASE 0);



- next 값 수정

위와 동일하며


alter table emp1 storage(next 10M);


으로 가능함 

반응형

'Database > ORACLE' 카테고리의 다른 글

도스 모드 sql 실행 bat 배치 만들기  (0) 2016.03.25
ndd 설정하기  (0) 2013.09.23
오라클 미디어 팩 신청하기  (0) 2013.01.31
one port multi listener 설정 하기  (0) 2012.12.24
DBMS_XPLAN 정보 조회  (0) 2012.09.07
반응형


Oracle version이 10.2.0.4로 동일하고 DB간 character set 도 동일하다고 가정한다면....

 

그냥 데이타파일을 copy하면 안되고요...

Cross-Platform Transportable Tablespaces 기능을 사용하시면 됩니다.

 

이때 Source 와 Target DB에서 아래를 조회해서 endian format이 같은지 검사해서...

아래 경우 little endian인데...source db와 target db의 os가 동일한 endian이면 상관없지만

 

 

        SQL> select PLATFORM_ID, PLATFORM_NAME  from v$database;
       
        PLATFORM_ID PLATFORM_NAME
        ----------- ------------------------------
                 10 Linux IA (32-bit)

 

        SQL> select  * from v$transportable_platform;
       
        PLATFORM_ID PLATFORM_NAME                  ENDIAN_FORMAT
        ----------- ------------------------------ --------------
                  1 Solaris[tm] OE (32-bit)        Big
                  2 Solaris[tm] OE (64-bit)        Big
                  7 Microsoft Windows IA (32-bit)  Little  
                 10 Linux IA (32-bit)              Little   <--- Little endian임.
                  6 AIX-Based Systems (64-bit)     Big
                  3 HP-UX (64-bit)                 Big
                  5 HP Tru64 UNIX                  Little
                  4 HP-UX IA (64-bit)              Big
                 11 Linux IA (64-bit)              Little
                 15 HP Open VMS                    Little
                  8 Microsoft Windows IA (64-bit)  Little
                  9 IBM zSeries Based Linux        Big
                 13 Linux 64-bit for AMD           Little
                 16 Apple Mac OS                   Big
                 12 Microsoft Windows 64-bit for A Little
                    MD

 

다를 경우 Rman으로 Data File Conversion 을 해야 합니다.

 

     - Source 에서
       > rman target=/
       RMAN> Convert Tablespace 'FINANCE, HR' to Platform ='AIX_Based System (64-bit)'  <--    

                  v$transportable_platform.platform_name
                     DB_FILE_NAME_CONVERT = '/orahome/dbs1', '/orahome/dbs/transport_aix',
                                            '/orahome/dbs2', '/orahome/dbs/transport_aix'; 
         <--해당 디렉토리 아래 FINANCE, HR TS에 해당하는 모든 것을 convert하여 지정된 디렉토리 아래로 copy
        
     또는
    
     - Target 에서
       > rman target=/    
       RMAN> Convert Datafile '/tmp/transport_stage/*' From Platform = 'Solaris[tm] OE (32-bit)'
                     DB_FILE_NAME_CONVERT = '/tmp/transport_stage/fin', '/orahome/dbs1/fin',
                                            '/tmp/transport_stage/hr',  '/orahome/db2/hr';
     - DB_FILE_NAME_CONVERT 가 없으면 flash recovery area에 같은 이름으로 만들어진다.
     - Parallelism option은 parallel하게 복수개의 file을 convert할때 사용.  Convert 시간은 Rman으로
       백업할때 걸리는 시간과 같다. Convert 전후의 file size는 변함이 없다.





TDB라는 방법도 있습니다.

http://www.oracle.com/technetwork/database/features/availability/maa-wp-10gr2-platformmigrationtdb-131164.pdf


HP.UX -> AIX로 진행 해 봤는데..

시간이 많이 걸리던 순서대로 나열하면 exp/imp, TTS, TDB 순서 더군요...

참고 하세요..





반응형
반응형

정말 감사합니다.
쉽게 해결될 듯도 합니다.

>안녕하세요?
>oracle 8i이상버전에서는 지원가능합니다.
>datafile을 copy하고 , tablespace의 metadata를 export받아서 다른서버에 import하면 됩니다.
>
>방법
>
>1. 제약사항
>*O/S 종류가 동일해야 한다.
>*nls_characterset, nls_ncharcaterset이 동일해야 한다.
>*db_block_size가 동일해야 한다.
>*transport할려는 tablespaces에 object를 만든 user는 반드시 다른 서버에 존재해야 한다.
>*transport할려는 tablespace set은 self-contained tablespace이여야 한다.
>*sys user로 exp/imp한다.
>(tablespace ts01에 연관된 object가 ts02에도 존재 한다면 두개의 tablespace를 transport해야 한다.
>LOB data, partitioned table, index, table등의 기타 object들은 transport할려는 tablespace set에 포함되어야 한다. 따라서 이것을 옮기기전에 옮길려구 하는 테이블이 self-contained tablespace인지를 파악후에 작업하는것이 필요하다.)
>
>2. self-containd tablespace인 확인방법
>declare
>begin
>dbms_tts.transport_set_check('TS01,TS02',TRUE);
>end;
>/
>실행후
>SELECT * FROM TRANSPORT_SET_VIOLATIONS;
>뷰를 확인해서 선택된 것이 없다면 self-contained tablespace들이다.
>TS01,TS02 : transport할려는 tablespace들이다.
>TRUE : referencial constraint에 대해 self-contained 여부를 check해준다
>
>2. source 서버에서의 작업
>* 옮기려는 tablespace들에 대해 read only로 만든다.(파일 copy시 변경작업이 일어 나지 못하도록 하기위해서)
>alter tablespace ts01 read only;
>alter tablespace ts02 read only;
>
>*tablespaces에 속해 있는 모든 datafile을 대상 서버로 copy한다.(ts01.dbf, ts02.dbf)
>
>*console에서 tablespace의 metadata를 export받는다.
>exp 'sys/oracle as sysdba' file=transtest10.dmp transport_tablespace=y tablespaces=ts01,ts02(windows)
>
>exp 'sys/oracle as sysdba' file=transtest10.dmp transport_tablespace=y tablespaces=ts01,ts02(unix : 816 이상에서)
>
>* export받은 metadata(transtest10.dmp )를 대상서버로 copy한다.
>
>3. 대상 서버에서의 작업
>* transport tablespace에 object를 만든 user에 대해 대상서버에도 user를 생성해준다.
>*console에서 import한다.
>imp 'sys/oracle as sysdba' file=transtest10.dmp transport_tablespace=y
>datafiles=/경로/ts01.dbf,/경로/ts02.dbf (windows)
>
>imp 'sys/oracle as sysdba' file=transtest10.dmp transport_tablespace=y
>datafiles=/경로/ts01.dbf,/경로/ts02.dbf (unix : 816 이상에서)
>
>4. source 서버에서 기존의 tablespaces들을 이용하려면 read write로 바꿔준다.
>alter tablespace tp01 read write;
>alter tablespace tp02 read write;
>
>5. source 서버에서 기존의 tablespaces들이 필요없을 경우 삭제한다.
>alter tablespace tp01 including contents;-->datafile을 console에서 삭제한다.(9i이전 버전)
>alter tablespace tp02 including contents and datafiles;(9i 이상에서 tablespace 및 datafile도 자동으로 삭제한다.)
>
>
>수고하세요
>Good Job
>-----------------------------------------------------------------
>
>
>
>>현재 사용하고 있는 서버에서 한개의 테이블스페이스만 다른 서버로 옮기려고합니다.
>>대상 TableSpace가 워낙 자료가 많아 Export를 받기에는 역부족이고 (시간상으로)
>>해서 DataFile을 이용하여 옮길수 있는 방법이 없는지 문의를 드립니다.
>

출처 : http://www.koug.net/xe/4116
반응형

+ Recent posts