當前位置:首頁 » 操作系統 » linuxoracle數據導入

linuxoracle數據導入

發布時間: 2022-07-05 01:31:58

linux oracle 怎麼導入.dmp文件

對於本機安裝了oracle 客戶端,下述命令都可以在 dos 執行,當然 dmp 文件導出在本地。
但在實際研發時,沒人願意在本機上安裝龐大的 oracle 軟體,這時你需要使用 Xshell/puTTY..
遠程工具連接到 Linux 進行操作,進行 Linux 上 dmp 文件的導入導出。
a. 將用戶 system 用戶表導出到指定路徑 D 盤
exp system/password@SID file=d:/chu.dmp full=y

b. 將用戶 system 與 sys 用戶的表導出到指定路徑 D 盤
exp system/password@SID file=d:/chu.dmp owner=(system,sys)

c. 將用戶 system 中的表 table_A、table_B 導出到指定路徑 D 盤
exp system/password@SID file= d:/chu.dmp tables=(table_A,table_B)

d. 將用戶 system 中的表 table1 中的欄位 filed1 以"00"打頭的數據導出
exp system/passwor@SID filed=d:/chu.dmp tables=(table1) query=/" where filed1 like '00%'/"

對於壓縮可以用 winzip 將 dmp 文件進行壓縮,也可以在上面命令後面 加上 compress=y 來實現。
導出 DMP文件適用於大型資料庫完整遷移,對遷移前後兩者伺服器資料庫字元集要求一致,且對CLOB欄位支持不太友好。
對於小數據的導出其實用 PLsql 能做的更好,更快,導出的SQL也很直觀。
e. 將 D:/chu.dmp 中的數據導入 TEST 資料庫中。
imp system/password@SID file=d:/chu.dmp
imp system/password@HUST full=y file=d:/data/newsmgnt.dmp ignore=y

上面命令如果出現問題,假設有的表已存在,對該表可以不進行導入,後面添加 ignore=y。
f. 將 d:/chu.dmp中的表table1 導入
imp system/passord@SID file=d:/chu.dmp tables=(table1)

② linux下怎麼用exp和imp導出和導入指定的oracle資料庫表

導入導出與歸不歸檔沒有關系
用oracle用戶命令行下輸入
exp
scott/tiger
file='保存路徑'
full=y
這樣就可以全庫導出
還有一個問題是scott用戶不定要解鎖,否則會無法連接資料庫
解鎖命令是sqlplus
下的輸入alter
user
scott
account
unlock;

③ linux導入oracle資料庫dm文件時卡在一張表上

源資料庫和目標資料庫必須運行在相同的硬體平台上。源資料庫與目標資料庫必須使用相同的字元集。

④ linux下怎麼用命令導入oracle 備份.del格式文件

1、.del格式文件是DB2導出的定界ASCII文件:
db2 => EXPORT TO emp.del OF DEL SELECT * FROM emp
2、[db2inst1@server9 ~]$ vi emp.del
"000010","CHRISTINE","I","HAAS","A00","3978",19950101,"PRES ",18,"F",19630824,+0152750.00,+0001000.00,+0004220.00
"000020","MICHAEL","L","THOMPSON","B01","3476",20031010,"MANAGER ",18,"M",19780202,+0094250.00,+0000800.00,+0003300.00
3、如果你要在db2導入.del文件
db2 import from myfile.del of del insert into mytable
4、如果你要在oracle導入.del文件
你需要根據格式create table,用Toad for oracle 或者Navicat for oracle導入txt即可。

⑤ linux下我要使用oracle的sqlload向資料庫中導入數據。

例如將scott用戶下所有表,導入到test用戶下
1 exp scott/tiger file=scott.dmp owner=scott
2 (1) 如果test用戶下有scott的表,哪些需要先刪除在導入
conn test/test
select 'drop table '||table_name||' purge;' from user_tables;
imp test/test file=scott.dmp fromuser=scott touser=test
(2) 如果test用戶下沒有scott用戶的表,可以直接導入
imp test/test file=scott.dmp fromuser=scott touser=test

⑥ linux中怎麼實現導入導出oracle資料庫中

exp和imp

