热门标签 | HotTags
当前位置:  开发笔记 > 数据库 > 正文

Import/Export(??EXP-00091)

ImportExport工具可以实现:(1)获取数据库中对象的创建脚本(2)备份数据(逻辑备份,小规模数据库效率高)(3)跨平台、跨版本的迁移数据(4)在多个数据库之间通过传输表空间特性快速复制数据Export:首先确保用户有权利导入导出数据,以SYS身份

Import/Export工具可以实现: (1)获取数据库中对象的创建脚本 (2)备份数据(逻辑备份,小规模数据库效率高) (3)跨平台、跨版本的迁移数据 (4)在多个数据库之间通过传输表空间特性快速复制数据 Export: 首先确保用户有权利导入导出数据,以SYS身份

Import/Export工具可以实现:
(1)获取数据库中对象的创建脚本
(2)备份数据(逻辑备份,小规模数据库效率高)
(3)跨平台、跨版本的迁移数据
(4)在多个数据库之间通过传输表空间特性快速复制数据

Export:

首先确保用户有权利导入导出数据,以SYS身份授权给将要执行导出的用户
SQL> show user
USER is "SYS"
SQL> grant exp_full_database to scott;

Grant succeeded.

SQL> grant imp_full_database to scott;

Grant succeeded.

1.导出表中的某些记录:
背景:
SQL> select * from scott.test;

ID
----------
1
2
3
4
5

导出id<3的,理论上只有两条记录。
测试:
[oracle@linux5 ~]$ exp scott/oracle tables=test query=\"where ID\<'3'\" file=/u01/imp_exp/test_less3.dmp log=/u01/imp_exp/test_less3.log

Export: Release 10.2.0.1.0 - Production on Wed Apr 9 00:45:11 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table TEST 2 rows exported
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
id是number类型,也可以不转义
[oracle@linux5 ~]$ exp scott/oracle tables=test query=\"where ID\<3\" file=/u01/imp_exp/test_less3_2.dmp log=/u01/imp_exp/test_less3_2.log

Export: Release 10.2.0.1.0 - Production on Wed Apr 9 00:47:17 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table TEST 2 rows exported
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.


2.导出某个SCHEMA下的某些表
背景:
SQL> select count(*) from scott.emp;

COUNT(*)
----------
14

SQL> select count(*) from scott.dept;

COUNT(*)
----------
4
测试:
[oracle@linux5 imp_exp]$ exp scott/oracle tables=dept,emp file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/dept_emp.log

Export: Release 10.2.0.1.0 - Production on Wed Apr 9 00:55:37 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
也可以通过system用户导出scott用户下面的两个表:
[oracle@linux5 imp_exp]$ exp system/oracle tables=scott.dept,scott.emp file=/u01/imp_exp/dept_emp_2.dmp log=/u01/imp_exp/dept_emp_2.log

Export: Release 10.2.0.1.0 - Production on Wed Apr 9 00:57:51 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)

About to export specified tables via Conventional Path ...
Current user changed to SCOTT
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
3.导出某几个SCHEMA中的对象
背景:
SQL> conn test/oracle
Connected.
SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
EXPFULL TABLE
BIN$8&#43;&#43;Yu/zZ6sLgQAB/AQBXxQ==$0 TABLE
BIN$8&#43;&#43;Yu/zc6sLgQAB/AQBXxQ==$0 TABLE
BIN$8&#43;&#43;Yu/zd6sLgQAB/AQBXxQ==$0 TABLE
BIN$8&#43;&#43;Yu/ze6sLgQAB/AQBXxQ==$0 TABLE
BIN$8&#43;&#43;Yu/zi6sLgQAB/AQBXxQ==$0 TABLE
TEST TABLE

11 rows selected.

SQL> conn scott/oracle
Connected.
SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
TEST TABLE
EXPFULL TABLE

6 rows selected.
测试:
[oracle@linux5 imp_exp]$ exp system/oracle owner=scott,test file=/u01/imp_exp/scott_test.dmp log=/u01/imp_exp/scott_test.log

