imp导入时候经常遇到一些问题
1,字符集问题
如果原库字符集是GBK,目标字符集是UTF-8,则原库中文是占用2个字符,目标库是3个字符,有些列
会发生长度不够问题
2,外键依赖
有问题1引起或者别的问题,比如导入次序问题
解决:
a,导入元数据
导入选项加入CONTENT=METADATA_ONLY
b,禁用外键&修改某些列长度
约束:
SELECT 'ALTER TABLE ' || TABLE_NAME || ' DISABLE CONSTRAINT ' || constraint_name || ';'
FROM user_constraints
WHERE CONSTRAINT_TYPE = 'R';
修改列长度,这个要查询那些列需要扩充
3,导入数据
导入选项CONTENT=DATA_ONLY
4,启用约束
SELECT 'ALTER TABLE ' || TABLE_NAME || ' ENABLE CONSTRAINT ' || constraint_name || ';'
FROM user_constraints
WHERE CONSTRAINT_TYPE = 'R';
3,oid已经存在问题
ORA-39083: Object type TYPE failed to create with error:
ORA-02304: invalid object identifier literal
mpdp导入对象时候失败,说明目标库中已经存在一个oid为XXX的对象,参看impdp的帮助:
TRANSFORM
Metadata transform to apply to applicable objects.
Valid transform keywords: SEGMENT_ATTRIBUTES, STORAGE OID, and PCTSPACE.
OID - If the value is specified as n, the assignment of the exported OID during the
creation of object tables and types is inhibited. Instead, a new OID is assigned.
This can be useful for cloning schemas, but does not affect referenced objects. The
default value is y.
导入时候设置transform=oid:n即可,oid在克隆schema时候使用
1,字符集问题
如果原库字符集是GBK,目标字符集是UTF-8,则原库中文是占用2个字符,目标库是3个字符,有些列
会发生长度不够问题
2,外键依赖
有问题1引起或者别的问题,比如导入次序问题
解决:
a,导入元数据
导入选项加入CONTENT=METADATA_ONLY
b,禁用外键&修改某些列长度
约束:
SELECT 'ALTER TABLE ' || TABLE_NAME || ' DISABLE CONSTRAINT ' || constraint_name || ';'
FROM user_constraints
WHERE CONSTRAINT_TYPE = 'R';
修改列长度,这个要查询那些列需要扩充
3,导入数据
导入选项CONTENT=DATA_ONLY
4,启用约束
SELECT 'ALTER TABLE ' || TABLE_NAME || ' ENABLE CONSTRAINT ' || constraint_name || ';'
FROM user_constraints
WHERE CONSTRAINT_TYPE = 'R';
3,oid已经存在问题
ORA-39083: Object type TYPE failed to create with error:
ORA-02304: invalid object identifier literal
mpdp导入对象时候失败,说明目标库中已经存在一个oid为XXX的对象,参看impdp的帮助:
TRANSFORM
Metadata transform to apply to applicable objects.
Valid transform keywords: SEGMENT_ATTRIBUTES, STORAGE OID, and PCTSPACE.
OID - If the value is specified as n, the assignment of the exported OID during the
creation of object tables and types is inhibited. Instead, a new OID is assigned.
This can be useful for cloning schemas, but does not affect referenced objects. The
default value is y.
导入时候设置transform=oid:n即可,oid在克隆schema时候使用