|
oracle下導(dǎo)出某用戶所有表的方法 scott/tiger是用戶名和密碼,handson是導(dǎo)出的實(shí)例名 ² 按用戶方式導(dǎo)出數(shù)據(jù)(owner當(dāng)中寫的是用戶名) exp scott/tiger@handson file=scott_back owner=scott ² 按表方式導(dǎo)出數(shù)據(jù)(talbes當(dāng)中寫的是全部表的名稱) exp scott/tiger@handson tables=(emp, dept) file=scott_back_tab ² 按表空間方式導(dǎo)出數(shù)據(jù)(tablespaces當(dāng)中寫的是表空間名稱) exp system/handson@handson tablespaces=(users) file=tbs_users ² 使用參數(shù)文件導(dǎo)出數(shù)據(jù) exp system/handson parfile='C:\parameters.txt 1、cmd->exp->username/passwd@sid-->.....一路回車--->輸入導(dǎo)出庫得名字 就把所有的表、視圖、存儲過程、函數(shù)、作業(yè)等亂七八糟的都導(dǎo)出來了; 導(dǎo)出表: exp scott/tiger@mycon tables=(dept,emp) file=tab1.dmp 導(dǎo)出用戶: exp system/manager@mycon owner=scott file=usr1.dmp 導(dǎo)出數(shù)據(jù)庫: 1.完全導(dǎo)出 exp system/manager@mycon full=y inctype=complete file=full1.dmp 2.增量導(dǎo)出 exp system/manager@mycon full=y inctype=incremental file=inc1.dmp 3.累積導(dǎo)出 exp system/manager@mycon full=y inctype=cumulative file=cum1.dmp 導(dǎo)入表: imp system/manager@mycon file=c:\tab1.dmp tables=(dept,emp) touser=scott 導(dǎo)入用戶: imp system/manager@mycon file=usr1.dmp fromuser=scott touser=scott 導(dǎo)入數(shù)據(jù)庫: 1.全庫導(dǎo)入 imp system/manager@mycon file=full1.dmp full=y 2.增量導(dǎo)入 1)導(dǎo)入數(shù)據(jù)庫最新信息 imp system/manager@mycon inctype=system full=y file=inc7.dmp 2)導(dǎo)入最近完全導(dǎo)出文件 imp system/manager@mycon inctype=restore full=y file=full1.dmp 3)導(dǎo)入所有累積導(dǎo)出文件 imp system/manager@mycon inctype=restore full=y file=cum1.dmp 4)導(dǎo)入最近一次增量導(dǎo)出的文件 imp system/manager@mycon inctype=restore full=y file=inc1.dmp 常用的命令 Exp user/password@instance file=file.dmp rows=y log=log_name 其中username/password為導(dǎo)出用戶的用戶名和密碼 Instance為導(dǎo)出的實(shí)例名 Rows是指定是否要導(dǎo)入表中的行 導(dǎo)出一個用戶下的表結(jié)構(gòu)為sql文件: 使用命令好像導(dǎo)出的都是dmp文件 可以使用plsql軟件在tools--àexport user object 如果不要到處table space ,不要勾include storage 選擇導(dǎo)出的路徑文件名,export可以直接導(dǎo)出了 例子1:(本方法限oracle9i版本以上) set pagesize 0
首先在sqlplus下以該用戶登錄到oracle數(shù)據(jù)庫,然后將以下內(nèi)容粘貼到sqlplus中: set feedback off; set pagesize 0; set heading off; set verify off; set linesize 200; set trimspool on; spool c:\數(shù)據(jù)庫備份.bat; select 'exp username/ffffff@yourdb TABLES='||table_name||' FILE='||table_name||'.dmp TRIGGERS=N' from user_tables; spool off; set feedback on; set pagesize 9999; set heading on; set verify on; exit 完成后在找到 c:\數(shù)據(jù)庫備份.bat 文件,編輯該批處理文件,將第一行和最后一行刪掉,保存后運(yùn)行該批處理文件就可全部導(dǎo)出該用戶下的所有表。 oracle下導(dǎo)入某用戶所有表的方法 ² 將整個文件導(dǎo)入數(shù)據(jù)庫 imp system/handson@handosn file=item_back.dmp ignore=y full=y ² 將scott用戶的表導(dǎo)入到martin用戶 imp system/handson@handosn file=scott_back fromuser=scott touser=martin tables=(emp,dept) ² 使用參數(shù)文件導(dǎo)入數(shù)據(jù) imp system/oracle parfile='C:\parameters.txt 常用命令 Imp username/password file=file.dmp fromuser=user1 touser=user2 rows=y 其中username/password為導(dǎo)入到數(shù)據(jù)庫的用戶名和密碼 Fromuser為備份數(shù)據(jù)庫時的用戶 Touser為導(dǎo)入數(shù)據(jù)庫的用戶,一般和username同 |
|
|