Home > Database > Mysql Tutorial > body text

Copy数据库(Oracle)的步骤

WBOY
Release: 2016-06-07 15:25:40
Original
1535 people have browsed it

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.            通过Expexpdp)导出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.            impimpdp)导入数据库

imp test/pswfile=c:\test\test.dmp log=c:\test\test_imp.log ignore =y

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template