oracle 11g 备份包含空表

阅读更多

默认情况下,使用exp命令备份数据库时不包含空表,想要包含空表需要进行处理如下:

 

批量处理空表

       首先使用下面的sql语句查询一下当前用户下的所有空表

select table_name from user_tables where NUM_ROWS=0;

  然后用一下SQL语句执行查询

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

  假设我们这里有空表TBL_1,TBL_2,TBL_3,TBL_4,则查询结果如下:

alter table TBL_1 allocate extent;
alter table TBL_2 allocate extent;
alter table TBL_3 allocate extent;
alter table TBL_4 allocate extent;

  最后我们把上面的SQL语句执行就可以了。

你可能感兴趣的:(oracle 11g 备份包含空表)