Oracle数据库恢复详解

140 阅读1分钟

需要创建pdb 并切换到pdb

1.创建表空间

create tablespace sde datafile 'D:\app\admin\product\11.2.0\dbhome_1\database\sde.dbf' size 500M AUTOextend ON NEXT 500M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

create tablespace sde datafile 'D:\app\fanyoucai\product\12.2.0\dbhome_1\database\0617\sde.dbf' size 500M AUTOextend ON NEXT 500M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

2.查看表空间

select name from v$datafile;

3.创建用户

create user sde identified by sde default tablespace sde;

4.给用户授权

grant connect,resource,dba to sde;

grant create session to sde;

grant exp_full_database to sde;

grant imp_full_database to sde;

grant create any table to sde;

grant create any view to sde;

5.利用arccatalog连接到oracle数据库

6.登陆数据库

sqlplus / as sysdba

#创建目录

create directory back as 'd:\data';

#授权用户读写目录

grant read,write on directory back to sde;

#查看用户创建的目录

select * from dba_directories;

exit

7.cmd窗口下导入备份数据

`impdp sde/sde@orcl table_exists_action = replace directory=back dumpfile=sde.dmp logfile=sde.log

C:\Users\Administrator>impdp sde/Finest133@dgdm table_exists_action = replace directory=back dumpfile=dgdm20220527.dmp logfile=dgdm.log full=y

impdp sde/sde@FANYOUCAIDB table_exists_action = replace directory=back dumpfile=dgdm20220616.dmp logfile=dgdm.log full=y`