Oracle数据库安装在docker容器中
1首先查看容器
docker ps
2进入oracle容器
docker exec -it 7f0f3f2d4f88 /bin/bash
3导出整个库:这个有问题,会吧helowin实例下的所有数据都导出:
DATA_PUMP_DIR为oracle中默认备份文件件
expdp [email protected] dumpfile=aircms.dmp logfile=airscm.log
full=y directory=DATA_PUMP_DIR
如果报错,错误如下
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
解决方法:查文档发现,缺省Directory为DATA_PUMP_DIR
查看DATA_PUMP_DIR的值,
A)进入到sqlplus中查看它的值
sqlplus /nolog
b)切换系统用户
conn sys/ as sysdba;
c)查看默认值
select * from dba_directories where directory_name=‘DATA_PUMP_DIR‘;
得出的值:/home/oracle/app/oracle/admin/orcl/dpdump/
但实际上路径中只有:/home/oracle/app/oracle/admin/helowin/dpdump/
需要创建/home/oracle/app/oracle/admin/orcl/dpdump/目录
4继续导出数据库
expdp [email protected] dumpfile=aircms.dmp logfile=airscm.log full=y directory=DATA_PUMP_DIR
5导出成功
/home/oracle/app/oracle/admin/orcl/dpdump/aircms.dmp
6拷贝到系统路径下
7f0f3f2d4f88:为容器id
docker cp 7f0f3f2d4f88:/home/oracle/app/oracle/admin/orcl/dpdump/aircms.dmp /home/dev/
原文:https://www.cnblogs.com/achengmu/p/11834559.html