當前位置:首頁 » 編程語言 » oraclesql文件導入

oraclesql文件導入

發布時間: 2022-08-06 21:51:06

『壹』 怎麼將sql文件導入oracle

我有兩個.sql文件在某個文件夾里,安裝文檔上說,將數據文件導入資料庫,在Oracle伺服器的命令行里sqlplus / as sysdba命令可以登陸到sqlplus命令行

『貳』 oracle sql資料庫怎麼導入庫

Oracle數據導入導出imp/exp就相當於oracle數據還原與備份。exp命令可以把數據從遠程
資料庫伺服器
導出到本地的dmp文件,imp命
令可以把dmp文件從本地導入到遠處的資料庫伺服器中。
利用這個功能可以構建兩個相同的資料庫

『叄』 oracle怎樣sql文件導入資料庫中

 導出
導出具體的分為:導出表,導出方案,導出資料庫三種方式。
導出使用exp命令來完成的,該命令常用的選項有:
userid: 用於指定執行導出操作的用戶名,口令,連接字元串
tables: 用於指定執行導出操作的表
owner: 用於指定執行導出操作的方案
full=y: 用於指定執行導出操作的資料庫
inctype: 用於指定執行導出操作的增量類型
rows: 用於指定執行導出操作是否要導出表中的數據
file: 用於指定導出文件名
Oracle 筆記
23

 導出表
1.導出自己的表
exp userid=scott/tiger@myoral tables=(emp,dept) file=d:\e1.dmp
2.導出其它方案的表
如果用戶要導出其它方案的表,則需要dba的許可權或是exp_full_database的許可權,比如system就可以導出scott的表
E:\oracle\ora92\bin>exp userid=system/manager@myoral tables=(scott.emp) file=d:\e2.emp
特別說明:在導入和導出的時候,要到oracle目錄的bin目錄下。
3. 導出表的結構
exp userid=scott/tiger@accp tables=(emp) file=d:\e3.dmp rows=n
4. 使用直接導出方式
exp userid=scott/tiger@accp tables=(emp) file=d:\e4.dmp direct=y
這種方式比默認的常規方式速度要快,當數據量大時,可以考慮使用這樣的方法。
這時需要資料庫的字元集要與客戶端字元集完全一致,否則會報錯...
 導出方案
導出方案是指使用export工具導出一個方案或是多個方案中的所有對象(表,索引,約束...)和數據。並存放到文件中。
1. 導出自己的方案
exp userid=scott/tiger@myorcl owner=scott file=d:\scott.dmp
2. 導出其它方案
如果用戶要導出其它方案,則需要dba的許可權或是exp_full_database的許可權,比如system用戶就可以導出任何方案
exp userid=system/manager@myorcl owner=(system,scott) file=d:\system.dmp
 導出資料庫
導出資料庫是指利用export導出所有資料庫中的對象及數據,要求該用戶具有dba的許可權或者是exp_full_database許可權
增量備份(好處是第一次備份後,第二次備份就快很多了)
exp userid=system/manager@myorcl full=y inctype=complete file=d:\all.dmp
導入
 介紹
導入就是使用工具import將文件中的對象和數據導入到資料庫中,但是導入要使用的文件必須是export所導出的文件。與導
出相似,導入也分為導入表,導入方案,導入資料庫三種方式。
imp常用的選項有
userid: 用於指定執行導入操作的用戶名,口令,連接字元串
tables: 用於指定執行導入操作的表
formuser: 用於指定源用戶
touser: 用於指定目標用戶
file: 用於指定導入文件名
full=y: 用於指定執行導入整個文件
inctype: 用於指定執行導入操作的增量類型
rows: 指定是否要導入錶行(數據)
ignore: 如果表存在,則只導入數據
 導入表
1. 導入自己的表
imp userid=scott/tiger@myorcl tables=(emp) file=d:\xx.dmp
2. 導入表到其它用戶
要求該用戶具有dba的許可權,或是imp_full_database
imp userid=system/tiger@myorcl tables=(emp) file=d:\xx.dmp touser=scott
3. 導入表的結構
Oracle 筆記
24

