11g降到10g方法

2023-11-16

  Oracle11g数据库导入Oracle10g数据库 EXPDP方法

EXPDP要注意的是,导出的文件是在服务器端的 DATA_PUMP_DIR目录里

11g备份,导入10g的时候会抛错,直接阻止导入。

一、在11g服务器上,使用expdp命令备份数据

EXPDP USERID='SYS/cuc2009@cuc as sysdba' schemas=sybj directory=DATA_PUMP_DIR dumpfile=aa.dmp logfile=aa.log version=10.2.0.1.0

其中,红色文字部分是根据需要改写的地方。例如我的sys密码是cuc2009,数据库sidcuc,要到出的用户名是sybj,要导入到10.2.0.1.0版本的Oracle数据库中去。aa.dmpaa.log将会在11gdpdump目录中生成,例如我的11g装在了E盘下面,于是aa.dmp将会在E:\app\Administrator\admin\cuc\dpdump目录下被生成。

二、在10g服务器上,使用impdp命令恢复数据

准备工作:1.建库2.建表空间3.建用户并授权4.aa.dmp拷贝到10gdpdump目录下

1-3点可以去参考博主的上一篇博客“Oracle数据库移植全步骤”,介绍的很详细,这里不再多说。关于第4点, 10g装在了e:\tools目录下,于是我将aa.dmp文件拷贝到了E:\tools\admin\cucf\dpdump目录下。

IMPDP USERID='SYS/cuc2009@cucf as sysdba' schemas=sybj directory=DATA_PUMP_DIR dumpfile=aa.dmp logfile=aa.log version=10.2.0.1.0

其中红色部分是根据需要改写的地方。例如我的sys密码是cuc2009,数据库sidcucf,要导入用户名为sybj,要导入到10.2.0.1.0版本的Oracle数据库中去。aa.log将会在10gdpdump目录中生成。


oracle导入与导出

导入与导出

1. 测试库与测试用户

2. expdp 命令帮助

3. 确认备份导出文件的位置

4. 导出用户数据

5. 导入用户的数据

6. 导入时已存在的表默认将不被重新覆盖

7. 将由用户testuser1导出的数据导入到testuser2

8. 导出特定表并进行导入

1. 测试库与测试用户

SQL> create tablespace yzhqts datafile '/u02/oradata/testdb/yzhqts01.dbf' size 500m;

Tablespace created.

SQL> create user testuser1 identified by sun2moon default tablespace yzhqts;

User created.

SQL> grant connect,resource to testuser1;

Grant succeeded.

SQL> 

然后建立测试数据

2. expdp 命令帮助

 [oracle@web151 ~]$ impdp -help

[oracle@Manager ~]$ expdp -help

 [oracle@web151 ~]$ impdp -help

Import: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 13:25:46

Copyright (c) 2003, 2007, Oracle. All rights reserved.

The Data Pump Import utility provides a mechanism for transferring data objects

between Oracle databases. The utility is invoked with the following command:

     Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp

You can control how Import runs by entering the 'impdp' command followed

by various parameters. To specify parameters, you use keywords:

     Format: impdp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)

     Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp

USERID must be the first parameter on the command line.

 [oracle@Manager ~]$ expdp -help

Export: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 11:26:33

Copyright (c) 2003, 2007, Oracle. All rights reserved.

The Data Pump export utility provides a mechanism for transferring data objects

between Oracle databases. The utility is invoked with the following command:

   Example: expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp


You can control how Export runs by entering the 'expdp' command followed

by various parameters. To specify parameters, you use keywords:


   Format: expdp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)

   Example: expdp scott/tiger DUMPFILE=scott.dmp DIRECTORY=dmpdir SCHEMAS=scott

               or TABLES=(T1:P1,T1:P2), if T1 is partitioned table


USERID must be the first parameter on the command line.


Keyword               Description (Default)

------------------------------------------------------------------------------

ATTACH                Attach to existing job, e.g. ATTACH [=job name].

COMPRESSION           Reduce size of dumpfile contents where valid

                      keyword values are: (METADATA_ONLY) and NONE.

CONTENT               Specifies data to unload where the valid keywords are:

                      (ALL), DATA_ONLY, and METADATA_ONLY.

DIRECTORY             Directory object to be used for dumpfiles and logfiles.

DUMPFILE              List of destination dump files (expdat.dmp),

                      e.g. DUMPFILE=scott1.dmp, scott2.dmp, dmpdir:scott3.dmp.

ENCRYPTION_PASSWORD   Password key for creating encrypted column data.

