• Oracle空表导出解决方法


    第一种方法:

    先查询一下当前用户下的所有空表

    select table_name from user_tables where NUM_ROWS=0;

    用以下这句查找空表

    select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0

    把查询结果导出,执行导出的语句

    'ALTERTABLE'||TABLE_NAME||'ALLOCATEEXTENT;'
    -----------------------------------------------------------
    alter table AQ$_AQ$_MEM_MC_H allocate extent;
    alter table AQ$_AQ$_MEM_MC_G allocate extent;
    alter table AQ$_AQ$_MEM_MC_I allocate extent;
    alter table AQ$_AQ_PROP_TABLE_T allocate extent;
    alter table AQ$_AQ_PROP_TABLE_H allocate extent;
    alter table AQ$_AQ_PROP_TABLE_G allocate extent;
    alter table AQ$_AQ_PROP_TABLE_I allocate extent;
    alter table AQ$_KUPC$DATAPUMP_QUETAB_T allocate extent;
    alter table AQ$_KUPC$DATAPUMP_QUETAB_H allocate extent;
    alter table AQ$_KUPC$DATAPUMP_QUETAB_G allocate extent;
    alter table AQ$_KUPC$DATAPUMP_QUETAB_I allocate extent;

    'ALTERTABLE'||TABLE_NAME||'ALLOCATEEXTENT;'
    -----------------------------------------------------------
    alter table AQ$_SYS$SERVICE_METRICS_TAB_T allocate extent;
    alter table AQ$_SYS$SERVICE_METRICS_TAB_H allocate extent;
    alter table AQ$_SYS$SERVICE_METRICS_TAB_G allocate extent;
    alter table AQ$_SYS$SERVICE_METRICS_TAB_I allocate extent;

    导出数据命令

    exp 用户名/密码@数据库名 file=/home/oracle/exp.dmp log=/home/oracle/exp_smsrun.log

    第二种方法:

    show parameter deferred_segment_creation
    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    deferred_segment_creation boolean TRUE
    SQL> alter system set deferred_segment_creation=false;

    系统已更改。

    SQL> show parameter deferred_segment_creation

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    deferred_segment_creation boolean FALSE

    该参数值默认是TRUE,当改为FALSE时,无论是空表还是非空表,都分配segment。

    需注意的是:该值设置后对以前导入的空表不产生作用,仍不能导出,只能对后面新增的表产生作用。如需导出之前的空表,只能用第一种方法。

    第三种方法:

    (1)select 'alter table '||table_name||' allocate extent;'
    from user_tables WHERE SEGMENT_CREATED='NO';
    (2)select * from user_indexes WHERE SEGMENT_CREATED='NO';
    (3)select * from user_lobs where segment_created='NO';

  • 相关阅读:
    [NOI2008] 糖果雨
    [NOI2006] 神奇口袋
    [NOI2014] 购票
    Prince and Princess HDU
    Network POJ
    CodeForces
    Codeforces Global Round 12
    Codeforces Round #688 (Div. 2)
    [USACO05DEC]Layout G
    # Technocup 2021
  • 原文地址:https://www.cnblogs.com/liyingxian5/p/6549438.html
Copyright © 2020-2023  润新知