只導入表的結構而不導入數據
imp userid=scott/tiger@myorcl tables=(emp) file=d:\xx.dmp rows=n
4. 導入數據
如果對象(如比表)已經存在可以只導入表的數據
imp userid=scott/tiger@myorcl tables=(emp) file=d:\xx.dmp ignore=y
 導入方案
導入方案是指使用import工具將文件中的對象和數據導入到一個或是多個方案中。如果要導入其它方案,要求該用戶具有dba
的許可權,或者imp_full_database
1. 導入自身的方案
imp userid=scott/tiger file=d:\xxx.dmp
2. 導入其它方案
要求該用戶具有dba的許可權
imp userid=system/manager file=d:\xxx.dmp fromuser=system touser=scott
 導入資料庫
在默認情況下,當導入資料庫時,會導入所有對象結構和數據,案例如下:
imp userid=system/manager full=y file=d:\xxx.dmp

『肆』 oracle 資料庫如何導入 .sql文件

就是在plsql中把此sql文件打開啊,兩兆的文件打開肯定會比較慢,需要耐心等待一會了

『伍』 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;

『陸』 怎麼把sql文件導入oracle中

你如果用SQLloader導外部數據:
1、你的SQL文件應該是指數據文件,可以是用分隔符或者定長區別欄位的數據;
2、你必須先在ORACLE中創建你要導入的目標表chinaMap;
3、你在控制文件中必須定義好chinaMap和導入數據文件欄位對於的chinaMap欄位,數據文件欄位順序必須和你在控制文件中定義chinaMap欄位順序一致。
4、SQLloader和資料庫的鏈接是走sqlnet定義的服務名的,只要你sqlplus可以訪問資料庫就可以。

『柒』 請問如何在oracle中導入.sql文件

向oracle中導入大sql文件:
在sql_plus裡面執行:
sql>@full_path/test.sql;
例:sql>@d:/test.sql;
不需要commit;
一般都是在test.sql
裡面最後加上一個commit;
但是需要注意的是:在test.sql文件裡面每條語句後必須加上「;」,代表一條語句的執行。

『捌』 oracle中怎樣導入資料庫文件

1、登錄到要導入的資料庫及用戶。

2、依次點擊「工具」——「導入表」。

3、輸入如下命令;

imp被導入用戶名/密碼@實例名file=文件名.dmplog=日誌.dmpfromuser=導出用戶touser=導入用戶

4、 輸入後按回車鍵,等待導入完成即可。

『玖』 oracle中怎麼導入sql文件

oracle中怎麼導入sql文件
向oracle中導入大sql文件:
在SQL_PLUS裡面執行:
sql>@full_path/test.sql;
例:sql>@D:/test.sql;
不需要commit; 一般都是在test.sql 裡面最後加上一個commit;
但是需要注意的是:在test.sql文件裡面每條語句後必須加上「;」,代表一條語句的執行。

熱點內容
cad解壓錯誤 發布:2024-03-29 15:01:45 瀏覽:78
存儲指令集 發布:2024-03-29 14:39:27 瀏覽:649
資料庫表刪除數據 發布:2024-03-29 14:39:26 瀏覽:367
出c語言整除 發布:2024-03-29 14:28:22 瀏覽:572
芬尼壓縮機 發布:2024-03-29 14:24:11 瀏覽:464
電腦數據實時上傳本地伺服器軟體 發布:2024-03-29 14:07:57 瀏覽:920
尋秦記源碼 發布:2024-03-29 13:56:17 瀏覽:496
linux的備份命令 發布:2024-03-29 13:41:22 瀏覽:383
csgo建議什麼配置 發布:2024-03-29 13:31:44 瀏覽:980
電腦ftp服務如何禁用 發布:2024-03-29 13:24:48 瀏覽:332