轻松解决oracle11g 空表不能 exp 导出 的问题
2014-02-20 19:06
591 查看
oracle11g的新特性,数据条数是0时不分配segment,所以就不能被导出。
解决方法:
1插入一条数据(或者再删除),浪费时间,有时几百张表会累死的。
2创建数据库之前
使用代码:
alter system set deferred_segment_creation=false;
调整再建表
这两种方都不好
下面是终极方法:
先查询一下哪些表是空的:
select table_name from user_tables where NUM_ROWS=0;
下面我们通过select 来生成修改语句:
select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0
然后就在结果窗口里面生成了下面那些东西:
alter table E2USER_STATE allocate extent;
ok 执行上面那些sql,之后再exp-------------------------------------
数据导出:
1 将数据库SampleDB完全导出,用户名system 密码manager 导出到E:/SampleDB.dmp中
exp system/manager@TestDB file=E:/sampleDB.dmp full=y
2 将数据库中system用户与sys用户的表导出
exp system/manager@TestDB file=E:/sampleDB.dmp owner=(system,sys)
3 将数据库中的表 TableA,TableB 导出
exp system/manager@TestDB file=E:/sampleDB.dmp tables=(TableA,TableB)
4 将数据库中的表tableA中的字段filed1 值为 "王五" 的数据导出
exp system/manager@TestDB file=E:/sampleDB.dmp tables=(tableA) query=' where filed1='王五'
如果想对dmp文件进行压缩,可以在上面命令后面 加上 compress=y 来实现。
数据的导入
1 将备份数据库文件中的数据导入指定的数据库SampleDB 中,如果 SampleDB 已存在该表,则不再导入;
imp system/manager@TEST file=E:/sampleDB.dmp full=y ignore=y
2 将d:/daochu.dmp中的表table1 导入
imp system/manager@TEST file=E:/sampleDB.dmp tables=(table1)
3. 导入一个完整数据库
imp system/manager file=bible_db log=dible_db full=y ignore=y
4. 导入一个或一组指定用户所属的全部表、索引和其他对象
imp system/manager file=seapark log=seapark fromuser=seapark imp
system/manager file=seapark log=seapark fromuser=(seapark,amy,amyc,harold)
5. 将一个用户所属的数据导入另一个用户
imp system/manager file=tank log=tank fromuser=seapark touser=seapark_copy
imp system/manager file=tank log=tank fromuser=(seapark,amy)
touser=(seapark1, amy1)
6. 导入一个表
imp system/manager file=tank log=tank fromuser=seapark TABLES=(a,b)
7. 从多个文件导入
imp system/manager file=(paycheck_1,paycheck_2,paycheck_3,paycheck_4)
log=paycheck, filesize=1G full=y
8. 使用参数文件
imp system/manager parfile=bible_tables.par
bible_tables.par参数文件:
#Import the sample tables used for the Oracle8i Database Administrator's
Bible. fromuser=seapark touser=seapark_copy file=seapark log=seapark_import
参数文件示例见附录
9. 增量导入
imp system./manager inctype= RECTORE FULL=Y FILE=A
不少情况下要先将表彻底删除,然后导入。
解决方法:
1插入一条数据(或者再删除),浪费时间,有时几百张表会累死的。
2创建数据库之前
使用代码:
alter system set deferred_segment_creation=false;
调整再建表
这两种方都不好
下面是终极方法:
先查询一下哪些表是空的:
select table_name from user_tables where NUM_ROWS=0;
下面我们通过select 来生成修改语句:
select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0
然后就在结果窗口里面生成了下面那些东西:
alter table E2USER_STATE allocate extent;
ok 执行上面那些sql,之后再exp-------------------------------------
数据导出:
1 将数据库SampleDB完全导出,用户名system 密码manager 导出到E:/SampleDB.dmp中
exp system/manager@TestDB file=E:/sampleDB.dmp full=y
2 将数据库中system用户与sys用户的表导出
exp system/manager@TestDB file=E:/sampleDB.dmp owner=(system,sys)
3 将数据库中的表 TableA,TableB 导出
exp system/manager@TestDB file=E:/sampleDB.dmp tables=(TableA,TableB)
4 将数据库中的表tableA中的字段filed1 值为 "王五" 的数据导出
exp system/manager@TestDB file=E:/sampleDB.dmp tables=(tableA) query=' where filed1='王五'
如果想对dmp文件进行压缩,可以在上面命令后面 加上 compress=y 来实现。
数据的导入
1 将备份数据库文件中的数据导入指定的数据库SampleDB 中,如果 SampleDB 已存在该表,则不再导入;
imp system/manager@TEST file=E:/sampleDB.dmp full=y ignore=y
2 将d:/daochu.dmp中的表table1 导入
imp system/manager@TEST file=E:/sampleDB.dmp tables=(table1)
3. 导入一个完整数据库
imp system/manager file=bible_db log=dible_db full=y ignore=y
4. 导入一个或一组指定用户所属的全部表、索引和其他对象
imp system/manager file=seapark log=seapark fromuser=seapark imp
system/manager file=seapark log=seapark fromuser=(seapark,amy,amyc,harold)
5. 将一个用户所属的数据导入另一个用户
imp system/manager file=tank log=tank fromuser=seapark touser=seapark_copy
imp system/manager file=tank log=tank fromuser=(seapark,amy)
touser=(seapark1, amy1)
6. 导入一个表
imp system/manager file=tank log=tank fromuser=seapark TABLES=(a,b)
7. 从多个文件导入
imp system/manager file=(paycheck_1,paycheck_2,paycheck_3,paycheck_4)
log=paycheck, filesize=1G full=y
8. 使用参数文件
imp system/manager parfile=bible_tables.par
bible_tables.par参数文件:
#Import the sample tables used for the Oracle8i Database Administrator's
Bible. fromuser=seapark touser=seapark_copy file=seapark log=seapark_import
参数文件示例见附录
9. 增量导入
imp system./manager inctype= RECTORE FULL=Y FILE=A
不少情况下要先将表彻底删除,然后导入。
相关文章推荐
- 轻松解决oracle11g 空表不能 exp 导出 的问题。
- 轻松解决oracle11g 空表不能exp导出的问题
- 轻松解决oracle11g 空表不能exp导出的问题。
- 轻松解决oracle11g 空表不能 exp 导出 的问题
- 轻松解决oracle11g 空表不能exp导出的问题
- 轻松解决oracle11g 空表不能 exp 导出 的问题
- 轻松解决oracle11g 空表不能exp导出的问题
- 轻松解决oracle11g 空表不能exp导出的问题
- 轻松解决oracle11g 空表不能 exp 导出 的问题。
- 轻松解决oracle11g 空表不能exp导出的问题。
- 轻松解决oracle11g 空表不能exp导出的问题。
- [转]轻松解决oracle11g 空表不能exp导出的问题
- 轻松解决oracle11g 空表不能exp导出的问题。
- 解决oracle11g 空表不能exp导出的问题
- 解决oracle11g 空表不能exp导出的问题
- 解决oracle11g 空表不能exp导出的问题
- 解决oracle11g 空表不能exp导出的问题
- 解决oracle 11G exp 不能导出空表问题
- Oracle11g使用exp导出表不全问题的原因和解决办法
- 解决Oracle 11g在用EXP导出时,空表不能导出的问题