轉資料遷移
1、資料泵匯入匯出
create directory dump_file_dir as '/home/oracle/';
grant read,write on directory dump_file_dir to gyj;
expdp gyj/gyj directory=dump_file_dir dumpfile=gyj20121117.dmp nologfile=y;
create user gyj1 identified by gyj1 default tablespace t2;
grant dba to gyj1;
impdp test1/test1 directory=dump_file_dir dumpfile=gyj20120922.dmp remap_schema=gyj:test1 remap_tablespace=USERS:TP50,TP2:TP50,TP12:TP50 nologfile=y
注:select * from dba_datapump_jobs;
expdp gyj/gyj attach=gyj1.SYS_EXPORT_SCHEMA_01;
kill-->yes(kill_job此命令在11g中不能用);
2、表空間傳輸(Transportable Tablespace):OLTP
A庫:
exec dbms_tts.transport_set_check('OLTP',true); //檢查是否自包含(如索引,分割槽表,CLOB等不在一個表空間就不是自包含)
select * from transport_set_violations; //如果返回為空說明滿足自包含
create directory dir_prod as ‘/home/oracle/dir’;
alter tablespace oltp read only;
expdp system/oracle dumpfile=oltp.dmp directory=dir_prod TRANSPORT_TABLESPACES=oltp;
scp /u01/app/oracle/oradata/PROD/Disk1/oltp1.dbf oracle@192.168.0.3:/u01/app/oracle/oradata/EMREP/
scp /home/oracle/dir/oltp.dmp oracle@192.168.0.3:/home/oracle/dir
B庫:
create directory dir_prod as ‘/home/oracle/dir’;
create user oltp_user identified by oracle;
grant dba to oltp_user;
impdp system/oracle@emrep dumpfile='oltp.dmp' directory= dir_emrep transport_datafiles='/u01/app/oracle/oradata/EMREP/oltp1.dbf','/u01/app/oracle/oradata/EMREP/batch.dbf'
A、B庫:
alter tablespace oltp read write;
*************************************
alter database mount;
alter database datafile '/u01/app/oracle/oradata/bxdb/tp1.dbf' offline drop ;
alter database open;
drop tablespace tp1 including contents and datafiles cascade constraints;
***************************************
3、SQL*Loader
(1)建表
create table gyj_yktjsxxb(sfzh varchar2(20),xm varchar2(20));
(2)記事本中的資料
vi t_jzgxx_sm.txt
432325197810254019|Tom|
433101196303180048|Joe|
433101195709120024|Rose|
43310119691229004x|Jack|
433101196711270050|Linda|
433101197306101514|Jeny|
vi ytkjsxx.ctl
load data
infile '/home/oracle/t_jzgxx_sm.txt'
into table gyj_yktjsxxb
fields terminated by '|'
(sfzh,xm)
sqlldr userid=gyj/gyj control=/home/oracle/ytkjsxx.ctl
4、外部表
(1)、Loader生成外部表載入檔案:Administrator's Guide 15章結尾 create external table
In the scripts directory, you will find prod_master.dat and prod_master.ctl. Using the information found in these files,
create an external table names PROD_MASTER in the SH schema of the PROD database.
[oracle@rptdb1 external]$ cat prod_master.ctl
load data
infile '/home/oracle/dir/prod_master.dat'
append
into table costs
fields terminated by ","
(channel_id,prod_id,promo_id,time_id,unit_cost,unit_price)
[oracle@rptdb1 external]$
[oracle@rptdb1 external]$ cat prod_master.dat
6,6,6,6,6,600
7,7,7,7,7,700
create directory dir as '/opt/oracrs/external';
grant read,write on directory dir to sh;
create table costs(channel_id number,prod_id number,promo_id number,time_id number,unit_cost number,unit_price number
);
sqlldr gyj/gyj control=prod_master.ctl external_table=GENERATE_ONLY
(2)、Datapump外部表解除安裝:Database Data Warehousing Guide 12章結尾部分Extracting into Export Files Using External Tables
CREATE TABLE ext_t1
ORGANIZATION external
(
TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY dump_file_dir
location ('t1.dat')
)
as SELECT * FROM T1 WHERE ID=1;
(3)、Datapump外部表載入
SQL> create table ext_t1
(id number,
name varchar2(100)
)
organization external
(
type oracle_datapump
default directory DUMP_FILE_DIR
location ('t1.dat')
);
**********本部落格所有內容均為原創,如有轉載請註明作者和出處!!!**********
Name: guoyJoe
QQ: 252803295
Email: oracledba_cn@hotmail.com
Blog:http://blog.csdn.net/guoyJoe
ITPUB:http://www.itpub.net/space-uid-28460966.html
OCM:http://education.oracle.com/education/otn/YGuo.HTM
_____________________________________________________________
create directory dump_file_dir as '/home/oracle/';
grant read,write on directory dump_file_dir to gyj;
expdp gyj/gyj directory=dump_file_dir dumpfile=gyj20121117.dmp nologfile=y;
create user gyj1 identified by gyj1 default tablespace t2;
grant dba to gyj1;
impdp test1/test1 directory=dump_file_dir dumpfile=gyj20120922.dmp remap_schema=gyj:test1 remap_tablespace=USERS:TP50,TP2:TP50,TP12:TP50 nologfile=y
注:select * from dba_datapump_jobs;
expdp gyj/gyj attach=gyj1.SYS_EXPORT_SCHEMA_01;
kill-->yes(kill_job此命令在11g中不能用);
2、表空間傳輸(Transportable Tablespace):OLTP
A庫:
exec dbms_tts.transport_set_check('OLTP',true); //檢查是否自包含(如索引,分割槽表,CLOB等不在一個表空間就不是自包含)
select * from transport_set_violations; //如果返回為空說明滿足自包含
create directory dir_prod as ‘/home/oracle/dir’;
alter tablespace oltp read only;
expdp system/oracle dumpfile=oltp.dmp directory=dir_prod TRANSPORT_TABLESPACES=oltp;
scp /u01/app/oracle/oradata/PROD/Disk1/oltp1.dbf oracle@192.168.0.3:/u01/app/oracle/oradata/EMREP/
scp /home/oracle/dir/oltp.dmp oracle@192.168.0.3:/home/oracle/dir
B庫:
create directory dir_prod as ‘/home/oracle/dir’;
create user oltp_user identified by oracle;
grant dba to oltp_user;
impdp system/oracle@emrep dumpfile='oltp.dmp' directory= dir_emrep transport_datafiles='/u01/app/oracle/oradata/EMREP/oltp1.dbf','/u01/app/oracle/oradata/EMREP/batch.dbf'
A、B庫:
alter tablespace oltp read write;
*************************************
alter database mount;
alter database datafile '/u01/app/oracle/oradata/bxdb/tp1.dbf' offline drop ;
alter database open;
drop tablespace tp1 including contents and datafiles cascade constraints;
***************************************
3、SQL*Loader
(1)建表
create table gyj_yktjsxxb(sfzh varchar2(20),xm varchar2(20));
(2)記事本中的資料
vi t_jzgxx_sm.txt
432325197810254019|Tom|
433101196303180048|Joe|
433101195709120024|Rose|
43310119691229004x|Jack|
433101196711270050|Linda|
433101197306101514|Jeny|
vi ytkjsxx.ctl
load data
infile '/home/oracle/t_jzgxx_sm.txt'
into table gyj_yktjsxxb
fields terminated by '|'
(sfzh,xm)
sqlldr userid=gyj/gyj control=/home/oracle/ytkjsxx.ctl
4、外部表
(1)、Loader生成外部表載入檔案:Administrator's Guide 15章結尾 create external table
In the scripts directory, you will find prod_master.dat and prod_master.ctl. Using the information found in these files,
create an external table names PROD_MASTER in the SH schema of the PROD database.
[oracle@rptdb1 external]$ cat prod_master.ctl
load data
infile '/home/oracle/dir/prod_master.dat'
append
into table costs
fields terminated by ","
(channel_id,prod_id,promo_id,time_id,unit_cost,unit_price)
[oracle@rptdb1 external]$
[oracle@rptdb1 external]$ cat prod_master.dat
6,6,6,6,6,600
7,7,7,7,7,700
create directory dir as '/opt/oracrs/external';
grant read,write on directory dir to sh;
create table costs(channel_id number,prod_id number,promo_id number,time_id number,unit_cost number,unit_price number
);
sqlldr gyj/gyj control=prod_master.ctl external_table=GENERATE_ONLY
(2)、Datapump外部表解除安裝:Database Data Warehousing Guide 12章結尾部分Extracting into Export Files Using External Tables
CREATE TABLE ext_t1
ORGANIZATION external
(
TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY dump_file_dir
location ('t1.dat')
)
as SELECT * FROM T1 WHERE ID=1;
(3)、Datapump外部表載入
SQL> create table ext_t1
(id number,
name varchar2(100)
)
organization external
(
type oracle_datapump
default directory DUMP_FILE_DIR
location ('t1.dat')
);
**********本部落格所有內容均為原創,如有轉載請註明作者和出處!!!**********
Name: guoyJoe
QQ: 252803295
Email: oracledba_cn@hotmail.com
Blog:http://blog.csdn.net/guoyJoe
ITPUB:http://www.itpub.net/space-uid-28460966.html
OCM:http://education.oracle.com/education/otn/YGuo.HTM
_____________________________________________________________
相關文章
- Kafka資料遷移Kafka
- Harbor資料遷移
- gitlab資料遷移Gitlab
- 資料庫遷移資料庫
- 資料遷移(1)——通過資料泵表結構批量遷移
- Mysql資料遷移方法MySql
- 【Hive】hive資料遷移Hive
- 【Redis】 redis資料遷移Redis
- redis資料庫遷移Redis資料庫
- congregate遷移gitlab資料Gitlab
- 系統資料遷移
- 資料庫遷移 :理解資料庫
- laravel資料庫遷移Laravel資料庫
- Fastdfs資料遷移方案AST
- 伺服器資料遷移的方法-硬體不同如何遷移資料伺服器
- 遷移資料庫的檔案到不同路徑(轉)資料庫
- linux mysql資料庫遷移LinuxMySql資料庫
- django資料庫遷移-15Django資料庫
- geoserver資料儲存遷移Server
- 用rman遷移資料庫資料庫
- 資料庫遷移手記資料庫
- 遷移MySQL 5.7資料庫MySql資料庫
- 資料庫遷移神器——Flyway資料庫
- Redis migrate 資料遷移工具Redis
- dm資料庫遷移命令資料庫
- SQL Server資料庫遷移SQLServer資料庫
- SAP資料遷移需要多久?
- 資料遷移方案選擇
- AWS RDS Oracle資料遷移Oracle
- 雲資料庫管理與資料遷移資料庫
- Mysql百萬級資料遷移,怎麼遷移?實戰過沒?MySql
- 金倉資料庫資料遷移實戰:從MySQL到KES的順利遷移資料庫MySql
- PDB克隆遷移轉換
- 遷移資料庫資料考慮問題資料庫
- Oracle資料庫(資料泵)遷移方案(上)Oracle資料庫
- Oracle資料庫(資料泵)遷移方案(下)Oracle資料庫
- Dynamics CRM 資料遷移工具DataMigrationUtility
- redis叢集 資料遷移方案Redis
- dnf資料庫備份&遷移資料庫