Export: Release 10.2.0.1.0 - Production on Wed Apr 9 01:00:47 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting foreign function library names for user TEST
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
. exporting object type definitions for user TEST
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXPFULL 1653 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table SALGRADE 5 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TEST 5 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
About to export TEST's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export TEST's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXPFULL 1653 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table SALGRADE 5 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TEST 4 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.
4.整库导出:必须是拥有DBA角色,或者拥有EXP_FULL_DATABASE角色。
[oracle@linux5 imp_exp]$ exp system/oracle full=y file=/u01/imp_exp/fulldb.dmp log=/u01/imp_exp/fulldb.log

Export: Release 10.2.0.1.0 - Production on Wed Apr 9 01:11:36 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)

About to export the entire database ...
. exporting tablespace definitions
. exporting profiles
. exporting user definitions
. exporting roles
. exporting resource costs
. exporting rollback segment definitions
. exporting database links
. exporting sequence numbers
. exporting directory aliases
. exporting context namespaces
. exporting foreign function library names
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions
…………………………………………………………
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. exporting posttables actions
. exporting triggers
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting user history table
. exporting default and system auditing options
. exporting statistics
Export terminated successfully with warnings.
5.控制是否导出索引、约束、授权、触发器
[oracle@linux5 imp_exp]$ exp scott file=/u01/imp_exp/scott.dmp log=/u01/imp_exp/scott.log GRANTS=N INDEXES=N cOnstraints=n triggers=n

Export: Release 10.2.0.1.0 - Production on Wed Apr 9 01:24:26 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Password:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)
Note: grants on tables/views/sequences/roles will not be exported
Note: indexes on tables will not be exported
Note: constraints on tables will not be exported

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table DEPT 4 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table EMP 14 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table EXPFULL 1653 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table SALGRADE 5 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TEST 5 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting indextypes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.

EXP-00091:客户端执行导出时的语言环境应与服务器端的相同

SQL> select * from v$NLS_PARAMETERS where PARAMETER='NLS_CHARACTERSET';

PARAMETER
----------------------------------------------------------------
VALUE
----------------------------------------------------------------
NLS_CHARACTERSET
WE8ISO8859P1

上面是服务器端的环境变量,接下来设置客户端
[oracle@linux5 ~]$ export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
[oracle@linux5 ~]$ echo $NLS_LANG
AMERICAN_AMERICA.WE8ISO8859P1

背景:
SQL> create table testexp as select * from emp;

Table created.
SQL> select count(*) from testexp;

COUNT(*)
----------
14


[oracle@linux5 ~]$ exp scott/oracle tables=testexp query=\"where rownum\<5\"file=/u01/imp_exp/empless5.dmp log=/u01/imp_exp/empless5.log

Export: Release 10.2.0.1.0 - Production on Wed Apr 9 04:43:13 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...
. . exporting table TESTEXP 4 rows exported
Export terminated successfully without warnings.
这次没有报EXP-00091,如果还出错就是表的问题。

Import:
导入指定表到其他用户下面:
[oracle@linux5 imp_exp]$ imp test/oracle fromuser=scott touser=test file=/u01/imp_exp/scott.dmp log=/u01/imp_exp/scott_to_test.log

Import: Release 10.2.0.1.0 - Production on Wed Apr 9 19:31:10 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path

Warning: the objects were exported by SCOTT, not by you

