How to import an oracle dump in an different tablespace ( 如何将一个包含表空间信息的dmp文件导入到另一个表空间)
2015-01-21 19:52
856 查看
Q :
I want to import an oracle dump into a different tablespace.
I have a tablespace A used by User A. I've revoked DBA on this user and given him the grants connect and resource. Then I've dumped everything with the command
exp a/*** owner=a file=oracledump.dmp log=log.log compress=y
Now I want to import the dump into the tablespace B used by User B. So I've given him the grants on connect and resource (no DBA). Then I've executed the following import:
imp b/*** file=oracledump.dmp log=import.log fromuser=a touser=b
The result is a log with lots of errors:
IMP-00017: following statement failed with ORACLE error 20001: "BEGIN DBMS_STATS.SET_TABLE_STATS IMP-00003: ORACLE error 20001 encountered ORA-20001: Invalid or inconsistent input values
After that I've tried the same import command but with the option statistics=none. This resulted in the following errors:
ORA-00959: tablespace 'A_TBLSPACE' does not exist
How should this be done?
Note: a lot of columns are of type CLOB. It looks like the problems have something to do with that.
Note2: The oracle versions are a mixture of 9.2, 10.1 and 10.1 XE. But I don't think it has to do with versions.
Answer:
I want to import an oracle dump into a different tablespace.
I have a tablespace A used by User A. I've revoked DBA on this user and given him the grants connect and resource. Then I've dumped everything with the command
exp a/*** owner=a file=oracledump.dmp log=log.log compress=y
Now I want to import the dump into the tablespace B used by User B. So I've given him the grants on connect and resource (no DBA). Then I've executed the following import:
imp b/*** file=oracledump.dmp log=import.log fromuser=a touser=b
The result is a log with lots of errors:
IMP-00017: following statement failed with ORACLE error 20001: "BEGIN DBMS_STATS.SET_TABLE_STATS IMP-00003: ORACLE error 20001 encountered ORA-20001: Invalid or inconsistent input values
After that I've tried the same import command but with the option statistics=none. This resulted in the following errors:
ORA-00959: tablespace 'A_TBLSPACE' does not exist
How should this be done?
Note: a lot of columns are of type CLOB. It looks like the problems have something to do with that.
Note2: The oracle versions are a mixture of 9.2, 10.1 and 10.1 XE. But I don't think it has to do with versions.
Answer:
down voteaccepted | You've got a couple of issues here. Firstly, the different versions of Oracle you're using is the reason for the table statistics error - I had the same issue when some of our Oracle 10g Databases got upgraded to Release 2, and some were still on Release 1 and I was swapping .DMP files between them. The solution that worked for me was to use the same version of expand imptools to do the exporting and importing on the different Database instances. This was easiest to do by using the same PC (or Oracle Server) to issue all of the exporting and importing commands. Secondly, I suspect you're getting the ORA-00959: tablespace 'A_TBLSPACE' does not existbecause you're trying to import a .DMP file from a full-blown Oracle Database into the 10g Express Edition (XE) Database, which, by default, creates a single, predefined tablespace called USERSfor you. If that's the case, then you'll need to do the following.. With your .DMP file, create a SQL file containing the structure (Tables): imp <xe_username>/<password>@XE file=<filename.dmp> indexfile=index.sql full=y Open the indexfile (index.sql) in a text editor that can do find and replace over an entire file, and issue the following find and replace statements IN ORDER (ignore the single quotes.. '): Find: 'REM<space>' Replace: <nothing> Find: '"<source_tablespace>"' Replace: '"USERS"' Find: '...' Replace: 'REM ...' Find: 'CONNECT' Replace: 'REM CONNECT' Save the indexfile, then run it against your Oracle Express Edition account (I find it's best to create a new, blank XE user account - or drop and recreate if I'm refreshing): sqlplus <xe_username>/<password>@XE @index.sql Finally run the same .DMP file you created the indexfile with against the same account to import the data, stored procedures, views etc: imp <xe_username>/<password>@XE file=<filename.dmp> fromuser=<original_username> touser=<xe_username> ignore=y You may get pages of Oracle errors when trying to create certain objects such as Database Jobs as Oracle will try to use the same Database Identifier, which will most likely fail as you're on a different Database. |
down voteaccepted | You've got a couple of issues here. Firstly, the different versions of Oracle you're using is the reason for the table statistics error - I had the same issue when some of our Oracle 10g Databases got upgraded to Release 2, and some were still on Release 1 and I was swapping .DMP files between them. The solution that worked for me was to use the same version of expand imptools to do the exporting and importing on the different Database instances. This was easiest to do by using the same PC (or Oracle Server) to issue all of the exporting and importing commands. Secondly, I suspect you're getting the ORA-00959: tablespace 'A_TBLSPACE' does not existbecause you're trying to import a .DMP file from a full-blown Oracle Database into the 10g Express Edition (XE) Database, which, by default, creates a single, predefined tablespace called USERSfor you. If that's the case, then you'll need to do the following.. With your .DMP file, create a SQL file containing the structure (Tables): imp <xe_username>/<password>@XE file=<filename.dmp> indexfile=index.sql full=y Open the indexfile (index.sql) in a text editor that can do find and replace over an entire file, and issue the following find and replace statements IN ORDER (ignore the single quotes.. '): Find: 'REM<space>' Replace: <nothing> Find: '"<source_tablespace>"' Replace: '"USERS"' Find: '...' Replace: 'REM ...' Find: 'CONNECT' Replace: 'REM CONNECT' Save the indexfile, then run it against your Oracle Express Edition account (I find it's best to create a new, blank XE user account - or drop and recreate if I'm refreshing): sqlplus <xe_username>/<password>@XE @index.sql Finally run the same .DMP file you created the indexfile with against the same account to import the data, stored procedures, views etc: imp <xe_username>/<password>@XE file=<filename.dmp> fromuser=<original_username> touser=<xe_username> ignore=y You may get pages of Oracle errors when trying to create certain objects such as Database Jobs as Oracle will try to use the same Database Identifier, which will most likely fail as you're on a different Database. 转载自:http://stackoverflow.com/questions/61963/howto-import-an-oracle-dump-in-an-different-tablespace |
相关文章推荐
- 如何将Myeclipse的一个工作空间的配置文件复制到另一个工作空间
- 如何有效合并两个文件:一个是1亿条的用户基本信息,另一个是用户每天看电影连续剧等的记录,5000万条。其中内存只有1G。
- 如何有效合并两个文件:一个是1亿条的用户基本信息,另一个是用户每天看电影连续剧等的记录,5000万条。其中内存只有1G。
- 现有一个用户为a,表空间为b的dmp文件,我想将其导入用户为c,表空间为d的表空间
- 在Linux上,如何知道一个可执行文件是否包含调试信息呢?
- [VB.NET]如何将一个Access文件A的数据到导入另一个Access文件B?
- 在Linux上,如何知道一个可执行文件是否包含调试信息呢?
- ROS知识(16)----如何编译时自动链接同一个工作空间的其他包的头文件(包含message,srv,action自动生成的头文件)
- 如何有效合并两个文件:一个是1亿条的用户基本信息,另一个是用户每天看电影连续剧等的记录,5000万条。其中内存只有1G。
- 如何在Oracle中建表空间、建用户并导入dmp文件详解
- 如何计算 一个音视频文件 (.ts)文件 (包含pcr信息). 播放所使用的带宽
- 如何将一个文件里不包含某个字符的行输出到另一个文件?
- 如何计算 一个音视频文件 (.ts)文件 (包含pcr信息). 播放所使用的带宽
- 如何计算 一个音视频文件 (.ts)文件 (包含pcr信息). 播放所使用的带宽
- 如何将Eclipse的一个工作空间的配置文件复制到另一个工作空间
- 如何将Eclipse的一个工作空间的配置文件复制到另一个工作空间
- 用vim如何将一个文件的内容导入到另一个文件
- 从EXCEL 导入记录后,如何释放?否则另外打开一个EXCEL文件得重启电脑.
- 得到一个wma或mp3文件,如何用最简单的方法得到它的长度信息呢?
- 如何在oracle中导入dmp数据库文件