標籤:ar sp for 檔案 資料 on art log ad
>exp -help
>imp -help
資料字典表:dba_data_files:資料檔案表
查看資料檔案名及其所屬資料表空間名:
設定每行顯示長度:set linesize 300;
設定每頁顯示列數:set pagesize 30;
設定資料檔案名顯示長度:col file_name for a50;
設定資料表空間名顯示長度:col tablespace_name for a15;
select file_name,tablespace_name from dba_data_files;
建立資料表空間文法:
create tablespace 資料表空間名
datafile ‘資料檔案地址\資料檔案名.dbf‘
size 10M autoextend on maxsize 10g;
em:create tablespace bangkins
datafile ‘d:\dddd\ddddd.dbf‘
size 10M autoextend on maxsize 10g;
建立使用者:create user bankuser
identidied by tiger
default tablespace bankins;
授權使用者:grant cennect,resource to bankuser;
查看目前使用者下的表:select table_name from user_tables;
exp匯出資料:>exp 使用者名稱/密碼@伺服器名 file=匯出地址 log=匯出記錄檔地址
imp匯入資料:>imp 使用者名稱/密碼@伺服器名 fromuser=匯出資料庫使用者名稱 touser=匯入資料庫使用者名稱 file=匯入Database Backup log=匯出記錄備份
>exp bankuser/[email protected] file=‘d:\ddddd\dddd.dmp‘ log=‘d:\ddddd\eeeee.dmp‘
>imp bankuser/[email protected] fromuser=bankuser touser=bankuser file=‘d:\ddddd\ddddd.dmp‘ file=‘d:\ddddd\eeeee.dmp‘
資料泵:
>expdp -help
>impdp- help
linux下oracle資料庫下建立匯出資料的目錄:SQL>create or replare directory expdp_dir
as ‘/home/oracle/expdp_dir‘;
把建立目錄的讀寫權限賦予給使用者(wcw):
grant read,write on directory expdp_dir to wcw;
linux下建立檔案夾:$mkdir expdp_dir;
linux下刪除剛建立的目錄:$rm -rf expdp_dir;
$chmod 777 expdp_dir
$expdp 使用者名稱/密碼 directory=匯出目錄名 dumpfile=*******.dmp logfile=*******.log
em:$expdp wcw/tiger directory=bank_ins dumpfile=bankeins.dmp logfile=bankins.log
$impdp 使用者名稱/密碼@資料庫執行個體名 directory=匯入資料目錄 dumpfile=******.dmp logfile=****.log
在windows系統下建立匯入目錄:
create or replare directory=impdp_dir as ‘d:\ddddddd‘;
授權匯入目錄給wcw使用者:
grant read,write on dicretory impdp_dir to wcw;
em:$impdp wcw/[email protected] directory=impdo_dir dumplile=bankins.dmp logfile=bankins.log
註:更改ftp參數:#setsebool ftpd_disable_trans 1
重啟ftp服務:#service vsftpd restart;
oracle資料庫匯入匯出