SlideShare a Scribd company logo
1 of 4
Anar Godjaev
http://anargodjaev.wordpress.com
Oracle Data Pump ile Single parititon export/transport
Oracle 11g ile birlikte single table partitionlarını veritabanları arasında taşımak mümkün hale gelmiştir,
Normal olarak tablonun tamamını taşımaktansa sadece belli partition’unu taşımak çok daha mantıklıdır.
Bunu örnekle dahada iyi açıklayabilmek adınapartititonlarımızı saklayacak 2 tane tablespace yaratacağız
ve test açamçlı olarak bu tablespace ler üzerinde quotalar vereceğiz.
[oracle@rac1 ~]$ sqlplus '/as sysdba'
SQL>CREATE TABLESPACE transport_test_ts_1
DATAFILE 'tt_ts1.dbf'
SIZE 128K AUTOEXTEND ON NEXT 128K;
SQL>CREATE TABLESPACE transport_test_ts_2
DATAFILE 'tt_ts2.dbf'
SIZE 128K AUTOEXTEND ON NEXT 128K;
SQL>ALTER USER test
QUOTA UNLIMITED ON transport_test_ts_1
QUOTA UNLIMITED ON transport_test_ts_2;
SQL>CONN test/test
Test kullanıcımızla bağlandıktan sonra örnek bir partition tablo yaratıyoruz ve içini veri ile dolduruyoruz.
SQL>CREATE TABLE transport_test_tab (
id
NUMBER NOT NULL,
code
VARCHAR2(10) NOT NULL,
description VARCHAR2(50),
created_date DATE,
CONSTRAINT transport_test_pk PRIMARY KEY (id)
)
PARTITION BY RANGE (created_date)
(
PARTITION part_2010 VALUES LESS THAN (TO_DATE('01-10-2010','DD-MM-YYYY'))
TABLESPACE transport_test_ts_1,
PARTITION part_2011 VALUES LESS THAN (TO_DATE('01-10-2011','DD-MM-YYYY'))
TABLESPACE transport_test_ts_2
);
SQL>INSERT INTO transport_test_tab
SQL>INSERT INTO transport_test_tab
SQL>INSERT INTO transport_test_tab
ADD_MONTHS(SYSDATE,12));
SQL>INSERT INTO transport_test_tab
ADD_MONTHS(SYSDATE,12));
SQL>COMMIT;

