您的位置:首页 > 数据库 > Oracle

oracle数据库cmd操作创建用户、导入导出

2017-10-11 21:14 387 查看

1.创建用户

1)进入cmd,输入sqlplus,回车

2)输入用户名:test/test@10.16.1.6:1521/orcl as sysdba,回车

3)创建用户:create user testName identified by testPassword;   //创建testName用户,密码为testPassword

4)  授权限:grant dba totestName;    //把dba的权限赋给testName这个用户

2.exp导出数据库为dmp

1) 完全模式:   exp test/test@10.16.1.6:1521/orcl buffer=64000 file=c:\full.dmp full=y   如果要执行完全导出,必须具有特殊的权限 
2) 用户模式: 
exp test/test@10.16.1.6:1521/orcl buffer=64000 file=c:\full.dmp  owner=test
  这样用户test的所有对象被输出到文件中。 
3) 表模式:
exp test/test@10.16.1.6:1521/orcl buffer=64000 file=c:\full.dmp  tables=(tablename1,tablename2)
  这样用户test的表tablename1,tablename2就被导出 

3.imp导入数据库dmp

1)完全: 
imp test/test@10.16.1.6:1521/orcl buffer=64000 file=c:\full.dmp full=y
   如果有些表已经存在,会报错,对该表就不进行导入,只需在后面加上 ignore=y 就可以了。
2)用户模式: 
imp test/test@10.16.1.6:1521/orcl buffer=64000 file=c:\full.dmp fromuser=test touser=test    这样用户test的所有对象被导入到文件中。必须指定FROMUSER、TOUSER参数,这样才能导入数据。 
3)表模式: 
imp test/test@10.16.1.6:1521/orcl buffer=64000 file=c:\full.dmp  owner=test tables=(tablename1)
  这样用户test的表tablename1就被导入。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  cmd 数据库 oracle
相关文章推荐