oracle11g expdp/impdp數據庫
阿新 • • 發佈:2017-12-11
xtend body 處理 rtu 表空間 director sys clas dump
oracle11g導入/導出數據庫
導出 1、創建目錄 sqlplus / as sysdba create directory dbDir as ‘d:\oralce_sdic_backup\‘; grant read,write on directory dbDir to sdic; 2、cmd導出 expdp sdic/hymake528sdic schemas=sdic dumpfile=oralce_sdic_backup_%date:~0,4%%date:~5,2%%date:~8,2%.dmp logfile=oralce_sdic_backup_%date:~0,4%%date:~5,2%%date:~8,2%.log directory=dbDir 導入 1、刪除原用戶、表空間 sqlplus / as sysdba; drop user sdic cascade; drop tablespace sdic_tablespace including contents and datafiles; 2、創建用戶、表空間 sqlplus / as sysdba create tablespace sdic_tablespace datafile ‘E:/soft/oracle11g_data/sdic1.dbf‘ size 10g autoextend on next 5m; alter tablespace sdic_tablespace add datafile ‘E:/soft/oracle11g_data/sdic2.dbf‘ size 10g autoextend on next 5m; create user sdic identified by hymake528sdic; grant connect,resource,dba to sdic; alter user sdic defaulttablespace sdic_tablespace; 3、創建目錄 create directory dbDir as ‘E:\soft\oracle11g_bak‘; grant read,write on directory dbDir to sdic; 4、cmd導入
impdp sdic/hymake528sdic DIRECTORY=dbDir DUMPFILE=ORALCE_SDIC_BACKUP_20171207.DMP REMAP_SCHEMA=sdic:sdic REMAP_TABLESPACE=USERS:sdic_tablespace table_exists_action=append full=y logfile=imp20171207.log
說明:
1、導出的dumpfile=oralce_sdic_backup_%date:~0,4%%date:~5,2%%date:~8,2%.dmp logfile=oralce_sdic_backup_%date:~0,4%%date:~5,2%%date:~8,2%.log
%date:~0,4%%date:~5,2%%date:~8,2%這裏是取時間yyyyMMdd的方法。
2、alter tablespace sdic_tablespace add datafile ‘E:/soft/oracle11g_data/sdic2.dbf‘ size 10g autoextend on next 5m;
這是追加了一個數據庫文件,當數據庫大於32g的時候,一個數據庫文件存放不下。
3、刪除用戶失敗處理
////如果出現 ORA-00604: 遞歸 SQL 級別 1 出現錯誤
////或出現ORA-01940:無法刪除當前連接的用戶
////就重啟數據庫再drop
////SQL> shutdown immediate
////SQL> startup
oracle11g expdp/impdp數據庫