【数据库】Oracle数据备份恢复
Oracle数据备份恢复
--按用户名导出
expdp scott/tiger@orcl schemas=scott dumpfile=dsta20190114.dmp DIRECTORY=dpdata1;
-以下操作用户名必须一一对应 如果不对应就转换
--转换用户名:remap_schema=drgspre_km(导出):drgsplat_km(导入)
--查看目录
select * from dba_directories;
--查看表空间地址
select *from dba_data_files;
--创建需要的表空间
CREATE TABLESPACE SICP_DATA
LOGGING
DATAFILE 'F:\APP\ASUS\ORADATA\ORCL\SICP_DATA.DBF'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
--查看表空间数据文件
select file_name from dba_data_files where tablespace_name='SICP_DATA';
--清空
drop user dsta cascade;
--表空间下面创建用户
create user dsta identified by dsta ACCOUNT UNLOCK
DEFAULT TABLESPACE SICP_DATA TEMPORARY TABLESPACE TEMP;
--给用户授予操作权限
GRANT CONNECT TO dsta;
GRANT RESOURCE TO dsta;
GRANT CREATE ANY VIEW TO dsta;
GRANT CREATE DATABASE LINK TO dsta;
GRANT CREATE ANY SYNONYM TO dsta;
GRANT DEBUG CONNECT SESSION TO dsta;
GRANT CREATE JOB TO dsta;
GRANT SCHEDULER_ADMIN TO dsta;
GRANT MANAGE SCHEDULER TO dsta;
--创建虚拟目录
create directory DPDATA as 'E:\DATA';
--授予虚拟目录操作权限
grant read,write on directory DPDATA to dsta;
--cmd数据导入
C:\Users\dsta>impdp dsta/dsta@orcl directory=dpdata dumpfile=dsta20190114.dmp