威凡网全力打造:网页编程、软件开发编程、平面设计、服务器端开发、操作系统等在线学习平台!学编程,上威凡网!
PHP教程>> PHP基础 PHP技巧 PHP实例 PHP文摘 PHP模板 PHP总结
当前位置:首页 > PHP教程 > PHP总结
上一节 下一节
 如何在oracle11g中导出空表

如何在oracle 11g 中导出空表 由于oracle 11g的 延迟段创建的新特性,导致在没有数据插入时,oracle是不会分配数据段的,进而导致exp 是不能导出11g数据库的空表的。 当然采用expdp就不存在这个问题了。 expdp hr/hr schemas=hr dumpfile=expdp.dmp director

  如何在oracle 11g 中导出空表

  由于oracle 11g的 延迟段创建的新特性,导致在没有数据插入时,oracle是不会分配数据段的,进而导致exp 是不能导出11g数据库的空表的。

  当然采用expdp就不存在这个问题了。

  expdp hr/hr schemas=hr dumpfile=expdp.dmp directory=dbtest

  conn hr/hr

  select table_name,num_rows from user_tables;

  table_name num_rows

  ------------------------------ ----------

  locations 23

  emp_1 0

  part_time_employees 0

  test3 5

  test1 5

  test 5

  pc_well_test 2

  pc_alarm_sort_test 1

  mview_pc_well_test 2

  mv_capabilities_table 14

  t 0

  test2

  sys_export_schema_01

  sys_export_schema_02

  hourly_employees 0

  countries 25

  admin_ext_employees

  admin_work_area

  employees 107

  departments 27

  digits 2

  regions 4

  job_history 10

  jobs 19

  24 rows selected.

  为什么这里的num_rows为空呢?

  那是因为表刚建立,数据字典中还没有这个表相关的统计信息呢。

  sql> select 'alter table '||table_name||' allocate extent;' from user_tables where

  num_rows=0

  'altertable'||table_name||'allocateextent;'

  -----------------------------------------------------------

  alter table part_time_employees allocate extent;

  alter table emp_1 allocate extent;

  alter table t allocate extent;

  alter table hourly_employees allocate extent;

  所以对于网上一些在oracle11g上先使用手工分配extent 再使用exp来导数据库,在实际上效果不怎么地,反而是多次一举直接使用expdp来导oracle 11g数据库中空表来的方便多了。

  当然对那些要从11g导低版本,还是可以的采用这个办法,,但是要注意,要么对所有相关的表进行分析系,然后使用上述那个批量脚本。或者不分析表,直接手工用ue编辑分配extent的命令。

  sql> select table_name,num_rows from user_tables where num_rows=0;

  table_name num_rows

  ------------------------------ ----------

  part_time_employees 0

  emp_1 0

  t 0

  hourly_employees 0

  补充信息:

  user_tables describes the relational tables owned by the current user. its columns (except

  for owner) are the same as those in all_tables. to gather statistics for this view, use the

  dbms_stats package.

  收集表的统计信息:

  analyze table xxx compute statistics;

  or

  exec dbma_stats.gather_table_stats('user', 'table');

.syntaxhighlighter{padding-top:20px;padding-bottom:20px;}
申明:本教程内容由威凡网编辑整理并提供IT程序员分享学习,如文中有侵权行为,请与站长联系(QQ:254677821)!
上一节 下一节
相关教程  
其他教程  
PHP基础
PHP技巧
PHP实例
PHP文摘
PHP模板
PHP总结

违法和不良信息举报中心】邮箱:254677821@qq.com
Copyright©威凡网 版权所有 苏ICP备2023020142号
站长QQ:254677821