oracle表的匯入匯出 表的備份 連表更新

2021-10-04 22:38:59 字數 1217 閱讀 6385

將乙個表的資料備份到另乙個表中:

create table tableb as select * from tablea;
表存在:

insert into tableb(【欄位名】) select 欄位名 from tablea;
將a表的字段更新的b表中:

update t1  set school = (select school from t2 where name=student) where  exists (select * from t2 as b where name = b.student);
一.如何用slq語句把乙個表中的某幾個欄位的資料插入到另乙個新錶中,就要用下面這條slq語句:    insert into 表名1(欄位1,欄位2) select 欄位1,欄位2 from 表名2

這裡有一點值得注意的是這2個字段要一一對應,並且按順序。 二.如果另乙個表是已經有資料的表,只希望更改其中的一列或幾列的話,則用下面的sql語句:   update 表名1,表名2 set 表名1.欄位1 = 表名2.欄位1 where 表名1.欄位2 = 表名2.欄位2  

因為第二個表是更新,所以只要指定與第乙個表的關係,目的是資料的更新的時候能一一對應。

一般先導sql,在導dmp,如果匯入sql檔案一閃而過,可以試著新建命令視窗

//匯出

exp bzdzk/[email protected]:1521/orcl file=d:/bzdz.dmp owner=(system,sys)

exp bzdzk/[email protected]:1521/orcl file=d:/bzdz.dmp tables=(test,employee) query=\"where id>6 and name like 't%' \"

//匯入

imp bzdzk/[email protected]:1521/orcl table=emp file=d:/bzdz.dmp full=y

--ignore=y

--data_only=y  只匯入資料

--tables=(a,b)指定表名

transport_tablespace=y  datafile=/data1/oracle/test.dbf

dmp含有blob欄位時,可先建立表結構,後只匯入dmp資料

Oracle表的匯入匯出

匯出 exp exp 使用者名稱 密碼 例項名 file 匯出的dmp檔案存放路徑 log 匯出日誌存放路徑 exp hr 123456 orcl file c users administrator desktop exp exphr.dmp log c users administrator d...

Oracle 匯入匯出表

下面介紹的是匯入匯出的例項,向匯入匯出看例項基本上就可以完成,因為匯入匯出很簡單。資料匯出 1 將資料庫test完全匯出,使用者名稱system 密碼manager 匯出到d daochu.dmp中 exp system manager orcl 127.0.0.1 file d daochu.dm...

oracle 匯入匯出表資料

感謝博主分享 system manager test system 使用者名稱 manager 密碼 test 資料庫位址 file 要將檔案匯出的位置 tables 要匯出的表名 owner 匯出表的所屬使用者 一 資料匯出 1 將資料庫test完全匯出,使用者名稱system 密碼manager...