Oracle数据库安装在docker容器中
1首先查看容器
![](https://i-blog.csdnimg.cn/blog_migrate/25c44ea9dd59eb3fe8d0a03d7ab689ff.png)
2进入oracle容器
1 | docker exec -it 7f0f3f2d4f88 /bin/bash |
3导出整个库:这个有问题,会吧helowin实例下的所有数据都导出:
DATA_PUMP_DIR为oracle中默认备份文件件
1 2 | expdp SDWEB/SDWEB@helowin dumpfile=aircms.dmp logfile=airscm.log full=y directory=DATA_PUMP_DIR |
如果报错,错误如下
1 2 3 4 5 6 7 8 9 | 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中查看它的值
b)切换系统用户
c)查看默认值
1 | 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继续导出数据库
1 | expdp SDWEB/SDWEB@helowin dumpfile=aircms.dmp logfile=airscm.log full=y directory=DATA_PUMP_DIR |
5导出成功
/home/oracle/app/oracle/admin/orcl/dpdump/aircms.dmp
6拷贝到系统路径下
1 | docker cp 7f0f3f2d4f88:/home/oracle/app/oracle/admin/orcl/dpdump/aircms.dmp /home/dev/ |