import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses WE8ISO8859P1 character set (possible charset conversion)
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "BONUS" ("ENAME" VARCHAR2(10), "JOB" VARCHAR2(9), "SAL" NUMBER"
", "COMM" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INI"
"TIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) "
" LOGGING NOCOMPRESS"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "DEPT" ("DEPTNO" NUMBER(2, 0), "DNAME" VARCHAR2(14), "LOC" VAR"
"CHAR2(13)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 6"
"5536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) "
"LOGGING NOCOMPRESS"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0), "ENAME" VARCHAR2(10), "JOB" VARCH"
"AR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7, 2), "COMM" NUM"
"BER(7, 2), "DEPTNO" NUMBER(2, 0)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRAN"
"S 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAU"
"LT) LOGGING NOCOMPRESS"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "EXPFULL" ("PROCESS_ORDER" NUMBER, "DUPLICATE" NUMBER, "DUMP_F"
"ILEID" NUMBER, "DUMP_POSITION" NUMBER, "DUMP_LENGTH" NUMBER, "DUMP_ALLOCATI"
"ON" NUMBER, "COMPLETED_ROWS" NUMBER, "ERROR_COUNT" NUMBER, "ELAPSED_TIME" N"
"UMBER, "OBJECT_TYPE_PATH" VARCHAR2(200), "OBJECT_PATH_SEQNO" NUMBER, "OBJEC"
"T_TYPE" VARCHAR2(30), "IN_PROGRESS" CHAR(1), "OBJECT_NAME" VARCHAR2(500), ""
"OBJECT_LONG_NAME" VARCHAR2(4000), "OBJECT_SCHEMA" VARCHAR2(30), "ORIGINAL_O"
"BJECT_SCHEMA" VARCHAR2(30), "PARTITION_NAME" VARCHAR2(30), "SUBPARTITION_NA"
"ME" VARCHAR2(30), "FLAGS" NUMBER, "PROPERTY" NUMBER, "COMPLETION_TIME" DATE"
", "OBJECT_TABLESPACE" VARCHAR2(30), "SIZE_ESTIMATE" NUMBER, "OBJECT_ROW" NU"
"MBER, "PROCESSING_STATE" CHAR(1), "PROCESSING_STATUS" CHAR(1), "BASE_PROCES"
"S_ORDER" NUMBER, "BASE_OBJECT_TYPE" VARCHAR2(30), "BASE_OBJECT_NAME" VARCHA"
"R2(30), "BASE_OBJECT_SCHEMA" VARCHAR2(30), "ANCESTOR_PROCESS_ORDER" NUMBER,"
" "DOMAIN_PROCESS_ORDER" NUMBER, "PARALLELIZATION" NUMBER, "UNLOAD_METHOD" N"
"UMBER, "GRANULES" NUMBER, "SCN" NUMBER, "GRANTOR" VARCHAR2(30), "XML_CLOB" "
"CLOB, "NAME" VARCHAR2(30), "VALUE_T" VARCHAR2(4000), "VALUE_N" NUMBER, "IS_"
"DEFAULT" NUMBER, "FILE_TYPE" NUMBER, "USER_DIRECTORY" VARCHAR2(4000), "USER"
"_FILE_NAME" VARCHAR2(4000), "FILE_NAME" VARCHAR2(4000), "EXTEND_SIZE" NUMBE"
"R, "FILE_MAX_SIZE" NUMBER, "PROCESS_NAME" VARCHAR2(30), "LAST_UPDATE" DATE,"
" "WORK_ITEM" VARCHAR2(30), "OBJECT_NUMBER" NUMBER, "COMPLETED_BYTES" NUMBER"
", "TOTAL_BYTES" NUMBER, "METADATA_IO" NUMBER, "DATA_IO" NUMBER, "CUMULATIVE"
"_TIME" NUMBER, "PACKET_NUMBER" NUMBER, "OLD_VALUE" VARCHAR2(4000), "SEED" N"
"UMBER, "LAST_FILE" NUMBER, "USER_NAME" VARCHAR2(30), "OPERATION" VARCHAR2(3"
"0), "JOB_MODE" VARCHAR2(30), "CONTROL_QUEUE" VARCHAR2(30), "STATUS_QUEUE" V"
"ARCHAR2(30), "REMOTE_LINK" VARCHAR2(4000), "VERSION" NUMBER, "DB_VERSION" V"
"ARCHAR2(30), "TIMEZONE" VARCHAR2(64), "STATE" VARCHAR2(30), "PHASE" NUMBER,"
" "GUID" RAW(16), "START_TIME" DATE, "BLOCK_SIZE" NUMBER, "METADATA_BUFFER_S"
"IZE" NUMBER, "DATA_BUFFER_SIZE" NUMBER, "DEGREE" NUMBER, "PLATFORM" VARCHAR"
"2(101), "ABORT_STEP" NUMBER, "INSTANCE" VARCHAR2(60)) PCTFREE 10 PCTUSED 4"
"0 INITRANS 10 MAXTRANS 255 STORAGE(INITIAL 393216 FREELISTS 1 FREELIST GROU"
"PS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS LOB ("XML_C"
"LOB") STORE AS (TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVER"
"SION 10 NOCACHE LOGGING STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS "
"1 BUFFER_POOL DEFAULT))"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "SALGRADE" ("GRADE" NUMBER, "LOSAL" NUMBER, "HISAL" NUMBER) P"
"CTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELIST"
"S 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) LOGGING NOCOM"
"PRESS"
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "TEST" ("ID" NUMBER(*,0)) PCTFREE 10 PCTUSED 40 INITRANS 1 MA"
"XTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL "
"DEFAULT) LOGGING NOCOMPRESS"
Import terminated successfully with warnings.
导入表结构到指定用户:

修改test用户的默认表空间为test:
SQL> create user test identified by oracle;

User created.
SQL> select username,default_tablespace from user_users;

USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
TEST USERS(默认情况)

SQL> grant dba to test;

Grant succeeded.
SQL> create tablespace test
2 datafile '/u01/app/oracle/oradata/orcl/tests.dbf'
3 size 50m;

Tablespace created.
SQL> alter user test default tablespace test
2 ;

User altered.
SQL> select username,default_tablespace from user_users;

USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
TEST TEST
测试:
[oracle@linux5 orcl]$ export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
[oracle@linux5 orcl]$ echo $NLS_LANG
AMERICAN_AMERICA.WE8ISO8859P1
[oracle@linux5 orcl]$ exp scott/oracle tables=dept,emp file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/dept_emp.log

Export: Release 10.2.0.1.0 - Production on Thu Apr 10 18:14:00 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...
. . exporting table DEPT 4 rows exported
. . exporting table EMP 14 rows exported
Export terminated successfully without warnings.
导入:
[oracle@linux5 orcl]$ imp test/oracle fromuser=scott touser=test file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/scott_to_test.log

Import: Release 10.2.0.1.0 - Production on Thu Apr 10 18:14:44 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path

Warning: the objects were exported by SCOTT, not by you

import done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into TEST
. . importing table "DEPT" 4 rows imported
. . importing table "EMP" 14 rows imported
About to enable constraints...
Import terminated successfully without warnings.
10g用户的默认表空间是USERS表空间:
SQL> select username,default_tablespace from user_users;

USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
TEST TEST

SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
EMP USERS
DEPT USERS

SQL> conn scott/oracle
Connected.
SQL> select table_name,tablespace_name from user_tables where table_name in ('emp','dept');

no rows selected

SQL> select table_name,tablespace_name from user_tables where table_name in ('EMP','DEPT');

TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
DEPT USERS
EMP USERS
解决:
删除之前的导入数据,显示授权用户指定表空间的存储权限,并回收Unlimited Tablespace权限:
例如:授予Test用户无限操作Test表空间权限,并收回UT权限:
SQL> conn test/oracle
Connected.
SQL> drop table emp purge;

Table dropped.

SQL> drop table dept purge;

Table dropped.

SQL> select * from tab;

no rows selected

SQL> conn / as sysdba
Connected.
SQL> alter user test quota unlimited on test;

User altered.

SQL> revoke unlimited tablespace from test;

Revoke succeeded.
[oracle@linux5 orcl]$ imp test/oracle fromuser=scott touser=test file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/scott_to_test.log

Import: Release 10.2.0.1.0 - Production on Thu Apr 10 18:25:24 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path

Warning: the objects were exported by SCOTT, not by you

import done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into TEST
. . importing table "DEPT" 4 rows imported
. . importing table "EMP" 14 rows imported
About to enable constraints...
Import terminated successfully without warnings.

SQL> conn test/oracle
Connected.
SQL> select table_name,tablespace_name from user_tables where table_name in ('EMP','DEPT');

TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
DEPT TEST
EMP TEST
导入表结构到指定用户:
删除之后重新导入
[oracle@linux5 orcl]$ imp test/oracle fromuser=scott touser=test file=/u01/imp_exp/dept_emp.dmp log=/u01/imp_exp/scott_to_test.log rows=n

Import: Release 10.2.0.1.0 - Production on Thu Apr 10 18:31:01 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path

Warning: the objects were exported by SCOTT, not by you

import done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into TEST
About to enable constraints...
Import terminated successfully without warnings.
SQL> conn test/oracle
Connected.
SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE

SQL> select * from emp;

no rows selected

果真只有表结构,没有数据……


推荐阅读
  • MySQL缓存机制深度解析
    本文详细探讨了MySQL的缓存机制,包括主从复制、读写分离以及缓存同步策略等内容。通过理解这些概念和技术,读者可以更好地优化数据库性能。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 优化联通光猫DNS服务器设置
    本文详细介绍了如何为联通光猫配置DNS服务器地址,以提高网络解析效率和访问体验。通过智能线路解析功能,域名解析可以根据访问者的IP来源和类型进行差异化处理,从而实现更优的网络性能。 ... [详细]
  • 本文详细介绍如何使用Python进行配置文件的读写操作,涵盖常见的配置文件格式(如INI、JSON、TOML和YAML),并提供具体的代码示例。 ... [详细]
  • 本周信息安全小组主要进行了CTF竞赛相关技能的学习,包括HTML和CSS的基础知识、逆向工程的初步探索以及整数溢出漏洞的学习。此外,还掌握了Linux命令行操作及互联网工作原理的基本概念。 ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 深入理解 SQL 视图、存储过程与事务
    本文详细介绍了SQL中的视图、存储过程和事务的概念及应用。视图为用户提供了一种灵活的数据查询方式,存储过程则封装了复杂的SQL逻辑,而事务确保了数据库操作的完整性和一致性。 ... [详细]
  • 本文详细介绍了Java编程语言中的核心概念和常见面试问题,包括集合类、数据结构、线程处理、Java虚拟机(JVM)、HTTP协议以及Git操作等方面的内容。通过深入分析每个主题,帮助读者更好地理解Java的关键特性和最佳实践。 ... [详细]
  • 如何配置Unturned服务器及其消息设置
    本文详细介绍了Unturned服务器的配置方法和消息设置技巧,帮助用户了解并优化服务器管理。同时,提供了关于云服务资源操作记录、远程登录设置以及文件传输的相关补充信息。 ... [详细]
  • 本文深入探讨了Linux系统中网卡绑定(bonding)的七种工作模式。网卡绑定技术通过将多个物理网卡组合成一个逻辑网卡,实现网络冗余、带宽聚合和负载均衡,在生产环境中广泛应用。文章详细介绍了每种模式的特点、适用场景及配置方法。 ... [详细]
  • 本文详细介绍了如何在 Linux 平台上安装和配置 PostgreSQL 数据库。通过访问官方资源并遵循特定的操作步骤,用户可以在不同发行版(如 Ubuntu 和 Red Hat)上顺利完成 PostgreSQL 的安装。 ... [详细]
  • 掌握远程执行Linux脚本和命令的技巧
    本文将详细介绍如何利用Python的Paramiko库实现远程执行Linux脚本和命令,帮助读者快速掌握这一实用技能。通过具体的示例和详尽的解释,让初学者也能轻松上手。 ... [详细]
  • 本文详细分析了Hive在启动过程中遇到的权限拒绝错误,并提供了多种解决方案,包括调整文件权限、用户组设置以及环境变量配置等。 ... [详细]
  • 使用Vultr云服务器和Namesilo域名搭建个人网站
    本文详细介绍了如何通过Vultr云服务器和Namesilo域名搭建一个功能齐全的个人网站,包括购买、配置服务器以及绑定域名的具体步骤。文章还提供了详细的命令行操作指南,帮助读者顺利完成建站过程。 ... [详细]
  • 在现代网络环境中,两台计算机之间的文件传输需求日益增长。传统的FTP和SSH方式虽然有效,但其配置复杂、步骤繁琐,难以满足快速且安全的传输需求。本文将介绍一种基于Go语言开发的新一代文件传输工具——Croc,它不仅简化了操作流程,还提供了强大的加密和跨平台支持。 ... [详细]
author-avatar
彭彭宅男丶
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有