【oracle 导入、导出】escape 的作用。

简介: SQL> conn yang/yang as sysdba已连接。SQL> select table_name from dba_tables where table_name like 'T_%';---在这里 _ 被当作通配符来处理。

SQL> conn yang/yang as sysdba
已连接。
SQL> select table_name from dba_tables where table_name like 'T_%';---在这里 _ 被当作通配符来处理。

TABLE_NAME                                                                     
------------------------------                                                 
TAB$                                                                           
TYPE_MISC$                                                                     
TS$                                                                            
TSQ$                                                                           
TYPED_VIEW$                                                                    
TRUSTED_LIST$                                                                  
TRIGGER$                                                                       
TRIGGERCOL$                                                                    
TRIGGERJAVAF$                                                                  
TRIGGERJAVAS$                                                                  
TRIGGERJAVAC$                                                                  

TABLE_NAME                                                                     
------------------------------                                                 
TRIGGERJAVAM$                                                                  
TRIGGERDEP$                                                                    
TSM_SRC$                                                                       
TSM_DST$                                                                       
TABLE_PRIVILEGE_MAP                                                            
TAB_STATS$                                                                     
TYPE$                                                                          
TYPEHIERARCHY$                                                                 
TABPART$                                                                       
TABSUBPART$                                                                    
TABCOMPART$                                                                    

TABLE_NAME                                                                     
------------------------------                                                 
TRANSACTION_BACKOUT_STATE$                                                     
TRANSACTION_BACKOUT_REPORT$                                                    
TRANSFORMATIONS$                                                               
TOKENSESSIONMAP_T$                                                             
T1                                                                             
T2                                                                             
TTS_TBS$                                                                       
TTS_USR$                                                                       
TTS_ERROR$                                                                     
已选择31行。
SQL> select table_name from dba_tables where table_name like 'TTS\_%' escape '\';--加上escape后,_ 当作下划线来处理
TABLE_NAME                                                                     
------------------------------                                                 
TTS_ERROR$                                                                     
TTS_USR$                                                                       
TTS_TBS$

当需要导出某一类表比如以 test_ 开头的表时 escape 就派上用场了,导出TEST_1 TEST_2 这两个表。

SQL> conn scott/tiger
Connected.

SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
DEPT                           TABLE
EMP                            TABLE
BONUS                          TABLE
SALGRADE                       TABLE
TEST_1                         TABLE
TEST_2                         TABLE
TESTA                          TABLE
TESTB                          TABLE
SQL> select tname from tab where tname like 'TEST\_%' escape '\';

TNAME
------------------------------
TEST_1
TEST_2
SQL> conn / as sysdba
SQL> create or replace directory dumpdir as  'd:\dump';
SQL> grant read,write on directory dumpdir to scott;

C:\Documents and Settings\Administrator>expdp scott/tiger DIRECTORY=dumpdir DUMPFILE=expdp_scott_test.dmp LOGFILE=expdp_scott_test.log SCHEMAS=scott INCLUDE=TABLE:\"IN \( select tname from tab where tname like 'TESTq_%' escape 'q' \)\"


Export: Release 10.1.0.2.0 - Production on 星期五, 22 10月, 2010 12:45

Copyright (c) 2003, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
FLASHBACK automatically enabled to preserve database integrity.
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01":  scott/******** DIRECTORY=dumpdir DUMPFILE=exp_tab.dmp LOGFILE=exp_tab.log SCHEMAS=scott INCLUDE=TABLE:"IN \( select tn
ame from tab where tname like 'TESTq_%' escape 'q' \)"
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128 KB
Processing object type SCHEMA_EXPORT/TABLE/TABLE
. . exported "SCOTT"."TEST_1"                            7.820 KB      14 rows
. . exported "SCOTT"."TEST_2"                            7.820 KB      14 rows
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
  D:\DUMP\EXP_TAB.DMP
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at 12:45
---导出部分的实例来自与puber  stanley !


 

目录
相关文章
|
Oracle 关系型数据库 语音技术
|
Oracle 关系型数据库
ORACLE中ESCAPE关键字用法
ESCAPE用法 1.使用 ESCAPE 关键字定义转义符:   在模式中,当转义符置于通配符之前时,该通配符就解释为普通字符。 2.ESCAPE 'escape_character'   允许在字符串中搜索通配符而不是将其作为通配符使用。
875 0
|
Oracle 关系型数据库
ORACLE的ESCAPE关键字
定义:escape关键字经常用于使某些特殊字符,如通配符:'%','_'转义为它们原来的字符的意义,被定义的转义字符通常使用'\',但是也可以使用其他的符号。 SQL> select * from liuch where name like '%_%';   NAME   ---------   bb_b   bbb SQL> select * from liuch
951 0
|
2月前
|
存储 Oracle 关系型数据库
Oracle数据库的应用场景有哪些?
【10月更文挑战第15天】Oracle数据库的应用场景有哪些?
174 64
|
27天前
|
SQL Oracle 关系型数据库
Oracle数据库优化方法
【10月更文挑战第25天】Oracle数据库优化方法
37 7
|
27天前
|
Oracle 关系型数据库 数据库
oracle数据库技巧
【10月更文挑战第25天】oracle数据库技巧
27 6
|
27天前
|
存储 Oracle 关系型数据库
Oracle数据库优化策略
【10月更文挑战第25天】Oracle数据库优化策略
21 5
|
2月前
|
存储 Oracle 关系型数据库
数据库数据恢复—Oracle ASM磁盘组故障数据恢复案例
Oracle数据库数据恢复环境&故障: Oracle ASM磁盘组由4块磁盘组成。Oracle ASM磁盘组掉线 ,ASM实例不能mount。 Oracle数据库故障分析&恢复方案: 数据库数据恢复工程师对组成ASM磁盘组的磁盘进行分析。对ASM元数据进行分析发现ASM存储元数据损坏,导致磁盘组无法挂载。
|
2月前
|
监控 Oracle 关系型数据库
Oracle数据库性能优化
【10月更文挑战第16天】Oracle数据库性能优化是
32 1