ESTIMATE              Calculate job estimates where the valid keywords are:

                      (BLOCKS) and STATISTICS.

ESTIMATE_ONLY         Calculate job estimates without performing the export.

EXCLUDE               Exclude specific object types, e.g. EXCLUDE=TABLE:EMP.

FILESIZE              Specify the size of each dumpfile in units of bytes.

FLASHBACK_SCN         SCN used to set session snapshot back to.

FLASHBACK_TIME        Time used to get the SCN closest to the specified time.

FULL                  Export entire database (N).

HELP                  Display Help messages (N).

INCLUDE               Include specific object types, e.g. INCLUDE=TABLE_DATA.

JOB_NAME              Name of export job to create.

LOGFILE               Log file name (export.log).

NETWORK_LINK          Name of remote database link to the source system.

NOLOGFILE             Do not write logfile (N).

PARALLEL              Change the number of active workers for current job.

PARFILE               Specify parameter file.

QUERY                 Predicate clause used to export a subset of a table.

SAMPLE                Percentage of data to be exported; 

SCHEMAS               List of schemas to export (login schema).

STATUS                Frequency (secs) job status is to be monitored where

                      the default (0) will show new status when available.

TABLES                Identifies a list of tables to export - one schema only.

TABLESPACES           Identifies a list of tablespaces to export.

TRANSPORT_FULL_CHECK Verify storage segments of all tables (N).

TRANSPORT_TABLESPACES List of tablespaces from which metadata will be unloaded.

VERSION               Version of objects to export where valid keywords are:

                      (COMPATIBLE), LATEST, or any valid database version.


The following commands are valid while in interactive mode.

Note: abbreviations are allowed


Command               Description

------------------------------------------------------------------------------

ADD_FILE              Add dumpfile to dumpfile set.

CONTINUE_CLIENT       Return to logging mode. Job will be re-started if idle.

EXIT_CLIENT           Quit client session and leave job running.

FILESIZE              Default filesize (bytes) for subsequent ADD_FILE commands.

HELP                  Summarize interactive commands.

KILL_JOB              Detach and delete job.

PARALLEL              Change the number of active workers for current job.

                      PARALLEL=<number of workers>.

START_JOB             Start/resume current job.

STATUS                Frequency (secs) job status is to be monitored where

                      the default (0) will show new status when available.

                      STATUS[=interval]

STOP_JOB              Orderly shutdown of job execution and exits the client.

                      STOP_JOB=IMMEDIATE performs an immediate shutdown of the

                      Data Pump job.


[oracle@Manager ~]$ 

3. 确认备份导出文件的位置

========================


SQL> set linesize 180

SQL> col directory_path format a60 

SQL> select * from dba_directories


OWNER                          DIRECTORY_NAME                 DIRECTORY_PATH

------------------------------ ------------------------------ ------------------------------------------------------------

SYS                            WORK_DIR                       /ade/aime_stamc10/oracle/work

SYS                            ADMIN_DIR                      /ade/aime_stamc10/oracle/md/admin

SYS                            ORACLE_OCM_CONFIG_DIR          /u01/app/oracle/oracle/product/10.2.0/db_1/ccr/state

SYS                            DATA_PUMP_DIR                  /u01/app/oracle/oracle/product/10.2.0/db_1/rdbms/log/


SQL> 

SQL> select directory_path from dba_directories where directory_name='DATA_PUMP_DIR';


DIRECTORY_PATH

--------------------------------------------------------------------------------

/u01/app/oracle/oracle/product/10.2.0/db_1/rdbms/log/


SQL>    



4. 导出用户数据

expdp testuser1/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1.dmp

[oracle@Manager ~]$ expdp testuser1/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1.dmp

Export: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 11:52:49

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39002: invalid operation

ORA-39070: Unable to open the log file.

ORA-39087: directory name DATA_PUMP_DIR is invalid

[oracle@Manager ~]$ 

注意:普通用户需要授权才能使用DATA_PUMP_DIR, 以下是操作过程。


SQL> grant read,write on directory DATA_PUMP_DIR to testuser1;


Grant succeeded.


SQL> 



[oracle@Manager ~]$ expdp testuser1/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1.dmp


Export: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 11:54:10


