1.创建用户
1)进入cmd,输入sqlplus,回车
2)输入用户名:test/test@10.16.*.*: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.*.*:1521/orcl buffer=64000 file=c:\full.dmp full=y
如果要执行完全导出,必须具有特殊的权限
2) 用户模式:
exp test/test@10.16.*.*:1521/orcl buffer=64000 file=c:\full.dmp owner=test
这样用户test的所有对象被输出到文件中。
3) 表模式:
exp test/test@10.16.*.*:1521/orcl buffer=64000 file=c:\full.dmp tables=(tablename1,tablename2)
这样用户test的表tablename1,tablename2就被导出
3.imp导入数据库dmp
1)完全:
imp test/test@10.16.*.*:1521/orcl buffer=64000 file=c:\full.dmp full=y
如果有些表已经存在,会报错,对该表就不进行导入,只需在后面加上 ignore=y 就可以了。
2)用户模式:
imp test/test@10.16.*.*:1521/orcl buffer=64000 file=c:\full.dmp fromuser=test touser=test
这样用户test的所有对象被导入到文件中。必须指定FROMUSER、TOUSER参数,这样才能导入数据。
3)表模式:
imp test/test@10.16.*.*:1521/orcl buffer=64000 file=c:\full.dmp owner=test tables=(tablename1)
这样用户test的表tablename1就被导入。