1. 獲取幫助
imp help=y
2. 導入一個完整資料庫
imp system/manager file=bible_db log=dible_db full=y ignore=y
3. 導入一個或一組指定用戶所屬的全部表、索引和其他對象
imp system/manager file=seapark log=seapark fromuser=seapark
imp system/manager file=seapark log=seapark fromuser=(seapark,amy,amyc,harold)
4. 將一個用戶所屬的數據導入另一個用戶
imp system/manager file=tank log=tank fromuser=seapark touser=seapark_
imp system/manager file=tank log=tank fromuser=(seapark,amy)
touser=(seapark1, amy1)
5. 導入一個表
imp system/manager file=tank log=tank fromuser=seapark TABLES=(a,b)
6. 從多個文件導入
imp system/manager file=(paycheck_1,paycheck_2,paycheck_3,paycheck_4)
log=paycheck, filesize=1G full=y
7. 使用參數文件
imp system/manager parfile=bible_tables.par
bible_tables.par參數文件:
#Import the sample tables used for the Oracle8i Database Administrator's
Bible. fromuser=seapark touser=seapark_ file=seapark log=seapark_import
8. 增量導入
imp system./manager inctype= RECTORE FULL=Y FILE=A
-------------------------------------------------------------------------------------------------------------------------------------------
1. 獲取幫助
exp help=y

2. 導出一個完整資料庫
exp system/manager file=bible_db log=dible_db full=y

3. 導出資料庫定義而不導出數據
exp system/manager file=bible_db log=dible_db full=y rows=n

4. 導出一個或一組指定用戶所屬的全部表、索引和其他對象
exp system/manager file=seapark log=seapark owner=seapark
exp system/manager file=seapark log=seapark owner=(seapark,amy,amyc,harold)
注意:在導出用戶時,盡管已經得到了這個用戶的所有對象,但是還是不能得到這些對象引用的任何同義詞。解決方法是用以下的SQL*Plus命令創建一個腳本文件,運行這個腳本文件可以獲得一個重建seapark所屬對象的全部公共同義詞的可執行腳本,然後在目標資料庫上運行該腳本就可重建同義詞了。

SET LINESIZE 132
SET PAGESIZE 0
SET TRIMSPOOL ON
SPOOL c:\seapark.syn
SELECT 'Create public synonym '||synonym_name
||' for '||table_owner||'.'||table_name||';'
FROM dba_synonyms
WHERE table_owner = 'SEAPARK' AND owner = 'PUBLIC';
SPOOL OFF

5. 導出一個或多個指定表
exp seapark/seapark file=tank log=tank tables=tank
exp system/manager file=tank log=tank tables=seapark.tank
exp system/manager file=tank log=tank tables=(seapark.tank,amy.artist)

6. 估計導出文件的大小
全部表總位元組數:
SELECT sum(bytes)
FROM dba_segments
WHERE segment_type = 'TABLE';

seapark用戶所屬表的總位元組數:
SELECT sum(bytes)
FROM dba_segments
WHERE owner = 'SEAPARK'
AND segment_type = 'TABLE';

seapark用戶下的aquatic_animal表的位元組數:
SELECT sum(bytes)
FROM dba_segments
WHERE owner = 'SEAPARK'
AND segment_type = 'TABLE'
AND segment_name = 'AQUATIC_ANIMAL';

7. 導出表數據的子集(oracle8i以上)
NT系統:

exp system/manager query='Where salad_type='FRUIT'' tables=amy.salad_type
file=fruit log=fruit
UNIX系統:

exp system/manager query=\"Where salad_type=\'FRUIT\'\" tables=amy.salad_type
file=fruit log=fruit

8. 用多個文件分割一個導出文件
exp system/manager
file=(paycheck_1,paycheck_2,paycheck_3,paycheck_4)
log=paycheck, filesize=1G tables=hr.paycheck

9. 使用參數文件
exp system/manager parfile=bible_tables.par
bible_tables.par參數文件:

#Export the sample tables used for the Oracle8i Database Administrator's Bible.
file=bible_tables
log=bible_tables
tables=(
amy.artist
amy.books
seapark.checkup
seapark.items
)

10. 增量導出
「完全」增量導出(complete),即備份整個資料庫
exp system/manager inctype=complete file=990702.dmp
「增量型」增量導出(incremental),即備份上一次備份後改變的數據
exp system/manager inctype=incremental file=990702.dmp
「累計型」增量導出(cumulative),即備份上一次「完全」導出之後改變的數據
exp system/manager inctype=cumulative file=990702.dmp