Copyright (c) 2003, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting "TESTUSER1"."SYS_EXPORT_SCHEMA_01": testuser1/******** DIRECTORY=data_pump_dir DUMPFILE=testuser1.dmp 

Estimate in progress using BLOCKS method...

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 128 KB

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type SCHEMA_EXPORT/TABLE/COMMENT

. . exported "TESTUSER1"."T1"                            4.968 KB       2 rows

. . exported "TESTUSER1"."T2"                            17.35 KB     128 rows

Master table "TESTUSER1"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded

******************************************************************************

Dump file set for TESTUSER1.SYS_EXPORT_SCHEMA_01 is:

/u01/app/oracle/oracle/product/10.2.0/db_1/rdbms/log/testuser1.dmp

Job "TESTUSER1"."SYS_EXPORT_SCHEMA_01" successfully completed at 11:54:41


[oracle@Manager ~]$ 




日志 export.log 会存放在 /u01/app/oracle/oracle/product/10.2.0/db_1/rdbms/log/



5. 导入用户的数据

=================



在另一台服务器上:


impdp testuser1/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1.dmp



注意:建立相应的表空间、用户及相应的权限,并把testuser1.dmp放入指定的目录

(/u01/app/oracle/oracle/product/10.2.0/db_1/rdbms/log/)



建立用户:

create tablespace yzhqts datafile '/u02/oradata/zytest/yzhqts01.dbf' size 500m;

create user testuser1 identified by sun2moon default tablespace yzhqts;

grant connect,resource to testuser1;

grant read,write on directory DATA_PUMP_DIR to testuser1;




导入数据:


[oracle@web151 ~]$ impdp testuser1/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1.dmp


Import: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 13:49:40


Copyright (c) 2003, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table "TESTUSER1"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "TESTUSER1"."SYS_IMPORT_FULL_01": testuser1/******** DIRECTORY=data_pump_dir DUMPFILE=testuser1.dmp 

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "TESTUSER1"."T1"                            4.968 KB       2 rows

. . imported "TESTUSER1"."T2"                            17.35 KB     128 rows

Job "TESTUSER1"."SYS_IMPORT_FULL_01" successfully completed at 13:49:43


[oracle@web151 ~]$ 




SQL> set linesize 180

SQL> col segment_name format a10

SQL> select owner, segment_name ,segment_type, tablespace_name from dba_segments where owner='TESTUSER1' order by TABLESPACE_NAME;


OWNER                          SEGMENT_NA SEGMENT_TYPE       TABLESPACE_NAME

------------------------------ ---------- ------------------ ------------------------------

TESTUSER1                      T1         TABLE              YZHQTS

TESTUSER1                      T2         TABLE              YZHQTS


SQL> 




可以看到数据按照要求已经全部跑到yzhqts表空里了。



6. 导入时已存在的表默认将不被重新覆盖

===================================


例如


[oracle@web151 log]$ impdp testuser1/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1-01.dmp


Import: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 14:44:21


Copyright (c) 2003, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table "TESTUSER1"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "TESTUSER1"."SYS_IMPORT_FULL_01": testuser1/******** DIRECTORY=data_pump_dir DUMPFILE=testuser1-01.dmp 

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/TABLE/TABLE

ORA-39151: Table "TESTUSER1"."T1" exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table "TESTUSER1"."T2" exists. All dependent metadata and data will be skipped due to table_exists_action of skip

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "TESTUSER1"."T3"                            4.937 KB       1 rows

Job "TESTUSER1"."SYS_IMPORT_FULL_01" completed with 2 error(s) at 14:44:23

[oracle@web151 log]$ 


7. 将由用户testuser1导出的数据导入到testuser2

知识点:


remap_schema=源用户:目标用户



Using this command you can import data from one schema to other schema

Even if the schema or username is not present it gets created.


Following is the syntax of creating Remap_Schema


impdp scott/tiger@oracle directory=testdir dumpfile=bij.dmp remap_schema=scott:testscott 

例子1


$ impdp testuser1/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1-01.dmp remap_schema=testuser1:testuser2




1)先创建用户testuser2


create user testuser2 identified by sun2moon default tablespace yzhqts;

grant connect,resource to testuser2;

 (2) 给用户testuser1 授导入权限


SQL> grant imp_full_database to testuser1;


Grant succeeded.




目标数据库上执行上面这条授权命令,否则会报如下错误:



Import: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 16:12:58


Copyright (c) 2003, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-31631: privileges are required

ORA-39122: Unprivileged users may not perform REMAP_SCHEMA remappings.

 [oracle@web151 ~]$ impdp testuser1/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1-01.dmp remap_schema=testuser1:testuser2


Import: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 16:19:12


Copyright (c) 2003, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table "TESTUSER1"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "TESTUSER1"."SYS_IMPORT_FULL_01": testuser1/******** DIRECTORY=data_pump_dir DUMPFILE=testuser1-01.dmp remap_schema=testuser1:testuser2 

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "TESTUSER2"."T1"                            4.976 KB       3 rows

. . imported "TESTUSER2"."T2"                            17.35 KB     128 rows

. . imported "TESTUSER2"."T3"                            4.937 KB       1 rows

Job "TESTUSER1"."SYS_IMPORT_FULL_01" successfully completed at 16:19:13


[oracle@web151 ~]$ 



例子2



也可以直接使用 testuser2用户进行导入,此时就没有必要建立testuser1用户了。



create user testuser2 identified by sun2moon default tablespace yzhqts;

grant connect,resource to testuser2;

grant read,write on directory DATA_PUMP_DIR to testuser2;

grant imp_full_database to testuser2;



impdp testuser2/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1-01.dmp remap_schema=testuser1:testuser2



[oracle@web151 ~]$ impdp testuser2/sun2moon DIRECTORY=data_pump_dir DUMPFILE=testuser1-01.dmp remap_schema=testuser1:testuser2


Import: Release 10.2.0.4.0 - Production on Wednesday, 03 June, 2009 16:40:31


Copyright (c) 2003, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table "TESTUSER2"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "TESTUSER2"."SYS_IMPORT_FULL_01": testuser2/******** DIRECTORY=data_pump_dir DUMPFILE=testuser1-01.dmp remap_schema=testuser1:testuser2 

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "TESTUSER2"."T1"                            4.976 KB       3 rows

. . imported "TESTUSER2"."T2"                            17.35 KB     128 rows

. . imported "TESTUSER2"."T3"                            4.937 KB       1 rows

Job "TESTUSER2"."SYS_IMPORT_FULL_01" successfully completed at 16:40:33


[oracle@web151 ~]$ 




8. 导出特定表并进行导入

=======================


原库:导出用户的表t1,t2

$ expdp becvx/sun2moon tables=\(t1,t2\) directory=dp dumpfile=becvx01.dmp logfile=exp_becvx.log job_name=exp_becvx


Export: Release 10.2.0.4.0 - Production on Wednesday, 10 June, 2009 11:18:13


Copyright (c) 2003, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting "BECVX"."EXP_BECVX": becvx/******** tables=(t1,t2) directory=dp dumpfile=becvx01.dmp logfile=exp_becvx.log job_name=exp_becvx 

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 192 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

. . exported "BECVX"."T1"                                67.95 KB     256 rows

. . exported "BECVX"."T2"                                4.960 KB       1 rows

Master table "BECVX"."EXP_BECVX" successfully loaded/unloaded

******************************************************************************

Dump file set for BECVX.EXP_BECVX is:

/u02/backup/becvx01.dmp

Job "BECVX"."EXP_BECVX" successfully completed at 11:18:24




目标库:创建用户,并授予相应的权限(注意此次导出没有带任何的用户权限之类的数据,所以要全新创建用户)


create user becvx identified by sun2moon ;

grant connect, resource to becvx;

create directory dp as '/u02/backup';   <---- 之前执行过后,不用再执行


grant read,write on directory dp to public;




$ impdp becvx/sun2moon directory=dp dumpfile=becvx01.dmp


Import: Release 10.2.0.4.0 - Production on Wednesday, 10 June, 2009 10:55:45


Copyright (c) 2003, 2007, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table "BECVX"."SYS_IMPORT_FULL_01" successfully loaded/unloaded

Starting "BECVX"."SYS_IMPORT_FULL_01": becvx/******** directory=dp dumpfile=becvx01.dmp 

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

. . imported "BECVX"."T1"                                67.95 KB     256 rows

. . imported "BECVX"."T2"                                4.960 KB       1 rows

Job "BECVX"."SYS_IMPORT_FULL_01" successfully completed at 10:55:46


Oracle11g数据库导入Oracle10g问题 

1)问题1: Oracle11g数据库导入Oracle10g数据库操作导入解决方法:

11g备份,导入10g的时候会抛错,直接阻止导入。

但是有时候还必须得把11g的数据库导入到10g,我今天就遇到了这种情况。

一、在11g服务器上,使用expdp命令备份数据

EXPDP USERID='SYS/cuc2009@cuc as sysdba' schemas=sybj directory=DATA_PUMP_DIR dumpfile=aa.dmp logfile=aa.log version=10.2.0.1.0

其中,红色文字部分是根据需要改写的地方。例如我的sys密码是cuc2009,数据库sid是cuc,要到出的用户名是sybj,要导入到10.2.0.1.0版本的Oracle数据库中去。aa.dmp和aa.log将会在11g的dpdump目录中生成,例如我的11g装在了E盘下面,于是aa.dmp将会在E:\app\Administrator\admin\cuc\dpdump目录下被生成。

二、在10g服务器上,使用impdp命令恢复数据

准备工作:1.建库2.建表空间3.建用户并授权4.将aa.dmp拷贝到10g的dpdump目录下

1-3点可以去参考博主的上一篇博客“Oracle数据库移植全步骤”,介绍的很详细,这里不再多说。关于第4点,我的10g装在了e:\tools目录下,于是我将aa.dmp文件拷贝到了E:\tools\admin\cucf\dpdump目录下。

IMPDP USERID='SYS/cuc2009@cucf as sysdba' schemas=sybj directory=DATA_PUMP_DIR dumpfile=aa.dmp logfile=aa.log version=10.2.0.1.0

其中红色部分是根据需要改写的地方。例如我的sys密码是cuc2009,数据库sid是cucf,要导入用户名为sybj,要导入到10.2.0.1.0版本的Oracle数据库中去。aa.log将会在10g的dpdump目录中生成。

2)问题2:Oracle 11g导出来的dmp导入到 10g的数据库(IMP-00010:不是有效的导出文件,头部验证失败)

oracle 11g R2 导出去的dmp文件,导入11g R1或10G的,都显示:

IMP-00010:不是有效的导出文件,头部验证失败

为了这个问题一直苦恼,差点就想卸掉11g然后装10g了,后来想想,头部验证,那么头部到底是什么,用Notepad++查看了dmp文件,发现头部真的显示一些东西:

11g R2:V11.02.00

11g R1:V11.01.00

10g:V10.02.01

把版本改成对方机子数据库版本,执行imp就不再报错了。

考虑到如果文件过大,可能打不开导致死机,做个小程序。(C# WINFORM)


2个按钮的事件:

private void button1_Click(object sender, EventArgs e) 
       
{ 
           
OpenFileDialog file = new OpenFileDialog(); 
           
file.InitialDirectory = Application.ExecutablePath; 
           
if (file.ShowDialog() == DialogResult.OK) 
           
{ 
               
String path =label11.Text= file.FileName; 
               
FileStream fs = File.OpenRead(path); 
               
fs.Seek(0, SeekOrigin.Begin); 
               
byte[] byData = new byte[100]; 
               
fs.Read(byData, 0, 50); 
               
string charData = new UTF8Encoding(true).GetString(byData, 0, byData.Length); 
               
string[] da = System.Text.RegularExpressions.Regex.Split(charData, @":V", RegexOptions.IgnoreCase); 
               
Regex r = new Regex(@":V\d{2}\.\d{2}\.\d{2}"); 
               
Match m = r.Match(charData); 
               
label9.Text = m.Index.ToString (); 
               
label10.Text = m.Length.ToString(); 
               
textBox1.Text = System.Text.RegularExpressions.Regex.Split(m.Value, @":V", RegexOptions.IgnoreCase)[1]; 
               
fs.Close(); 
           
} 
       
}

        private void button2_Click(object sender, EventArgs e) 
       
{ 
           
Regex r = new Regex(@"\d{2}\.\d{2}\.\d{2}"); 
           
Match m = r.Match(textBox1.Text); 
           
if (m.Success) 
           
{ 
               
FileStream fs = File.OpenWrite(label11.Text); 
               
fs.Seek(int.Parse(label9.Text.ToString())+2, SeekOrigin.Begin); 
               
Byte[] info = new UTF8Encoding(true).GetBytes(textBox1.Text); 
               
fs.Write(info, 0, info.Length);

  fs.Close(); 
               
MessageBox.Show("版本修改成功。"); 
           
} 
           
else 
               
MessageBox.Show("版本格式错误。"); 
       
}

3)问题3: 11g exp数据时就会遗漏记录数为0的表导入错误解决方法:

原因在于11gR2中的新功能 – Deferred Segment Creation(延迟段创建),默认情况 下这个功能是启用的。

  SQL>show parameter DEFERRED_SEGMENT_CREATION

NAME                                 TYPE                 VALUE

------------------------------------ --------------------

deferred_segment_creation            boolean              TRUE

延迟段创建的含义是当此新创建一个可能会有Segment的对象时(比如表、索引、物化 视图等),如果这个对象中还没有任何记录需要消耗一个Extent,那么将不会在创建对象时自动创建Segment,这样做的好处无疑是在创建对象时大大提高了速度。

对于上例中的T2表,我们在创建结束就立刻检查DBA_SEGMENTS视图,会发现没有任何记

录。

SQL>select segment_name from user_segments where segment_name='T2';

  no rows selected

而对于exp程序而言,当仅仅存在Object的定义而没有相应的Segment时,就会报出

EXP-00011对象不存在的错误。

解决方法就很简单了,以下方法任选其一。

1. 设置DEFERRED_SEGMENT_CREATION为FALSE,这样创建对象时就会自动创建Segment

2. 在创建对象时,明确指定立刻创建Segment

  create table t2 (n number) SEGMENT CREATION IMMEDIATE;

3. 使用expdp替代exp(Datapump本身就是Oracle10g以后的推荐工具)

  D:\Tempexpdp kamus/oracle tables=t2

  Export: Release 11.2.0.1.0 - Production on Fri Apr 16 18:14:41 2010

  Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights

reserved.

  Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -

64bit Production

  With the Partitioning, Oracle Label Security, Data Mining and Real

Application Testing opt ions

  Starting "KAMUS"."SYS_EXPORT_TABLE_01":  kamus/******** tables=t2

  Estimate in progress using BLOCKS method...

  Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

  Total estimation using BLOCKS method: 0 KB

  Processing object type TABLE_EXPORT/TABLE/TABLE

  . . exported "KAMUS"."T2"                                    0 KB       0

rows

  Master table "KAMUS"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded

  ****************************************************************************

  Dump file set for KAMUS.SYS_EXPORT_TABLE_01 is:

   D:\ORACLE\ADMIN\ORCL\DPDUMP\EXPDAT.DMP

  Job "KAMUS"."SYS_EXPORT_TABLE_01" successfully completed at 18:15:10

4、如果一定要用exp的话可以考虑给空表分配段:

select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0



本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

11g降到10g方法 的相关文章

  • 最火视频直播应用Meerkat: 简单到令人发指 却成功了

    最火视频直播应用Meerkat 简单到令人发指 却成功了 分析师 王鑫 2015 03 24 分享 1 作为一款手机视频直播应用 Meerkat的产品设计足够简单 这种简单不仅体现在操作交互层面 还蕴含于产品的核心逻辑中 类似阅后即焚的直播
  • Markdown基础语法

    Markdown基础语法 一 Markdown简介 Markdown 是一种轻量级标记语言 它允许人们使用易读易写的纯文本格式编写文档 Markdown 语言在 2004 由约翰 格鲁伯 英语 John Gruber 创建 Markdown
  • MATLAB中conv2的详细用法

    转自 https blog csdn net jinv5 article details 52874880 conv2函数 1 用法 C conv2 A B shape 卷积滤波 复制代码 A 输入图像 B 卷积核 假设输入图像A大小为ma
  • 安装 VMware 出现 failed to install the hcmon driver

    安装 VMware 出现 failed to install the hcmon driver 1 先删除所有带vmware注册表 删除后重启电脑 在装一遍 无还是无效 2 在c盘搜索hcmon sys文件 有就删除 删除之后重启电脑 再重
  • 响应式人力资源招聘企业网站源码

    介绍 响应式人力资源招聘企业网站源码 网盘下载地址 http kekewangLuo cc 6lqETgRAZ6a0 图片
  • mysql 表分区 插入数据,分区表导入数据库

    如果是10g及以上版本 可以使用参数REMAP TABLESPACE 来映射表空间 1 在ascii数据库中建立3个tablespaces tbs1 tbs2 tbs3 SQL gt create tablespace tbs1 dataf
  • 百分位数

    来源
  • dedecmscan漏洞扫描

    介绍 推荐一款 大佬编写 实用工具 只做推荐 请勿违法 如有侵权 请联系我删除 dedescan是一款可以扫描所有已公开的dedecms漏洞的扫描器 github地址 https github com lengjibo dedecmscan
  • C++中智能指针的设计和使用

    转载请标明出处 原文地址 http blog csdn net hackbuteer1 article details 7561235 智能指针 smart pointer 是存储指向动态分配 堆 对象指针的类 用于生存期控制 能够确保自动
  • libtorch 1.12.1 cuda11.3 torch1.12.1 visual stdio2019环境搭建

    conda 的环境 name torch1 12 1 channels https mirrors tuna tsinghua edu cn anaconda cloud pytorch https mirrors tuna tsinghu
  • 如何关闭rabbitmq

    rabbitmqctl stop 方式2 先用ps ef grep rabbitmq 查询出进程号 然后用kill 9 进程号 杀死进程 RabbitMQ常用命令 说明 命令 启用Web控制台 rabbitmq plugins enable
  • 路由器ipv6怎么设置才能上网_设置路由器时,如何正确选择上网方式?

    设置路由器时 常见有自动获得IP地址 宽带拨号上网 固定IP地址三种上网方式 选择任意一个 均可进入下一步 但上网方式选择错误 即使设置步骤完成 也不能上网 那么设置路由器时 如何正确选择上网方式呢 取决于当前宽带线路的上网方式 本文以Wi
  • NoSQL -- 1.NoSQL与TRDB的区别

    TRDB TRDB Traditional Relational Database 即 传统关系型数据库 关系型数据库 是指采用了关系模型来组织数据的数据库 其以行和列的形式存储数据 以便于用户理解 关系型数据库这一系列的行和列被称为表 一
  • 将一个对象的属性值赋值给另一个对象

    java 对象属性复制 将一个对象的属性值赋值给另一个对象 属性名需要相同 import org springframework beans BeanUtils BeanUtils copyProperties 源对象 目标对象
  • 一位老学长的真实互联网校招求职心路历程~

    自我介绍 听说很多家公司2019年的春招已经陆续开始了 作为一个备战过2018年春招和秋招的求职狗 想来聊一下自己的校招求职经历 我本科是哈尔滨的一所211大学 万年老二 学的是电子信息工程 由于当年高考发挥失常 自己又不想复读 所以从入学
  • Java+GeoTools(开源的Java GIS工具包)快速入门-实现读取shp文件并显示

    场景 GeoTools GeoTools 是一个开源的 Java GIS 工具包 可利用它来开发符合标准的地理信息系统 GeoTools 提供了 OGC Open Geospatial Consortium 规范的一个实现来作为他们的开发
  • SLAM--三角测量SVD分解法、最小二乘法及R t矩阵的判断

    目录 一 三角测量 方法一 SVD分解法的推导 方法二 最小二乘法求解 二 ORB SLAM2 三角测量源码 三 利用Eigen源码实现三角测量 方法一 SVD分解法 方法二 最小二乘法求解 速度最快 方法三 利用OpenCV自带函数 四
  • go语言面试题:令牌桶算法原理

    令牌桶算法是一种常见的限流算法 它基于一个简单的思想 系统中的请求像一个桶 在请求发送之前都需要从桶中获取一个令牌 如果桶里没有可用的令牌 则该请求会被暂时禁止 具体来说 令牌桶算法会在桶内放入固定数量的令牌 这些令牌以固定的速率自动回复
  • 二阶系统响应指标图_一阶和二阶系统的动态特性参数

    检测系统的时域动态性能指标一般都是用阶跃输入时检测系统的输出响应 即过渡过程曲线上的特性参数来表示 1 一阶系统的时域动态特性参数 一阶测量系统时域动态特性参数主要是时间常数及与之相关的输出响应时间 1 时间常数 时间常数是一阶系统的最重要
  • 三十一.刷题.20

    统计给定的n个数中 负数 零和正数的个数 include

随机推荐

  • LeetCode 1309. 解码字母到整数映射

    给你一个字符串 s 它由数字 0 9 和 组成 我们希望按下述规则将 s 映射为一些小写英文字符 字符 a i 分别用 1 9 表示 字符 j z 分别用 10 26 表示 返回映射之后形成的新字符串 题目数据保证映射始终唯一 示例 1 输
  • 练习题:猜年龄游戏升级版

    猜年龄游戏升级版 需求 1 允许用户最多尝试3次 2 每尝试3次后 如果还没猜对 就问用户是否还想继续玩 如果回答Y或y 就继续让其猜3次 以此往复 如果回答N或n 就退出程序 3 如何猜对了 就直接退出 import random n r
  • mysql基础--存储过程

    文章目录 MySQL存储过程 1 创建存储过程 2 调用存储过程 3 变量定义 3 1 局部变量 3 2 用户变量 3 3 系统变量 3 3 1 系统变量 全局变量 3 3 2 系统变量 会话变量 4 存储过程传参 4 1 in 4 2 o
  • Unity进阶--物品,背包,角色管理器

    文章目录 物品管理器 背包管理器 角色管理器 物品管理器 物品数据 Item json json部分 Resources Data Item id 1 name 新手剑 des 这是一把宝剑 price 200 icon attack 10
  • C语言:通过函数指针来完成两个数的加减乘除(函数指针当做参数使用)

    main c Function pointer Created by mac on 15 8 2 Copyright c 2015年 All rights reserved 要求 将函数指针做参数来求两个整数的和 差 积 商 知识点 函数指
  • 【深度学习与计算机视觉】10、深度学习框架Tensorflow

    Tensorflow
  • python做的多激光雷达外参标定程序(初版本 完整版见专栏)

    查阅了一番资料和现有的代码后发现 现在的多个激光雷达之间的标定程序都是ROS框架下面的 并且都是C 代码 需要安装的依赖也比较复杂 于是自己写了一个python版本的标定程序 依赖非常简单 Windows系统也可以运行 并且代码简单 扩展性
  • 网络安全—DDOS和CC攻击的区别

    DDOS和CC攻击的区别 1 攻击简介 DDOS 分布式拒绝服务攻击 通过向目标发送大量数据包 耗尽其带宽 来使目标无法可用 CC攻击 DDOS的一种 也可以理解为应用层DDOS攻击 利用大量代理服务器对目标计算机发起大量连接 导致目标服务
  • 华中师范大学2018年874

    lt 对数组A的N个整数从小到大进行连续编号 输出各个元素的编号 例如对数组 A 5 3 4 7 3 5 6 则输出为 3 1 2 5 1 3 4 include
  • C++ 模板的显示具体化

    C 没有办法限制类型参数的范围 我们可以使用任意一种类型来实例化模板 但是模板中的语句 函数体或者类体 不一定就能适应所有的类型 可能会有个别的类型没有意义 或者会导致语法错误 例如有下面的函数模板 它用来获取两个变量中较大的一个 temp
  • maven的5种打包方式,终有一款适合你(一)

    话不多说 上主题 1 1 概述 在讲打包方式之前 首先来说最近踩到的坑 在idea新建的maven项目 在pom文件中会自动生成一段插件的管理器 我使用maven打包插件maven assembly plugin 将其配置添加到
  • Jetson-nano:制作TF卡启动

    旧Nano可以直接导入镜像至TF卡 然后插入卡槽即可启动系统 但目前旧的英伟达已经停止生产底板 现在市面上都是带emmc的核心板 底板是由其他厂商进行扩容自行生产的 因为官方自带的emmc只有16G 如果做扩展使用 就要使用到扩容的TF卡
  • 零基础必知8个测试工具

    1 Fiddler 网络抓包工具 Fiddler在测试中一般用于篡改接口请求或接口返回数据以测试前后端业务场景或对异常功能的兼容 它能监控进出设备的http协议请求 并且支持重新编辑请求与返回 从而测试前端页面对不同结果的反应 官网下载地址
  • map遍历的4种方式

    map遍历的方式有4种 1 使用for循环遍历map 2 使用迭代器遍历map 3 使用keySet迭代遍历map 4 使用entrySet遍历map 创建一个Map集合 Map
  • 使用Java8的Stream进行多字段排序以及剔除非空字段排序

    使用 Stream的sort 方法 并结合 Comparator 类 进行排序 主要解决以下两个问题 一 当某个字段为空时 怎么进行排序 使用 Comparator nullsFirst 或者 Comparator nullsLast 进行
  • 出现"/var/lib/mysql/mysql.sock“不存在的解决方法

    出现 var lib mysql mysql sock 不存在的解决方法 SQLSTATE HY000 2002 Can t connect to local MySQL server through socket var lib mysq
  • gRPC运行过程与流量控制机制

    文章目录 gRPC运行过程与流量控制 gRPC中的流量控制 讲解思路 BDP采样流量控制 结构分析 过程分析 Connection Level 流量控制 结构分析 过程分析 Stream level流量控制 结构分析 过程分析 总结 参考
  • 入门必看~~~~~群智能算法之鲸鱼优化算法(WOA)

    前言 鲸鱼优化算法 WOA 也是一种元启发式优化算法 一种新的模拟座头鲸狩猎行为的元启发式优化算法 鲸鱼优化算法 WOA 目前的工作与其他群优化算法相比的主要区别在于 采用随机或最佳搜索代理来模拟捕猎行为 并使用螺旋来模拟座头鲸的泡泡网攻击
  • A*算法 解决(有环图)第k短路径长度(C++)

    算法竞赛 file author jUicE g2R qq 3406291309 彬 bin 必应 一个某双流一大学通信与信息专业大二在读 brief 一直在算法竞赛学习的路上 copyright 2023 9 COPYRIGHT 原创技术
  • 11g降到10g方法

    Oracle11g数据库导入Oracle10g数据库 EXPDP方法 EXPDP要注意的是 导出的文件是在服务器端的 DATA PUMP DIR目录里 11g备份 导入10g的时候会抛错 直接阻止导入 一 在11g服务器上 使用expdp命