几点注意:
oracle11g的exp不会导出空表,所以用expdp最好
报错要第一时间看,导入要注意tablespace和user的建立
user:
create user OADEMO
profile default
identified by OADEMO
default tablespace OADATA
temporary tablespace temp
quota unlimited on OADATA
account unlock;
grant unlimited tablespace to OADEMO;
grant connect to OADEMO;
grant dba to OADEMO;
grant resource to OADEMO
Create tablespace USERS
logging
datafile 'd:\USERS.dbf' size 100m
autoextend on next 100m maxsize 1000m
extent management local AUTOALLOCATE;
SELECT * FROM DBA_TABLES WHERE TABLESPACE_NAME LIKE 'OA%'
selet
-------------------------导数据权限--------------------------------------------------------
只有拥有IMP_FULL_DATABASE和DBA权限的用户才能做整个数据库导入
imp步骤:
(1) create table (2) insert data (3) create index (4) create triggers,constraints
-------------------------导出数据--------------------------------------------------------
导出数据:
exp userid=testu/testu owner=OADEMO INDEXES=y grants=y rows=y constraints=y compress=N file=ORACLEDATA.DMP
-------------------------导入数据--------------------------------------------------------
导入数据:
a.需要确认原来数据库表空间大小 b.确认原来数据库大字段用的表空间 c.确定索引所在的表空间
1.
创建一般表空间(表空间的大小应该根据原来表空间大小确定)
Create tablespace ERPDATA
logging
datafile 'd:\ERPDATAINFO2.dbf' size 100m
autoextend on next 100m maxsize 1000m
extent management local AUTOALLOCATE;
创建大字段表空间
以下这个表空间数据块为16K,因此要确认原数据库有没有16或32的表空间,如果有,那么要先建表空间,并现在建立表空间名字与原来表空间名字必须一样
alter system set db_16k_cache_size=100m scope=both;
CREATE SMALLFILE
TABLESPACE "BLOBDATA"
LOGGING
DATAFILE
'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\BLOBDATE3.ora' SIZE 5M
REUSE BLOCKSIZE 16384 EXTENT MANAGEMENT LOCAL SEGMENT SPACE
MANAGEMENT AUTO
创建索引表空间(表空间的大小应该根据原来表空间大小确定)
注意:如果不单独创建索引表空间,那么索引会默认到当前用户下的表空间。
Create tablespace IDNEXERPDATA
logging
datafile 'd:\ERPDATAINFINDX.dbf' size 100m
autoextend on next 100m maxsize 1000m
extent management local AUTOALLOCATE;
2.create user scuser
profile default
identified by scuser
default tablespace ERPDATA
temporary tablespace temp
quota unlimited on ERPDATA
account unlock;
grant unlimited tablespace to scuser;
grant connect to scuser;
3.imp testu/testu file =ORACLEDATA.DMP show=n buffer=2048000 ignore=y commit=y grants=y full=y log=imp_data.log
create directory expdp_dir as 'D:\dp';
grant read,write on directory expdp_dir to testu;
expdp testu/testu DIRECTORY=expdp_dir DUMPFILE=oa.dmp SCHEMAS=OADEMO logfile=DRGN_OWNERexpdp.log
create directory impdp_dir as ''D:\dp';
grant read,write on directory impdp_dir to testu;
impdp testu/testu DIRECTORY=impdp_dir DUMPFILE=oa.dmp logfile=oa.log
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21302630/viewspace-1571835/ ,如需转载,请注明出处,否则将追究法律责任。