使用imp和exp命令对orcale进行导入和导出

docker 进行orcale 查看这篇文章

https://editor.csdn.net/md/?articleId=131026846

1、进入orcale

1、进入orcale容器
docker exec -it oracle11g bash
2、orcale连接sysdba用户
  1. 进入root
  su root
  密码:helowin
  1. 切换到oracle用户
  su oracle
  1. 进入sqlplus进行操作
  sqlplus /nolog
  1. 导出数据,tables表示test用户下的表,tables去掉表示就是所有表
exp test/test@helowin tables=students file=files.dmp

使用imp和exp命令对orcale进行导入和导出_第1张图片
这图表示导出成功

  1. 导入数据,删除students表,full是必须的,ignore表示已有的表忽略
imp test/test@helowin file=files.dmp full=y ignore=y

使用imp和exp命令对orcale进行导入和导出_第2张图片
说明:数据库可能字符有些不同
查看字符编码

 select * from v$nls_parameters where parameter='NLS_CHARACTERSET'; 

查看dmp有那些表,表示导入成功了

strings files.dmp | grep "CREATE TABLE"|awk '{print $3}'|sed 's/"//g'

如果要保证字符集,可以指定导出的字符集

export NLS_LANG=AL32UTF8

查看环境变量

printenv

你可能感兴趣的:(linux,oracle)