Oracle备份恢复之逻辑备份

exp

交互模式:导出scott用户下的emp表。

[oracle@localhost ~]$ exp

Export: Release 10.2.0.1.0 - Production on Thu Nov 27 12:27:45 2014

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

Username: scott

Password:

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

With the Partitioning, OLAP and Data Mining options

Enter array fetch buffer size: 4096 >

Export file: expdat.dmp > /u01/oracle/text.dmp

(2)U(sers), or (3)T(ables): (2)U > T

Export table data (yes/no): yes >

Compress extents (yes/no): yes >

Export done in US7ASCII character set and AL16UTF16 NCHAR character set

server uses ZHS16GBK character set (possible charset conversion)

About to export specified tables via Conventional Path ...

Table(T) or Partition(T:P) to be exported: (RETURN to quit) > emp

. . exporting table EMP 14 rows exported

EXP-00091: Exporting questionable statistics.

EXP-00091: Exporting questionable statistics.

Table(T) or Partition(T:P) to be exported: (RETURN to quit) >

Export terminated successfully with warnings.

命令行模式:导出scott用户下的emp表。导出多张表需要用,或空格分隔开。

[oracle@localhost ~]$ exp scott/tiger file=/u01/oracle/test1.dmp tables=emp

Export: Release 10.2.0.1.0 - Production on Thu Nov 27 12:33:33 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 ZHS16GBK character set (possible charset conversion)

About to export specified tables via Conventional Path ...

. . exporting table EMP 14 rows exported

EXP-00091: Exporting questionable statistics.

EXP-00091: Exporting questionable statistics.

Export terminated successfully with warnings.

按照方案的形式把scott用户下的数据全部导出。

[oracle@localhost ~]$ exp scott/tiger file=/u01/oracle/test9.dmp owner=scott

Export: Release 10.2.0.1.0 - Production on Thu Nov 27 12:37:02 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 ZHS16GBK character set (possible charset conversion)

. 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.

EXP-00091: Exporting questionable statistics.

. . exporting table EMP 14 rows exported

EXP-00091: Exporting questionable statistics.

EXP-00091: Exporting questionable statistics.

. . exporting table SALGRADE 5 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 post-schema procedural objects and actions

. exporting statistics

Export terminated successfully with warnings.

用sys用户导出scott用户下所有数据。

[oracle@localhost ~]$ exp \'sys/tiger as sysdba\' file=/u01/oracle/test8.dmp owner=scott

Export: Release 10.2.0.1.0 - Production on Thu Nov 27 12:42: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 ZHS16GBK 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 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.

EXP-00091: Exporting questionable statistics.

. . exporting table EMP 14 rows exported

EXP-00091: Exporting questionable statistics.

EXP-00091: Exporting questionable statistics.

. . exporting table SALGRADE 5 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 post-schema procedural objects and actions

. exporting statistics

Export terminated successfully with warnings.

如果到处文件过大,可以指定多个导出文件。

>exp scott/tiger file=/u01/oracle/test1.dmp,/u01/oracle/test2.dmp filesize=1g tables=emp dept log=/u01/oracle/20141128.log

[oracle@localhost ~]$ exp scott/tiger file=/u01/oracle/test1.dmp,/u01/oracle/test2.dmp filesize=1g tables=emp dept log=/u01/oracle/20141128.log

Export: Release 10.2.0.1.0 - Production on Thu Nov 27 12:51:18 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 ZHS16GBK character set (possible charset conversion)

About to export specified tables via Conventional Path ...

. . exporting table EMP 14 rows exported

EXP-00091: Exporting questionable statistics.

EXP-00091: Exporting questionable statistics.

. . exporting table DEPT 4 rows exported

EXP-00091: Exporting questionable statistics.

EXP-00091: Exporting questionable statistics.

Export terminated successfully with warnings.

使用具备dba权限的用户进行全库导出。

exp \'sys/tiger@orcl as sysdba\' file=/u01/oracle/full.dmp,/u01/oracle/fulll.dmp filesize=100m full=y

参数文件导出:

[oracle@localhost oracle]$ vi p1

[oracle@localhost oracle]$ exp parfile p1

[oracle@localhost oracle]$ vi p1

userid=scott/tiger

file=/u01/oracle/pfile.dmp

tables=emp

[oracle@localhost oracle]$ exp parfile=p1

query参数导出符合的数据:

userid=scott/tiger

file=/u01/dddd.dmp

tables=emp

query='where deptno in (10,20)'

imp

表不存在导入方式:imp scott/tiger file=/u01/oracle/scott.dmp tables=emp,dept

表存在的导入方式:imp scott/tiger file=/u01/scott.dmp tables=emp ignore=y

imp scott/tiger file=/u01/oracle/scott.dmp fromuser=v7hqs touser=v7hqs log=2014

将scott用户emp表导入s1用户:

imp system/tiger fromuser=scott touser=s1 file=/u01/oracle/scott.dmp tables=emp

上一篇:Mysql的收获


下一篇:[array] leetcode - 41. First Missing Positive - Hard