Ⅰ oracle導入sql文件
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
imp boss/boss@scott file=jkluio.dmp log=jkluio.log fromuser=boss touser=boss commit=y;
exp boss/123qwe!@CBGLDB file=boss.dmp log=boss.log owner=boss;
Ⅱ 請問如何在oracle中導入.sql文件
向oracle中導入大sql文件:
在sql_plus裡面執行:
sql>@full_path/test.sql;
例:sql>@d:/test.sql;
不需要commit;
一般都是在test.sql
裡面最後加上一個commit;
但是需要注意的是:在test.sql文件裡面每條語句後必須加上「;」,代表一條語句的執行。
Ⅲ 從網上下載的oracle資料庫怎麼用別人sql文件
1、先打開cmd再進入mysql的bin目錄。
2、點擊回車,填寫用戶名和密碼。
3、回車,指向自己的目錄。
4、使用文本編輯工具打開後,將文件內容復制出來,在資料庫找到可視化工具。
5、在文件中選擇新建查詢標簽,將復制的內容粘貼到右邊窗口運行即可。
Ⅳ oracle怎麼導入sql文件
PL/SQL登錄到資料庫,使用tools工具進行導入。使用plsql登錄到需要導入數據的資料庫。點擊工具欄上【tools】--【Import tables】
Ⅳ sql如何導入資料庫
sql文件導入資料庫的方法有兩種,一種是用cmd的調試環境導入sql文件中的數據,還有一種是使用MysqlWorkbence調試環境來導入數據。
Ⅵ sql文件怎麼導入到Oracle資料庫
在sqlplus運行後。
先連接上資料庫
然後使用
@sql文件名.sql
(註:該sql文件,需要在當前目錄下)
如果需要在cmd的批處理的方式下,運行外部SQL文件的話。
可以通過加命令行參數的方式來實現。
test.sql文件內容如下:
createtabletest_sqlplus(
id int,
val varchar(10)
);
INSERTINTOtest_sqlplusVALUES(1,'A');
INSERTINTOtest_sqlplusVALUES(2,'B');
COMMIT;
EXITE:Temp>sqlplustest/test@[email protected]
SQL*Plus:Release9.2.0.1.0-Proctionon星期五4月2612:37:122013
Copyright(c)1982,2002,OracleCorporation.Allrightsreserved.
連接到:
.2.0.1.0-Proction
表已創建。
已創建1行。
已創建1行。
提交完成。
從.2.0.1.0-Proction中斷開
E:Temp>
Ⅶ oracle怎樣導入*.sql文件
oracle導入*.sql文件只需要在Oracle伺服器的命令行里sqlplus / as sysdba命令可以登陸到sqlplus命令行里。
然後比如是C:/a.sql,那麼就執行@C:/a.sql,然後跑完後這個a.sql就被導入進來了。
Ⅷ Oracle-sqlplus導入sql文件
將一張表的數據插入到另一張表insert into table2 select * from table1;如果表不存在可以使用 create table table2 as select * from table1; 但是如果要插入的數據量比較大,用命令好使些。
使用PLSQL Developer導入insert語句,數據量過大會死掉,所以直接使用命令行的方式導入insert語句
命令行進入sqlplus: sqlplus 用戶名/密碼@127.0.0.1:1521/tiger ( sqlplus test_name/[email protected]:1521/tiger )
sql>@full_path/test.sql; 例:sql>@D:/test.sql;
test.sql 裡面最後加上一個commit;
--參考http://blog.csdn.net/yin_jw/article/details/38894905
Ⅸ 怎麼把sql文件導入oracle中
你如果用SQLloader導外部數據:
1、你的SQL文件應該是指數據文件,可以是用分隔符或者定長區別欄位的數據;
2、你必須先在ORACLE中創建你要導入的目標表chinaMap;
3、你在控制文件中必須定義好chinaMap和導入數據文件欄位對於的chinaMap欄位,數據文件欄位順序必須和你在控制文件中定義chinaMap欄位順序一致。
4、SQLloader和資料庫的鏈接是走sqlnet定義的服務名的,只要你sqlplus可以訪問資料庫就可以。