DUMP文件導入導出


一、dump文件的導出(以sqlplus命令行的方式)

--1.以sys或者system用戶身份登錄數據庫.
--2.創建dump文件導出路徑(DUMP_DIR名稱可替換),並在dba_directories中查看.
create directory dump_dir as 'D:/oradata/orcl/dmpfile'; 
select * from dba_directories; 
--3.把導出路徑與導出權限授權給eamprd,如果用system等高級帳號導出,則不用。
grant read,write on directory dump_dir to username; 
grant exp_full_database to eamprd; 
--4.退出sqlplus,在oracle系統用戶下運行,導出對應的SCHEMA,推薦第二種。
expdp username/passpword@ip:port/sid directory=dump_dir dumpfile=filename.dmp 
--導出重點參數:
--版本:高往低需加version=xx.x  導出某些張表tables=xxxx  content=metadata_only(只要結構) content=data_only(只要數據)

二、dump文件的導入(以sqlplus命令行的方式)

--1.以sys或者system身份登陸測試庫.
--2.建立導入表空間和臨時表空間(名稱、路徑、表空間大小,請自行替換).
create tablespace tablespace_01 datafile 'D:/oradata/orcl/tablespace01.dbf' size 1024M autoextend on next 1024M maxsize 2048M;
create temporary tablespace tablespace_temp tempfile 'D:/oradata/orcl/tablespacetemp.dbf' size 512M;
create user username identified by password default tablespace tablespace_01 temporary tablespace tablespace_temp;
grant connect,resource,create view,create session,dba to username;
create directory dump_dir as 'D:/oradata/orcl/dmpfile'; 
grant read,write on directory dump_dir to gctest01;
--退出sqlplus,在oracle系統用戶下運行 
impdp username/password@pord directory=dump_dir dumpfile=filename.dmp logfile=filename.log remap_schema=fromschema:toschema remap_tablespace=fromtablespace:totablespace

三、常用輔助SQL(慎用)

alter user username identified by password;
drop user username cascade;
drop tablespace tablespacename including contents and datafiles;
select * from all_users;
select * from dba_data_files;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM