oracle停导出某用户下的表

oracle下导出某用户下的表


scott/tiger是用户名和密码,handson是导出的实例名
 
² 按用户方式导出数据(owner当中写的是用户名)
 
exp scott/tiger@handson file=scott_back owner=scott
 
² 按表方式导出数据(talbes当中写的是全部表的名称)
 
exp scott/tiger@handson tables=(emp, dept) file=scott_back_tab
 
² 按表空间方式导出数据(tablespaces当中写的是表空间名称)
 
exp system/handson@handson tablespaces=(users) file=tbs_users
 
² 使用参数文件导出数据
 
exp system/handson parfile='C:\parameters.txt
 
1、cmd->exp->username/passwd@sid-->.....一路回车--->输入导出库得名字 就把所有的表、视图、存储过程、函数、作业等乱七八糟的都导出来了;
 2、pl/sql-->工具---〉导出用户对象 可以找到你要导的东东。
 两者都可以的很方便!
 
导出表: exp scott/tiger@mycon tables=(dept,emp) file=tab1.dmp
 
导出用户: exp system/manager@mycon owner=scott file=usr1.dmp
 
导出数据库:
 
1.完全导出 exp system/manager@mycon full=y inctype=complete file=full1.dmp
 
2.增量导出 exp system/manager@mycon full=y inctype=incremental file=inc1.dmp
 
3.累积导出 exp system/manager@mycon full=y inctype=cumulative file=cum1.dmp
 
导入表: imp system/manager@mycon file=c:\tab1.dmp tables=(dept,emp) touser=scott
 
导入用户: imp system/manager@mycon file=usr1.dmp fromuser=scott touser=scott
 
导入数据库:
 
1.全库导入 imp system/manager@mycon file=full1.dmp full=y
 
2.增量导入
 
1)导入数据库最新信息 imp system/manager@mycon inctype=system full=y file=inc7.dmp 2)导入最近完全导出文件 imp system/manager@mycon inctype=restore full=y file=full1.dmp
 
3)导入所有累积导出文件 imp system/manager@mycon inctype=restore full=y file=cum1.dmp
 
4)导入最近一次增量导出的文件 imp system/manager@mycon inctype=restore full=y file=inc1.dmp
 
常用的命令
 
Exp user/password@instance file=file.dmp rows=y log=log_name
 
其中username/password为导出用户的用户名和密码
 
Instance为导出的实例名
 
Rows是指定是否要导入表中的行
 
导出一个用户下的表结构为sql文件:
 
使用命令好像导出的都是dmp文件
 
可以使用plsql软件在tools--àexport user object
 
如果不要到处table space ,不要勾include storage
 
选择导出的路径文件名,export可以直接导出了
 
例子1:(本方法限oracle9i版本以上)
 
set pagesize 0
 set long 90000
 set feedback off
 set echo off
 spool get_allddl.sql
 connect USERNAME/PASSWORD@SID;
 SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name)
 FROM USER_TABLES u;
 SELECT DBMS_METADATA.GET_DDL('INDEX',u.index_name)
 FROM USER_INDEXES u;
 spool off;
 

例子2:
 
首先在sqlplus下以该用户登录到oracle数据库,然后将以下内容粘贴到sqlplus中:
 
  set feedback off;
 
  set pagesize 0;
 
  set heading off;
 
  set verify off;
 
  set linesize 200;
 
  set trimspool on;
 
  spool c:\数据库备份.bat;
 
  select 'exp username/ffffff@yourdb TABLES='||table_name||' FILE='||table_name||'.dmp TRIGGERS=N' from user_tables;
 
  spool off;
 
  set feedback on;
 
  set pagesize 9999;
 
  set heading on;
 
  set verify on;
 
  exit
 
  完成后在找到 c:\数据库备份.bat 文件,编辑该批处理文件,将第一行和最后一行删掉,保存后运行该批处理文件就可全部导出该用户下的所有表。
 
oracle下导入某用户所有表的方法
 
² 将整个文件导入数据库
 
imp system/handson@handosn file=item_back.dmp ignore=y full=y
 
² 将scott用户的表导入到martin用户
 
imp system/handson@handosn file=scott_back fromuser=scott touser=martin tables=(emp,dept)
 
² 使用参数文件导入数据
 
imp system/oracle parfile='C:\parameters.txt
 
常用命令
 
Imp username/password file=file.dmp fromuser=user1 touser=user2 rows=y
 
其中username/password为导入到数据库的用户名和密码
 
Fromuser为备份数据库时的用户
 
Touser为导入数据库的用户,一般和username同

http://www.lfpsoft.com