VALUES (1, 'ONE', '1 ONE', SYSDATE);
VALUES (2, 'TWO', '2 TWO', SYSDATE);
VALUES (3, 'THREE', '3 THREE',
VALUES (4, 'FOUR', '4 FOUR',

Tablomuzun istatistiğini alıp ,tablomuza ait partitionları ve içerdikleri kayıtlara bir bakalım.
SQL>EXEC DBMS_STATS.gather_table_stats(USER, 'TRANSPORT_TEST_TAB');
SQL>COLUMN table_name FORMAT A20
SQL>COLUMN partition_name FORMAT A20
SQL>COLUMN tablespace_name FORMAT A20
Anar Godjaev
http://anargodjaev.wordpress.com
SQL> set linesize 1000
SQL>SELECT table_name, partition_name, tablespace_name, num_rows
FROM
user_tab_partitions
Where table_name='TRANSPORT_TEST_TAB';
TABLE_NAME
-------------------TRANSPORT_TEST_TAB
TRANSPORT_TEST_TAB

PARTITION_NAME
-------------------PART_2010
PART_2011

TABLESPACE_NAME
NUM_ROWS
-------------------- ---------TRANSPORT_TEST_TS_1
2
TRANSPORT_TEST_TS_2
2

Görüldüğü gibi her partition 2 şer kayıt içeriyor.
Transport yapacağımız tablespace ler kesinlikle readonly modda olmalıdır.
SQL>ALTER TABLESPACE transport_test_ts_1 READ ONLY;
Şu an herşey hazır 2010 parititonunu export yapabiliriz.
[oracle@rac1 ~]$ sqlplus '/as sysdba'
SQL> CREATE OR REPLACE DIRECTORY data_pump_dir AS '/u01/app11g/backup/';
SQL> GRANT READ, WRITE ON DIRECTORY data_pump_dir TO public;
[oracle@rac1 ~]$expdp system/oracle tables=test.transport_test_tab:part_2010
transportable=always directory=data_pump_dir dumpfile=part_2010.dmp
Yapılan export’un ouput’u aşağıdaki gibi olacaktır.
Export: Release 11.2.0.1.0 - Production on Wed NOV18 13:35:17 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates.

All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/********
tables=test.transport_test_tab:part_2010 transportable=always
directory=data_pump_dir dumpfile=part_2010.dmp
Processing object type TABLE_EXPORT/TABLE/PLUGTS_BLK
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/END_PLUGTS_BLK
Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
*****************************************************************************
*
Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:
/u01/app11g/backup/part_2010.dmp
*****************************************************************************
*
Datafiles required for transportable tablespace TRANSPORT_TEST_TS_1:
/u01/app11g/oracle/product/11.2.0/db_1/dbs/tt_ts1.dbf
Anar Godjaev
http://anargodjaev.wordpress.com
Datafiles required for transportable tablespace USERS:
/u01/app/oracle/oradata/EDUCATE/users01.dbf
Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at 13:36:23

Şimdi geri dönme yani backuptan geri alma testi yapacağız bunun için ilgili tabloyu ve onun ait olduğu
tablespace leri drop ediyoruz.
[oracle@rac1 ~]$ sqlplus '/as sysdba'
SQL>DROP TABLE test.transport_test_tab;
SQL>DROP TABLESPACE transport_test_ts_1 INCLUDING CONTENTS;
SQL>DROP TABLESPACE transport_test_ts_2 INCLUDING CONTENTS AND DATAFILES;
Dikkat edersek 1.tablespace te sadece content yani syntax bilgisini drop ettik,tablespace in datafile’ı halen
mevcuttur.
Şimdi artık aldığımız export backup ındaki bilgiyi import edebiliriz.
[oracle@rac1 ~]$impdp system/oracle partition_options=departition
dumpfile=part_2010.dmp transport_datafiles='tt_ts1.dbf'
İşlemin output bilgiside aşağıdaki gibi olacaktır,
$ impdp system/password partition_options=departition dumpfile=part_2007.dmp
transport_datafiles='/u01/app/oracle/oradata/DB11G/tt_ts_1'
Import: Release 11.2.0.1.0 - Production on Wed NOV18 13:42:38 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates.

All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully
loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/********
partition_options=departition dumpfile=part_2010.dmp
transport_datafiles=tt_ts1.dbf
Processing object type TABLE_EXPORT/TABLE/PLUGTS_BLK
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
ORA-39083: Object type INDEX failed to create with error:
ORA-00942: table or view does not exist
Failing sql is:
CREATE UNIQUE INDEX "TEST"."TRANSPORT_TEST_PK" ON "TEST"."TRANSPORT_TEST_TAB"
("ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(SEG_FILE 4 SEG_BLOCK 635
OBJNO_REUSE 85559 INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" PARALLEL 1
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
ORA-39083: Object type CONSTRAINT failed to create with error:
ORA-00942: table or view does not exist
Anar Godjaev
http://anargodjaev.wordpress.com
Failing sql is:
ALTER TABLE "TEST"."TRANSPORT_TEST_TAB" ADD CONSTRAINT "TRANSPORT_TEST_PK"
PRIMARY KEY ("ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(SEG_FILE 4 SEG_BLOCK 635 OBJNO_REUSE 85559 INITIAL 65536 NEXT 1048576
MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS
1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ENABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type
INDEX:"TEST"."TRANSPORT_TEST_PK" creation failed
Processing object type TABLE_EXPORT/TABLE/END_PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" completed with 3 error(s) at
13:42:50
Tablo segmenti tablo ismi ve partition isimlerinin kombinasyonu ile isimlendirilmiştir, bu yüzden buna
bağlı olan objeler hata vermiştir çünkü yanlış tablo ismini aramaktadırlar.O yüzden verilen hataları
görmezden geliyoruz. Şimdi artık oluşan yeni segmenti aşağıda görebiliriz.
[oracle@rac1 ~]$ sqlplus '/as sysdba'
SQL>CONN test/test
SQL>EXEC DBMS_STATS.gather_schema_stats(USER);
SQL>COLUMN table_name FORMAT A30
SQL>COLUMN tablespace_name FORMAT A20
SQL> set linesize 1000
SQL>SELECT table_name, tablespace_name, partitioned, num_rows
FROM
user_tables
Where tablespace_name like '%TRANSPORT_TEST_TS_1%';
TABLE_NAME
TABLESPACE_NAME
PAR
NUM_ROWS
------------------------------ -------------------- --- ---------TRANSPORT_TES_PART_2007
TRANSPORT_TEST_TS_1 NO
2
1 row selected.

More Related Content

What's hot

OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
Oracle Database 12.1.0.2 New Features
Oracle Database 12.1.0.2 New FeaturesOracle Database 12.1.0.2 New Features
Oracle Database 12.1.0.2 New FeaturesAlex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
oracle upgradation
oracle upgradationoracle upgradation
oracle upgradationinfluxbob
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Advanced tips of dbms statas
Advanced tips of dbms statasAdvanced tips of dbms statas
Advanced tips of dbms statasLouis liu
 
Creating a physical standby database 11g on windows
Creating a physical standby database 11g on windowsCreating a physical standby database 11g on windows
Creating a physical standby database 11g on windowsRoo Wall
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Oracle-L11 using Oracle flashback technology-Mazenet solution
Oracle-L11 using  Oracle flashback technology-Mazenet solutionOracle-L11 using  Oracle flashback technology-Mazenet solution
Oracle-L11 using Oracle flashback technology-Mazenet solutionMazenetsolution
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Alex Zaballa
 
12c db upgrade from 11.2.0.4
12c db upgrade from 11.2.0.412c db upgrade from 11.2.0.4
12c db upgrade from 11.2.0.4uzzal basak
 
R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10zeesniper
 
Jsp standard tag_library
Jsp standard tag_libraryJsp standard tag_library
Jsp standard tag_libraryKP Singh
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for DevelopersCompleteITProfessional
 
Flashback - The Time Machine..
Flashback - The Time Machine..Flashback - The Time Machine..
Flashback - The Time Machine..Navneet Upneja
 
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 

What's hot (18)

OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Oracle Database 12.1.0.2 New Features
Oracle Database 12.1.0.2 New FeaturesOracle Database 12.1.0.2 New Features
Oracle Database 12.1.0.2 New Features
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
oracle upgradation
oracle upgradationoracle upgradation
oracle upgradation
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should Know
 
Createclone
CreatecloneCreateclone
Createclone
 
Advanced tips of dbms statas
Advanced tips of dbms statasAdvanced tips of dbms statas
Advanced tips of dbms statas
 
Creating a physical standby database 11g on windows
Creating a physical standby database 11g on windowsCreating a physical standby database 11g on windows
Creating a physical standby database 11g on windows
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
 
Apps1
Apps1Apps1
Apps1
 
Oracle-L11 using Oracle flashback technology-Mazenet solution
Oracle-L11 using  Oracle flashback technology-Mazenet solutionOracle-L11 using  Oracle flashback technology-Mazenet solution
Oracle-L11 using Oracle flashback technology-Mazenet solution
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
 
12c db upgrade from 11.2.0.4
12c db upgrade from 11.2.0.412c db upgrade from 11.2.0.4
12c db upgrade from 11.2.0.4
 
R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10R12 d49656 gc10-apps dba 10
R12 d49656 gc10-apps dba 10
 
Jsp standard tag_library
Jsp standard tag_libraryJsp standard tag_library
Jsp standard tag_library
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for Developers
 
Flashback - The Time Machine..
Flashback - The Time Machine..Flashback - The Time Machine..
Flashback - The Time Machine..
 
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu   (obscure) tools of the trade for tuning oracle sq lsTony Jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
 

Viewers also liked

Conditional Control
Conditional ControlConditional Control
Conditional ControlAnar Godjaev
 
How to protect your sensitive data using oracle database vault / Creating and...
How to protect your sensitive data using oracle database vault / Creating and...How to protect your sensitive data using oracle database vault / Creating and...
How to protect your sensitive data using oracle database vault / Creating and...Anar Godjaev
 
Asm disk group migration from
Asm disk group migration from Asm disk group migration from
Asm disk group migration from Anar Godjaev
 
Instance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeInstance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeAnar Godjaev
 
Audit Mekani̇zmasi
Audit Mekani̇zmasiAudit Mekani̇zmasi
Audit Mekani̇zmasiAnar Godjaev
 
Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Anar Godjaev
 
Geliştiriciler için Oracle_Part_2
Geliştiriciler için Oracle_Part_2Geliştiriciler için Oracle_Part_2
Geliştiriciler için Oracle_Part_2Anar Godjaev
 
Installing 12c R1 database on oracle linux
Installing 12c R1 database on oracle linuxInstalling 12c R1 database on oracle linux
Installing 12c R1 database on oracle linuxAnar Godjaev
 
Fiziksel Standby Database Kurulum
Fiziksel Standby Database KurulumFiziksel Standby Database Kurulum
Fiziksel Standby Database KurulumAnar Godjaev
 
Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Anar Godjaev
 
Oracle Golden Gate
Oracle Golden GateOracle Golden Gate
Oracle Golden GateAnar Godjaev
 

Viewers also liked (17)

Wait Interface
Wait InterfaceWait Interface
Wait Interface
 
Conditional Control
Conditional ControlConditional Control
Conditional Control
 
How to protect your sensitive data using oracle database vault / Creating and...
How to protect your sensitive data using oracle database vault / Creating and...How to protect your sensitive data using oracle database vault / Creating and...
How to protect your sensitive data using oracle database vault / Creating and...
 
Tuning SGA
Tuning SGATuning SGA
Tuning SGA
 
Asm disk group migration from
Asm disk group migration from Asm disk group migration from
Asm disk group migration from
 
Instance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını IncelemeInstance ve Media Bozukluklarını Inceleme
Instance ve Media Bozukluklarını Inceleme
 
11 g RAC -ASM
11 g RAC -ASM11 g RAC -ASM
11 g RAC -ASM
 
Contraints
ContraintsContraints
Contraints
 
Audit Mekani̇zmasi
Audit Mekani̇zmasiAudit Mekani̇zmasi
Audit Mekani̇zmasi
 
Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇Redologlar ve Yöneti̇mi̇
Redologlar ve Yöneti̇mi̇
 
Geliştiriciler için Oracle_Part_2
Geliştiriciler için Oracle_Part_2Geliştiriciler için Oracle_Part_2
Geliştiriciler için Oracle_Part_2
 
Installing 12c R1 database on oracle linux
Installing 12c R1 database on oracle linuxInstalling 12c R1 database on oracle linux
Installing 12c R1 database on oracle linux
 
Fiziksel Standby Database Kurulum
Fiziksel Standby Database KurulumFiziksel Standby Database Kurulum
Fiziksel Standby Database Kurulum
 
Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇Veri̇tabani ve Kullanici Yöneti̇mi̇
Veri̇tabani ve Kullanici Yöneti̇mi̇
 
Oracle Golden Gate
Oracle Golden GateOracle Golden Gate
Oracle Golden Gate
 
Oracle SQL
Oracle SQLOracle SQL
Oracle SQL
 
PL/SQL Blocks
PL/SQL BlocksPL/SQL Blocks
PL/SQL Blocks
 

Similar to DataPump ile Single Parititon Export

OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
Oracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSOracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSChristian Gohmann
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq lsInSync Conference
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop Sandesh Rao
 
Bypass dbms assert
Bypass dbms assertBypass dbms assert
Bypass dbms assertfangjiafu
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2Alex Zaballa
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2Alex Zaballa
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop Sandesh Rao
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Guatemala User Group
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...Alex Zaballa
 
Import option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfImport option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfAlireza Kamrani
 
Ass2-Descriptor.docx1 Problem DescriptionThe objective of .docx
Ass2-Descriptor.docx1 Problem DescriptionThe objective of .docxAss2-Descriptor.docx1 Problem DescriptionThe objective of .docx
Ass2-Descriptor.docx1 Problem DescriptionThe objective of .docxfredharris32
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2nesmaddy
 
Optimizing your Database Import!
Optimizing your Database Import! Optimizing your Database Import!
Optimizing your Database Import! Nabil Nawaz
 

Similar to DataPump ile Single Parititon Export (20)

OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Oracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSOracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTS
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop
 
Bypass dbms assert
Bypass dbms assertBypass dbms assert
Bypass dbms assert
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
Performance Tuning Using oratop
Performance Tuning Using oratop Performance Tuning Using oratop
Performance Tuning Using oratop
 
Less17 Util
Less17  UtilLess17  Util
Less17 Util
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
 
Unit 3
Unit 3Unit 3
Unit 3
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
 
Import option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfImport option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdf
 
Ass2-Descriptor.docx1 Problem DescriptionThe objective of .docx
Ass2-Descriptor.docx1 Problem DescriptionThe objective of .docxAss2-Descriptor.docx1 Problem DescriptionThe objective of .docx
Ass2-Descriptor.docx1 Problem DescriptionThe objective of .docx
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
 
Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2Steps for upgrading the database to 10g release 2
Steps for upgrading the database to 10g release 2
 
Optimizing your Database Import!
Optimizing your Database Import! Optimizing your Database Import!
Optimizing your Database Import!
 

More from Anar Godjaev

how to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaulthow to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaultAnar Godjaev
 
Database Vault / Verinin Güvenliği
Database Vault /  Verinin GüvenliğiDatabase Vault /  Verinin Güvenliği
Database Vault / Verinin GüvenliğiAnar Godjaev
 
Oracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumOracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumAnar Godjaev
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and RecoveryAnar Godjaev
 
Oracle Managed Files
Oracle Managed FilesOracle Managed Files
Oracle Managed FilesAnar Godjaev
 
Recovery Manager (RMAN)
Recovery Manager (RMAN)Recovery Manager (RMAN)
Recovery Manager (RMAN)Anar Godjaev
 
Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Anar Godjaev
 
Oracle Database 11g R2 Installation
Oracle Database 11g R2 InstallationOracle Database 11g R2 Installation
Oracle Database 11g R2 InstallationAnar Godjaev
 
Oracle Tablespace Yonetimi
Oracle Tablespace YonetimiOracle Tablespace Yonetimi
Oracle Tablespace YonetimiAnar Godjaev
 

More from Anar Godjaev (17)

Oracle GoldenGate
Oracle GoldenGateOracle GoldenGate
Oracle GoldenGate
 
how to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vaulthow to protect your sensitive data using oracle database vault
how to protect your sensitive data using oracle database vault
 
Database Vault / Verinin Güvenliği
Database Vault /  Verinin GüvenliğiDatabase Vault /  Verinin Güvenliği
Database Vault / Verinin Güvenliği
 
Oracle 10g Database Server Kurulum
Oracle 10g Database Server KurulumOracle 10g Database Server Kurulum
Oracle 10g Database Server Kurulum
 
Parallel Server
Parallel ServerParallel Server
Parallel Server
 
Table Partitions
Table PartitionsTable Partitions
Table Partitions
 
Backup and Recovery
Backup and RecoveryBackup and Recovery
Backup and Recovery
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
LogMiner
LogMinerLogMiner
LogMiner
 
Undo Management
Undo ManagementUndo Management
Undo Management
 
ASM
ASMASM
ASM
 
Oracle Managed Files
Oracle Managed FilesOracle Managed Files
Oracle Managed Files
 
Recovery Manager (RMAN)
Recovery Manager (RMAN)Recovery Manager (RMAN)
Recovery Manager (RMAN)
 
Oracle Enterprise Linux 5
Oracle Enterprise Linux 5Oracle Enterprise Linux 5
Oracle Enterprise Linux 5
 
Oracle Database 11g R2 Installation
Oracle Database 11g R2 InstallationOracle Database 11g R2 Installation
Oracle Database 11g R2 Installation
 
Change DB Name
Change DB NameChange DB Name
Change DB Name
 
Oracle Tablespace Yonetimi
Oracle Tablespace YonetimiOracle Tablespace Yonetimi
Oracle Tablespace Yonetimi
 

DataPump ile Single Parititon Export

  • 1. Anar Godjaev http://anargodjaev.wordpress.com Oracle Data Pump ile Single parititon export/transport Oracle 11g ile birlikte single table partitionlarını veritabanları arasında taşımak mümkün hale gelmiştir, Normal olarak tablonun tamamını taşımaktansa sadece belli partition’unu taşımak çok daha mantıklıdır. Bunu örnekle dahada iyi açıklayabilmek adınapartititonlarımızı saklayacak 2 tane tablespace yaratacağız ve test açamçlı olarak bu tablespace ler üzerinde quotalar vereceğiz. [oracle@rac1 ~]$ sqlplus '/as sysdba' SQL>CREATE TABLESPACE transport_test_ts_1 DATAFILE 'tt_ts1.dbf' SIZE 128K AUTOEXTEND ON NEXT 128K; SQL>CREATE TABLESPACE transport_test_ts_2 DATAFILE 'tt_ts2.dbf' SIZE 128K AUTOEXTEND ON NEXT 128K; SQL>ALTER USER test QUOTA UNLIMITED ON transport_test_ts_1 QUOTA UNLIMITED ON transport_test_ts_2; SQL>CONN test/test Test kullanıcımızla bağlandıktan sonra örnek bir partition tablo yaratıyoruz ve içini veri ile dolduruyoruz. SQL>CREATE TABLE transport_test_tab ( id NUMBER NOT NULL, code VARCHAR2(10) NOT NULL, description VARCHAR2(50), created_date DATE, CONSTRAINT transport_test_pk PRIMARY KEY (id) ) PARTITION BY RANGE (created_date) ( PARTITION part_2010 VALUES LESS THAN (TO_DATE('01-10-2010','DD-MM-YYYY')) TABLESPACE transport_test_ts_1, PARTITION part_2011 VALUES LESS THAN (TO_DATE('01-10-2011','DD-MM-YYYY')) TABLESPACE transport_test_ts_2 ); SQL>INSERT INTO transport_test_tab SQL>INSERT INTO transport_test_tab SQL>INSERT INTO transport_test_tab ADD_MONTHS(SYSDATE,12)); SQL>INSERT INTO transport_test_tab ADD_MONTHS(SYSDATE,12)); SQL>COMMIT; VALUES (1, 'ONE', '1 ONE', SYSDATE); VALUES (2, 'TWO', '2 TWO', SYSDATE); VALUES (3, 'THREE', '3 THREE', VALUES (4, 'FOUR', '4 FOUR', Tablomuzun istatistiğini alıp ,tablomuza ait partitionları ve içerdikleri kayıtlara bir bakalım. SQL>EXEC DBMS_STATS.gather_table_stats(USER, 'TRANSPORT_TEST_TAB'); SQL>COLUMN table_name FORMAT A20 SQL>COLUMN partition_name FORMAT A20 SQL>COLUMN tablespace_name FORMAT A20
  • 2. Anar Godjaev http://anargodjaev.wordpress.com SQL> set linesize 1000 SQL>SELECT table_name, partition_name, tablespace_name, num_rows FROM user_tab_partitions Where table_name='TRANSPORT_TEST_TAB'; TABLE_NAME -------------------TRANSPORT_TEST_TAB TRANSPORT_TEST_TAB PARTITION_NAME -------------------PART_2010 PART_2011 TABLESPACE_NAME NUM_ROWS -------------------- ---------TRANSPORT_TEST_TS_1 2 TRANSPORT_TEST_TS_2 2 Görüldüğü gibi her partition 2 şer kayıt içeriyor. Transport yapacağımız tablespace ler kesinlikle readonly modda olmalıdır. SQL>ALTER TABLESPACE transport_test_ts_1 READ ONLY; Şu an herşey hazır 2010 parititonunu export yapabiliriz. [oracle@rac1 ~]$ sqlplus '/as sysdba' SQL> CREATE OR REPLACE DIRECTORY data_pump_dir AS '/u01/app11g/backup/'; SQL> GRANT READ, WRITE ON DIRECTORY data_pump_dir TO public; [oracle@rac1 ~]$expdp system/oracle tables=test.transport_test_tab:part_2010 transportable=always directory=data_pump_dir dumpfile=part_2010.dmp Yapılan export’un ouput’u aşağıdaki gibi olacaktır. Export: Release 11.2.0.1.0 - Production on Wed NOV18 13:35:17 2010 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/******** tables=test.transport_test_tab:part_2010 transportable=always directory=data_pump_dir dumpfile=part_2010.dmp Processing object type TABLE_EXPORT/TABLE/PLUGTS_BLK Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/END_PLUGTS_BLK Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ***************************************************************************** * Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is: /u01/app11g/backup/part_2010.dmp ***************************************************************************** * Datafiles required for transportable tablespace TRANSPORT_TEST_TS_1: /u01/app11g/oracle/product/11.2.0/db_1/dbs/tt_ts1.dbf
  • 3. Anar Godjaev http://anargodjaev.wordpress.com Datafiles required for transportable tablespace USERS: /u01/app/oracle/oradata/EDUCATE/users01.dbf Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at 13:36:23 Şimdi geri dönme yani backuptan geri alma testi yapacağız bunun için ilgili tabloyu ve onun ait olduğu tablespace leri drop ediyoruz. [oracle@rac1 ~]$ sqlplus '/as sysdba' SQL>DROP TABLE test.transport_test_tab; SQL>DROP TABLESPACE transport_test_ts_1 INCLUDING CONTENTS; SQL>DROP TABLESPACE transport_test_ts_2 INCLUDING CONTENTS AND DATAFILES; Dikkat edersek 1.tablespace te sadece content yani syntax bilgisini drop ettik,tablespace in datafile’ı halen mevcuttur. Şimdi artık aldığımız export backup ındaki bilgiyi import edebiliriz. [oracle@rac1 ~]$impdp system/oracle partition_options=departition dumpfile=part_2010.dmp transport_datafiles='tt_ts1.dbf' İşlemin output bilgiside aşağıdaki gibi olacaktır, $ impdp system/password partition_options=departition dumpfile=part_2007.dmp transport_datafiles='/u01/app/oracle/oradata/DB11G/tt_ts_1' Import: Release 11.2.0.1.0 - Production on Wed NOV18 13:42:38 2010 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/******** partition_options=departition dumpfile=part_2010.dmp transport_datafiles=tt_ts1.dbf Processing object type TABLE_EXPORT/TABLE/PLUGTS_BLK Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX ORA-39083: Object type INDEX failed to create with error: ORA-00942: table or view does not exist Failing sql is: CREATE UNIQUE INDEX "TEST"."TRANSPORT_TEST_PK" ON "TEST"."TRANSPORT_TEST_TAB" ("ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(SEG_FILE 4 SEG_BLOCK 635 OBJNO_REUSE 85559 INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" PARALLEL 1 Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT ORA-39083: Object type CONSTRAINT failed to create with error: ORA-00942: table or view does not exist
  • 4. Anar Godjaev http://anargodjaev.wordpress.com Failing sql is: ALTER TABLE "TEST"."TRANSPORT_TEST_TAB" ADD CONSTRAINT "TRANSPORT_TEST_PK" PRIMARY KEY ("ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(SEG_FILE 4 SEG_BLOCK 635 OBJNO_REUSE 85559 INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS ORA-39112: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"TEST"."TRANSPORT_TEST_PK" creation failed Processing object type TABLE_EXPORT/TABLE/END_PLUGTS_BLK Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" completed with 3 error(s) at 13:42:50 Tablo segmenti tablo ismi ve partition isimlerinin kombinasyonu ile isimlendirilmiştir, bu yüzden buna bağlı olan objeler hata vermiştir çünkü yanlış tablo ismini aramaktadırlar.O yüzden verilen hataları görmezden geliyoruz. Şimdi artık oluşan yeni segmenti aşağıda görebiliriz. [oracle@rac1 ~]$ sqlplus '/as sysdba' SQL>CONN test/test SQL>EXEC DBMS_STATS.gather_schema_stats(USER); SQL>COLUMN table_name FORMAT A30 SQL>COLUMN tablespace_name FORMAT A20 SQL> set linesize 1000 SQL>SELECT table_name, tablespace_name, partitioned, num_rows FROM user_tables Where tablespace_name like '%TRANSPORT_TEST_TS_1%'; TABLE_NAME TABLESPACE_NAME PAR NUM_ROWS ------------------------------ -------------------- --- ---------TRANSPORT_TES_PART_2007 TRANSPORT_TEST_TS_1 NO 2 1 row selected.