[root@ localhost ~]# su - oracle
[oracle@ localhost ~]$ clear
[oracle@ localhost ~]$ cd $ORACLE_BASE
[oracle@ localhost oracle]$ ls
admin archive cfgtoollogs checkpoints diag flash_recovery_area oradata pl_sql_pacakge
[oracle@ localhost oracle]$ mkdir - p test_imp_exp
[oracle@ localhost oracle]$ cd test_imp_exp/
[oracle@ localhost test_imp_exp]$ ls
[oracle@ localhost test_imp_exp]$ pwd
/u01 /app /oracle /test_imp_exp
[oracle@ localhost test_imp_exp]$ sqlplus hr/ hr@ jiagulun
SQL*Plus: Release 11.2.0.1.0 Production on Tue
Jan 20 23: 50: 52 2015
Copyright ( c) 1982 , 2009, Oracle. All rights
reserved.
Connected to :
Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit
Production
With the Partitioning , OLAP , Data Mining and Real Application
Testing options
SQL> select * from student;
ID NAME AGE
---------- -------------------- ----------
SQL> select * from address;
XH ZZ
---------- ----------
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
Production
With the Partitioning , OLAP , Data Mining and Real Application
Testing options
[oracle@ localhost test_imp_exp]$ exp help =y --通过这个来查看关于exp命令的解释
Export: Release 11.2.0.1.0 - Production on Tue
Jan 20 23:51:56 2015
Copyright ( c) 1982 , 2009, Oracle and /or its
affiliates. All rights reserved.
You can let Export prompt you for parameters by entering the EXP
command followed by your username/password :
Example: EXP SCOTT/TIGER
Or, you can control how Export runs by entering the EXP command
followed
by various arguments. To specify parameters, you use keywords:
Format: EXP KEYWORD= value or KEYWORD =(value1 ,value2 ,... ,valueN )
Example: EXP SCOTT/TIGER GRANTS=Y TABLES=( EMP, DEPT, MGR)
or TABLES=( T1: P1, T1: P2), if T1 is partitioned table
USERID must be the first parameter on the command line.
Keyword Description (Default ) Keyword Description (Default )
--------------------------------------------------------------------------
USERID username/password FULL export entire file (N )
BUFFER size of data buffer OWNER list of owner
usernames
FILE output files (EXPDAT.DMP ) TABLES list of table names
COMPRESS import into one extent (Y ) RECORDLENGTH length of IO record
GRANTS export grants (Y) INCTYPE incremental export type
INDEXES export indexes (Y ) RECORD
track incr. export (Y )
DIRECT direct path (N ) TRIGGERS export triggers (Y )
LOG log file of screen output STATISTICS analyze objects (ESTIMATE )
ROWS export data rows (Y )
PARFILE parameter filename
CONSISTENT cross- table consistency (N ) CONSTRAINTS export constraints (Y )
OBJECT_CONSISTENT transaction set to read only during object export (N )
FEEDBACK display progress every x rows (0 )
FILESIZE maximum size of each dump file
FLASHBACK_SCN SCN used to set session snapshot back to
FLASHBACK_TIME time used to get the SCN closest to the specified time
QUERY select clause used to export a subset of a table
RESUMABLE suspend when a space related error is encountered (N )
RESUMABLE_NAME text string used to identify resumable statement
RESUMABLE_TIMEOUT wait time for RESUMABLE
TTS_FULL_CHECK perform full or partial dependency check for TTS
VOLSIZE number of bytes to write to each tape
volume
TABLESPACES list of tablespaces to export
TRANSPORT_TABLESPACE export transportable tablespace metadata (N)
TEMPLATE template name which invokes iAS mode export
[oracle@ localhost test_imp_exp]$ exp hr/ hr@ jiagulun tables =student file=/u01/app/oracle/test_imp_exp/hr_student_file.dbf log=/u01/app/oracle/test_imp_exp/hr_student_log.log
Export: Release 11.2.0.1.0 - Production on Wed
Jan 21 00:05:42 2015--上面的命令为通过导出表的模式导出student表
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 , OLAP , Data Mining and Real Application
Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table STUDENT 4 rows exported
Export terminated successfully without warnings.
[oracle@ localhost test_imp_exp]$ ! ls - a
ls - a
. .. expdat.dmp hr_student_file.dbf hr_student_log.log
[oracle@ localhost test_imp_exp]$ exp hr/ hr@ jiagulun tablespaces= users file=/u01/app/oracle/test_imp_exp/hr_tbs_users_file.dbf log=/u01/app/oracle/test_imp_exp/hr_tbs_users_log.log
Export: Release 11.2.0.1.0 - Production on Wed
Jan 21 00:08:23 2015--导出表空间
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 , OLAP , Data Mining and Real Application
Testing options
EXP-00023 : must be a DBA to do Full Database or Tablespace export--假如是导出数据库或者恶表空间需要dba来做
(2) U( sers), or ( 3) T( ables): ( 2) U > u--自动跳到了交互提示符模式:exp
Export grants (yes /no ): yes > yes
Export table data (yes /no ): yes > yes
Compress extents (yes /no ): yes > yes
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export selected tablespaces ...
. exporting referential integrity constraints
. exporting triggers
Export terminated successfully with warnings.
[oracle@ localhost test_imp_exp]$ ls
expdat.dmp hr_student_file.dbf hr_student_log.log hr_tbs_users_file.dbf hr_tbs_users_log.log
[oracle@ localhost test_imp_exp]$ ll
total 40
-rw -r --r-- 1 oracle oinstall 0 Jan 21 00:02 expdat.dmp
-rw -r --r-- 1 oracle oinstall 16384 Jan 21 00:05 hr_student_file.dbf
-rw -r --r-- 1 oracle oinstall 427 Jan 21 00:05 hr_student_log.log
-rw -r --r-- 1 oracle oinstall 16384 Jan 21 00:10 hr_tbs_users_file.dbf
-rw -r --r-- 1 oracle oinstall 463 Jan 21 00:10 hr_tbs_users_log.log
[oracle@ localhost test_imp_exp]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed
Jan 21 00: 11: 22 2015
Copyright ( c) 1982 , 2009, Oracle. All rights
reserved.
Connected to :
Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit
Production
With the Partitioning , OLAP , Data Mining and Real Application
Testing options
SQL> create user test1 identified by test1;
User created.
SQL> grant connect, resource to test1 ;
Grant succeeded.
SQL> create table test_export_tab(id number (20 ),name varchar2 (20 ));
Table created.
SQL> insert into test_export_tab values( 1, ‘zhangsan‘);
1 row created.
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
Production
With the Partitioning , OLAP , Data Mining and Real Application
Testing options
[oracle@ localhost test_imp_exp]$ exp hr/ hr@ jiagulun tables=test1.test_export_tab file=/u01/app/oracle/test_imp_exp/hr_test1_tab_file.dbf log=/u01/app/oracle/test_imp_exp/hr_test1_tab_log.log
Export: Release 11.2.0.1.0 - Production on Wed
Jan 21 00:20:07 2015--导出不同用户的表
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 , OLAP , Data Mining and Real Application
Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
EXP-00009 : no privilege to export TEST1 ‘s
table TEST_EXPORT_TAB
Export terminated successfully with warnings.--导出不同用户的数据信息必须有权限
[oracle@localhost test_imp_exp]$ exp system/oracle@jiagulun tables=test1.test_export_tab file=/u01/app/oracle/test_imp_exp/hr_test1_tab_file.dbf log=/u01/app/oracle/test_imp_exp/hr_test1_tab_log.log
Export: Release 11.2.0.1.0 - Production on Wed Jan 21 00:23:48 2015--system用户可以导出不同用户数据
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, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
Current user changed to TEST1
. . exporting table TEST_EXPORT_TAB 1 rows exported
Export terminated successfully without warnings.
|