用imp导入数据时,指定表空间是比较麻烦的,我遇到的情况是数据库USERS表空间所在文件系统的容量无法
满足导入的数据量,这种情况下需要做如下处理,其原理是将用户对数据库自带的USERS表空间访问限制为0,这时再次imp导入数据时,就可以使用给该用户设定的默认表空间来存储数据了。
创建tablespace用以存放A系统导过来的数据
create tablespace data1
datafile '/oradata/orcl/data1_01.dbf' size 30720M
extent management local
segment space management auto;
创建oracle用户orcl所有A系统的表都存放在这个用户下
create user orcl identified by orcl
default tablespace data1
temporary tablespace temp;
给oracle用户赋权
grant connect,resource to orcl;
grant dba to orcl;
revoke unlimited tablespace from orcl;
alter user orcl quota 0 on users;
alter user orcl quota unlimited on data1; //这里这么做的原因,是为了后面imp导入数据时重定向表空间,让数据存放到我们定义好的表空间data1里面。
创建tablespace用以存放自己新建的表
create tablespace data2
datafile '/oradata/orcl/data1_02.dbf' size 20480M
extent management local
segment space management auto;
创建oracle用户,所有自定义的表都放在这个用户下面
create user frm identified by frm
default tablespace data2
temporary tablespace temp;
给oracle用户赋权
grant connect,resource to frm;
grant dba to frm;
更改表空间使用权限
alter user orcl quota unlimited on data2;
A系统源数据文件的路径为
/oradata/source/orcl.dmp
开始导入源数据
imp \"orcl/orcl as sysdba\" file="/oradata/source/orcl.dmp" fromuser=orcl touser=orcl grants=n
导入结束后,有一些报错,如下:
IMP-00017: following statement failed with ORACLE error 1536:
"CREATE TABLE "R_FIELD_INFO" ("TABLENAME" VARCHAR2(20) NOT NULL ENABLE, "FIE"
"LDNAME" VARCHAR2(20) NOT NULL ENABLE, "TITLE" VARCHAR2(40) NOT NULL ENABLE,"
" "TYPE" VARCHAR2(20) NOT NULL ENABLE, "FIELDSIZE" NUMBER(*,0) NOT NULL ENAB"
"LE, "FIELDPROPERTY" CLOB, "STATUS" CHAR(1) NOT NULL ENABLE) PCTFREE 10 PCT"
"USED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST "
"GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS LOB ("F"
"IELDPROPERTY") STORE AS (TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 81"
"92 PCTVERSION 10 NOCACHE LOGGING STORAGE(INITIAL 65536 FREELISTS 1 FREELIS"
"T GROUPS 1 BUFFER_POOL DEFAULT))"
IMP-00003: ORACLE error 1536 encountered
ORA-01536: space quota exceeded for tablespace 'USERS'
针对这些报错的表,单独做如下处理以导入数据
alter user orcl quota unlimited on users;
imp \"orcl/orcl as sysdba\" file="/oradata/source/orcl.dmp" fromuser=orcl touser=orcl tables=(R_FIELD_INFO,R_FUNCTION_INFO,R_KEY_INFO,R_SHEET_ITEM,R_SHEET_ITEM_BAK,R_SHEET_ITEM_BAK2,R_SHEET_LINK,R_SHEET_MODEL,R_TABLE_INFO,R_TREE_INFO) grants=n
阅读(5591) | 评论(0) | 转发(0) |