首页 » 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. iphone 4 free | #1
    2011-10-03 at 15:12

    Hey siblings loves your gorgeous website thank you and please carry on

  2. Cowboy Millionaire Bonus | #2
    2011-10-03 at 04:54

    How do you do? We simply love your excellent site thank you and please carry on

  3. seroquel | #3
    2011-09-06 at 04:56

    Thanks for tris interesting information! I found it very useful =)

  4. Linda | #4
    2011-09-03 at 10:37

    This is the peferct way to break down this information.

  5. buy flagyl | #5
    2011-08-28 at 15:39

    Really interesting blog, keep up the good work!