ORACLE 數據庫備份DUMP文件還原


參考:https://www.php.cn/java/base/461818.html

1、expdp導出的時候,需要創建 DIRECTORY,不同的導出方式,導入的方式不一樣(還有種imp導入)

導出什么表空間,導入也要什么表空間。導出什么用戶,導入也要什么用戶。

cmd->sqlplus—>system/12345

 

 

 

2、如果沒有要新建。

create directory NC65 as 'D:\NC65'

 



從服務器expdp導出了TOOLBOX用戶的數據庫dmp文件,要導入本地開發環境中。

本地oracle環境是全新的(windows環境)。

3、創建表空間

create tablespace NNC_DATA01
datafile 'D:\app\orcl\oradata\NNC_DATA01.dbf' size 500M
autoextend on next 100M maxsize unlimited logging
extent management local autoallocate
segment space management auto;

4、表空間下的文件windows最大單個文件問32G限制,所以文件大小超過時需新增數據文件

alter tablespace NNC_DATA01 add datafile 'D:\app\orcl\oradata\NNC_DATA02.DBF' size 500m autoextend on next 1024m maxsize 30G;

5.刪除表空間

drop tablespace NNC_DATA01 including contents and datafiles;

6、創建用戶,賦予權限’

create user TOOLBOX identified by 123456;

alter user TOOLBOX default tablespace TOOLBOX;

grant CREATE ANY DIRECTORY,create session,create table,create view,unlimited tablespace to TOOLBOX;

7、登錄ToolBox用戶

8、導入

impdp toolbox/123456 DIRECTORY=DMPDIRDUMPFILE=hz_toolbox_20160613.dmp full=y


impdp system/12345@orcl directory=NC65 dumpfile=C##NC65_20210522_221547.DMP logfile=C##NC65_20210522_221547.log table_exists_action=replace

總結:

create directory NC65 as 'D:\NC65'

create tablespace NNC_DATA01
datafile 'D:\app\orcl\oradata\NNC_DATA01.dbf' size 500M
autoextend on next 100M maxsize unlimited logging 
extent management local autoallocate
segment space management auto;

impdp system/12345@orcl directory=NC65 dumpfile=C##NC65_20210522_221547.DMP logfile=C##NC65_20210522_221547.log table_exists_action=replace

創建用戶:不以C##開頭會報錯
create user C##tester 
identified by "12345" 
default tablespace NNC_DATA01
temporary tablespace TEMP;

grant connect, resource to C##tester ; 
grant dba to  C##tester;

 


免責聲明!

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



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