⑦ linux下的oracle導入數據出問題,我是第一次使用linux,請高手幫忙啊!謝謝!

ora-12154通常的檢查和處理辦法:
1、首先查看客戶端的tnsnames.ora文件,找到資料庫連接的描述中,sid= 或service_name=之後的名稱,假設這個名稱是orcl。
2、然後在客戶端用tnsping命令,測試剛才找到的實例名,命令:tnsping orcl
如果不通,則要從網路環境、資料庫環境等方面找原因,看是否實例名錯誤、資料庫是否啟動、資料庫監聽是否啟動、網路是否通暢

⑧ 在linux系統下導入oracle數據文件。

首先oracle版本要對應,或者向下兼容
然後,建立相應的表空間,如果導出文件中有表空間,要在linux下建立相應的,大小你得自己看自己導出來的dmp多大
然後最好建立相應的用戶,比如導出時用的user1,linux下你也要建同一個user1,並賦予相應許可權

然後imp user/password@sid file='路徑\文件名.dmp' full=y

然後等執行完了就完了

⑨ 求教linux 下oracle數據的導入導出方法詳細步驟

一. 導出工具 exp

1. 它是操作系統下一個可執行的文件 存放目錄/ORACLE_HOME/bin

exp導出工具將資料庫中數據備份壓縮成一個二進制系統文件.可以在不同OS間遷移

它有三種模式:
a. 用戶模式: 導出用戶所有對象以及對象中的數據;
b. 表模式: 導出用戶所有表或者指定的表;
c. 整個資料庫: 導出資料庫中所有對象。

2. 導出工具exp互動式命令行方式的使用的例子

$exp test/test123@appdb
Enter array fetch buffer size: 4096 > 回車
Export file: expdat.dmp > m.dmp 生成導出的文件名
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > 3
Export table data (yes/no): yes > 回車
Compress extents (yes/no): yes > 回車
Export done in ZHS16GBK character set and ZHS16GBK NCHAR character set
About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > cmamenu 要導出的表名
. . exporting table CMAMENU 4336 rows exported
Table(T) or Partition(T:P) to be exported: (RETURN to quit) >要導出的表名n
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > 回車
Export terminated successfully without warnings.

3. 導出工具exp非互動式命令行方式的例子

$exp scott/tiger tables=(emp,dept) file=/directory/scott.dmp grants=y

說明:把scott用戶里兩個表emp,dept導出到文件/directory/scott.dmp

$exp scott/tiger tables=emp query=\"where job=\'salesman\' and sal\<1600\" file=/directory/scott2.dmp

說明:在exp裡面加上導出emp的查詢條件job='salesman' and sal<1600

(但我個人很少這樣用,還是把滿足條件的記錄生成臨時表後,再exp會方便一些)

$exp parfile=username.par
file=/directory1/username_1.dmp,/directory1/username_2.dmp
filesize=2000M log=/directory2/username_exp.log

參數文件username.par內容
userid=username/userpassword
buffer=8192000
compress=n
grants=y

說明:username.par為導出工具exp用的參數文件,裡面具體參數可以根據需要去修改

filesize指定生成的二進制備份文件的最大位元組數

(可用來解決某些OS下2G物理文件的限制及加快壓縮速度和方便刻歷史數據光碟等)

二.導入工具 imp

1. 它是操作系統下一個可執行的文件 存放目錄/ORACLE_HOME/bin

imp導入工具將EXP形成的二進制系統文件導入到資料庫中.

它有三種模式:
a. 用戶模式: 導出用戶所有對象以及對象中的數據;
b. 表模式: 導出用戶所有表或者指定的表;
c. 整個資料庫: 導出資料庫中所有對象。

只有擁有IMP_FULL_DATABASE和DBA許可權的用戶才能做整個資料庫導入

imp步驟:
(1) create table (2) insert data (3) create index (4) create triggers,constraints

2.導入工具imp互動式命令行方式的例子
$ imp
Import: Release 8.1.6.0.0 - Proction on 星期五 12月 7 17:01:08 2001
(c) Copyright 1999 Oracle Corporation. All rights reserved.
用戶名: test
口令:****
連接到: Oracle8i Enterprise Edition Release 8.1.6.0.0 - 64bit Proction
With the Partitioning option
JServer Release 8.1.6.0.0 - Proction
導入文件: expdat.dmp> /tmp/m.dmp
輸入插入緩沖區大小(最小為 8192 ) 30720>
經由常規路徑導出由EXPORT:V08.01.06創建的文件
警告: 此對象由 TEST 導出, 而不是當前用戶
已經完成ZHS16GBK字元集和ZHS16GBK NCHAR 字元集中的導入
只列出導入文件的內容(yes/no):no>
由於對象已存在, 忽略創建錯誤(yes/no):no> yes
導入許可權(yes/no):yes>
導入表數據(yes/no):yes>
導入整個導出文件(yes/no):no> yes
. 正在將TEST的對象導入到 SCOTT
. . 正在導入表 "CMAMENU" 4336行被導入
成功終止導入,但出現警告。

3.導入工具imp非互動式命令行方式的例子

$ imp system/manager fromuser=jones tables=(accts)
$ imp system/manager fromuser=scott tables=(emp,dept)
$ imp system/manager fromuser=scott touser=joe tables=emp
$ imp scott/tiger file = expdat.dmp full=y
$ imp scott/tiger file = /mnt1/t1.dmp show=n buffer=2048000 ignore=n
commit=y grants=y full=y log=/oracle_backup/log/imp_scott.log
$ imp system/manager parfile=params.dat
params.dat 內容
file=dba.dmp show=n ignore=n grants=y fromuser=scott tables=(dept,emp)

4.導入工具imp可能出現的問題

(1) 資料庫對象已經存在
一般情況, 導入數據前應該徹底刪除目標數據下的表, 序列, 函數/過程,觸發器等;
資料庫對象已經存在, 按預設的imp參數, 則會導入失敗
如果用了參數ignore=y, 會把exp文件內的數據內容導入
如果表有唯一關鍵字的約束條件, 不合條件將不被導入
如果表沒有唯一關鍵字的約束條件, 將引起記錄重復

(2) 資料庫對象有主外鍵約束
不符合主外鍵約束時, 數據會導入失敗
解決辦法: 先導入主表, 再導入依存表
disable目標導入對象的主外鍵約束, 導入數據後, 再enable它們
(3) 許可權不夠
如果要把A用戶的數據導入B用戶下, A用戶需要有imp_full_database許可權

(4) 導入大表( 大於80M ) 時, 存儲分配失敗
默認的EXP時, compress = Y, 也就是把所有的數據壓縮在一個數據塊上.
導入時, 如果不存在連續一個大數據塊, 則會導入失敗.
導出80M以上的大表時, 記得compress= N, 則不會引起這種錯誤.

(5) imp和exp使用的字元集不同
如果字元集不同, 導入會失敗, 可以改變unix環境變數或者NT注冊表裡NLS_LANG相關信息.
導入完成後再改回來.

(6) imp和exp版本不能往上兼容
imp可以成功導入低版本exp生成的文件, 不能導入高版本exp生成的文件
根據情況我們可以用
$ imp username/password@connect_string
說明: connect_string 是在/ORACLE_HOME/network/admin/tnsnames.ora
定義的本地或者遠端資料庫的名稱
注意事項:
UNIX: /etc/hosts 要定義本地或者遠端資料庫伺服器的主機名
win98: windows\hosts 和IP地址的對應關系
win2000: winnt\system32\drivers\etc\hosts

熱點內容
解壓到當前文件夾右鍵 發布:2024-04-26 03:57:08 瀏覽:979
html5android教程視頻下載 發布:2024-04-26 03:09:59 瀏覽:867
伺服器的描述是什麼 發布:2024-04-26 03:08:32 瀏覽:394
個人加密 發布:2024-04-26 03:01:23 瀏覽:520
linuxusbgadget 發布:2024-04-26 02:52:54 瀏覽:304
我的世界空島世界伺服器地址 發布:2024-04-26 01:39:08 瀏覽:248
尼爾機械紀元加密 發布:2024-04-26 01:37:11 瀏覽:867
在控制台輸出sql語句 發布:2024-04-26 01:08:12 瀏覽:432
動畫java 發布:2024-04-26 01:02:40 瀏覽:12
得力文件夾5302 發布:2024-04-26 00:21:32 瀏覽:91