oracle下导出某用户表的方法
2012-06-09 08:29
441 查看
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同
² 按用户方式导出数据(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同
相关文章推荐
- 分析Oracle下导出某用户所有表的方法
- ORACLE导出某用户下PROCEDURE等脚本的可靠方法
- oracle下导出某用户所有表的方法
- oracle下导出某用户所有表的方法
- Oracle下导出某用户所有表的方法
- Oracle下导出某用户所有表的方法(备份)
- Oracle下导出某用户所有表的方法
- 关于EXP-00056: 遇到 ORACLE 错误 1455 ORA-01455: 转换列溢出整数数据类型 EXP-00000: 导出终止失败 的问题解决方法整理
- oracle创建表空间,用户和导入导出
- Oracle 用户权限管理方法
- Oracle 用户权限管理方法
- Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- ORACLE EXP不能导出空表的原因分析及解决方法
- oracle 10g 为新建用户并赋予所有表操作权限的方法
- 【方法】Oracle用户密码含特殊字符时的登陆问题
- 浅析Oracle用户权限分配的具体方法
- Oracle创建删除用户、角色、表空间、导入导出、...命令总结
- oracle数据库导出和oracle导入数据的二种方法(oracle导入导出数据)
- oracle 导入导出数据库、删除用户以及该用户所有的对象
- ORACLE删除当前用户下所有的表的方法