oracle11g expdp/impdp数据库
时间:2021-07-01 10:21:17
帮助过:16人阅读
导出数据库
导出
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
default tablespace 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数据库
标签:default grant sts 级别 extend 数据 datafile ack end