1. 通过 exp ( expdp )导出 dump 文件 exp test/psw@test10g file=c:\test\test.dmp log=c:\test\test.log (路径名最好不要有空) 2. 新建表空间(最好去原数据库查一下表空间名字) select tablespace_name,sum(bytes/1024/1024) from dba_segments wher
1. 通过exp(expdp)导出dump文件
exp test/psw@test10g file=c:\test\test.dmp
log=c:\test\test.log(路径名最好不要有空格)
2. 新建表空间(最好去原数据库查一下表空间名字)
select tablespace_name,sum(bytes/1024/1024) from dba_segments where owner='test' group by tablespace_name;
create tablespace test
datafile 'c:\oracle\product\10.2.0\oradata\temp\test.dbf'
size 1000m;
create tablespace ttest_data
datafile 'c:\oracle\product\10.2.0\oradata\temp\test_data.dbf'
size 500m;
表空间的大小最好比原数据库的表空间大一点,新建的表空间的目录最好参照当前数据库已存在的表空间的目录,这样几种放置,便于管理。
3. 新建用户
如果原数据库存在多个表空间,最好查询一下原数据库中用户的默认表空间
select * from dba_users/user_user where username='test';
create user test identified by psw
default tablespace test;
4. 给新建的用户赋权限
最好先查询一下原数据库中用的权限
select * from user_role_privs;
一般情况下,赋下面两个角色的权限
grant connect to test;
grant resource to test;
5. 用imp(impdp)导入数据库
imp test/pswfile=c:\test\test.dmp log=c:\test\test_imp.log ignore =y