首页 » ORACLE 9i-23ai, 系统相关 » EXP 边导出边压缩打包

EXP 边导出边压缩打包

exp 可以导出oracle 的数据库逻辑备份,但一般都是导出完成后再用压缩工具打包,有没有边导出连压缩的办法呢?有

下面就用exp\gzip实现

shell版本bash

在rhel 5下操作

SQL> conn test/test;
Connected.
SQL> select * from tab;

TNAME                                                        TABTYPE
———————————————————— ————–
CLUSTERID
———-
TEST_TRAN                                                    TABLE

TEST_UNUSE                                                   TABLE

SQL> set linesize 200
SQL> run
1* select * from tab

TNAME                                                        TABTYPE         CLUSTERID
———————————————————— ————– ———-
TEST_TRAN                                                    TABLE
TEST_UNUSE                                                   TABLE

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options
[oracle@orazhang ~]$ exp test/test  file=>(gzip >test.dmp.gz)

Export: Release 10.2.0.1.0 – Production on 星期一 4月 11 15:50:46 2011

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 ZHS16GBK character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user TEST
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user TEST
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                      TEST_TRAN          5 rows exported
. . exporting table                     TEST_UNUSE      50706 rows exported
. 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 without warnings.
[oracle@orazhang ~]$ ls
afiedt.buf  baiji.class  b.sql    doub.java  dwhelper  on.lst        orcldrop.sql  sqlnet.log   wxWidgets-2.9.1
a.sql       baiji.java   Desktop  Download   ed.hup    oraInventory  record        test.dmp.gz

[oracle@orazhang ~]$ ora

SQL*Plus: Release 10.2.0.1.0 – Production on 星期一 4月 11 15:52:22 2011

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

SQL> create user test2 identified by test2;

User created.

SQL> grant connect to test2;

Grant succeeded.

SQL> grant resource to test2;

Grant succeeded.

SQL> exit

[oracle@orazhang ~]$ imp system/oracle fromuser=test touser=test2 file =<(gunzip <test.dmp.gz)

Import: Release 10.2.0.1.0 – Production on 星期一 4月 11 15:58:13 2011

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 TEST, not by you

import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
. importing TEST’s objects into TEST2
. . importing table                    “TEST_TRAN”          5 rows imported
. . importing table                   “TEST_UNUSE”      50706 rows imported
Import terminated successfully without warnings.

[oracle@orazhang ~]$ sqlplus test2/test2

SQL*Plus: Release 10.2.0.1.0 – Production on 星期一 4月 11 16:01:33 2011

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

SQL> set linesize 200
SQL> select * from tab;

TNAME                                                        TABTYPE         CLUSTERID
———————————————————— ————– ———-
TEST_TRAN                                                    TABLE
TEST_UNUSE                                                   TABLE

SQL> col name for a20
SQL> select * from test_tran;

ID NAME
———- ——————–
1 anbob.com
2 sesebook.com
2 sesebook.com
2 sesebook.com
2 sesebook.com

SQL>

打赏

目前这篇文章有21条评论(Rss)评论关闭。

  1. Arianna | #1
    2011-05-11 at 16:59

    This post is really helpful for somebody who has been having difficulties with this position. I have looked at a number of resourcefulnesses but to no avail. I will remain reading and determining here in the hope of ultimately getting past this.

    • Keyanna | #2
      2011-09-03 at 06:04

      A mtinue saved is a minute earned, and this saved hours!

  2. Andrea | #3
    2011-05-10 at 02:47

    Part of the most brilliant posts I have ever discovered on this forum. I found this quite useful for my future work. Thanks a lot.

  3. Mirta Pfleuger | #4
    2011-05-08 at 06:37

    With all the doggone snow we have gotten recently I am stuck indoors, fortunately there is the internet, thanks for giving me something to do. 🙂

  4. Carola Musso | #5
    2011-04-25 at 21:40

    I wish more people would write blogs like this that are really fun to read. With all the fluff floating around on the net, it is rare to read a blog like this instead.

    • Berlynn | #6
      2011-09-03 at 07:05

      If you’re reading this, you’re all set, padrenr!

  5. Genaro Rensch | #7
    2011-04-23 at 03:06

    This was novel. I wish I could read every post, but i have to go back to work now… But I’ll return.