ORACLE 11G使用exp或者pl/sql导出空表

2024-06-19 19:18

本文主要是介绍ORACLE 11G使用exp或者pl/sql导出空表,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

oracle在11G这个版本中增添了一个新的参数:deferred_segment_creation,默认值为true,作用是延迟建表,对于新建之后从未插入过数据的表(插入数据后又删除所有数据的表不在此列)。可将其设置成false来让之后的表不使用延迟建表,但对于之前的表没用。在此提供一种其他方法的补充:
使用:select ‘alter table ‘||table_name||’ allocate extent;’ from user_tables where num_rows=0语句查出结果,结果中就是新建后未添加过诗句的表,将结果保存。
我保存成了.sql文件,内容如下:

prompt Importing table user_tables...
set feedback off
set define off
alter table COM_CONTACT_MECH allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_ATTRIBUTE allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_CONTACT_MECH allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_IDENTIFICATION allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_ROLE allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_PARTY_STATUS allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table COM_ROLE_TYPE allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_RR_PROFILE allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_RR_PROFILE_RELA allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_RR_PROFILR_DETAIL allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_CHGPASS_REC allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_EXCLUSE_ITEM allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LEVEL_GRANT_DEPTS allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LEVEL_GRANT_OBJECTS allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LEVEL_GRANT_ROLES allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LOCK_ACCOUNTS allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LOGIN_EXT allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_LOGIN_LIMIT allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_NEED_APPROVE_ROLE allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_ROLE_APPROVE_RECORD allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_ROLE_RIGHT allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_R_SAFE_POLICY allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ACCOUNTS_DESKTOP allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ACCOUNTS_WIDGETS allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ACCOUNT_SHORT_CUT allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_CACHE_REFRESH_DATE allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_CONSIGN_REC allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_CQ_COND allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_CQ_COND_DEF allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_DROPBEAN_REFRESH_DATE allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ENTITY_AUDIT allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_HELP_BOOKMARK allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_MODIFY_DETAIL allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_MODIFY_LOG allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_OBJECT_CONSIGN allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_PROPERTY_AUDIT allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_REMOTE_APP allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_REMOTE_MENU allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ROLE_CONSIGN allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_ROLE_GROUP allocate extent;');insert into user_tables ('ALTERTABLE'||TABLE_NAME||'ALL)
values ('alter table EP_SYS_TABLE_INFO allocate extent;');prompt Done.

直接执行这个文件是报错的,需要修改成如下格式:

alter table COM_CONTACT_MECH allocate extent;alter table COM_PARTY_ATTRIBUTE allocate extent;alter table COM_PARTY_CONTACT_MECH allocate extent;alter table COM_PARTY_IDENTIFICATION allocate extent;alter table COM_PARTY_ROLE allocate extent;alter table COM_PARTY_STATUS allocate extent;alter table COM_ROLE_TYPE allocate extent;alter table EP_RR_PROFILE allocate extent;alter table EP_RR_PROFILE_RELA allocate extent;alter table EP_RR_PROFILR_DETAIL allocate extent;alter table EP_R_CHGPASS_REC allocate extent;alter table EP_R_EXCLUSE_ITEM allocate extent;alter table EP_R_LEVEL_GRANT_DEPTS allocate extent;alter table EP_R_LEVEL_GRANT_OBJECTS allocate extent;alter table EP_R_LEVEL_GRANT_ROLES allocate extent;alter table EP_R_LOCK_ACCOUNTS allocate extent;alter table EP_R_LOGIN_EXT allocate extent;alter table EP_R_LOGIN_LIMIT allocate extent;alter table EP_R_NEED_APPROVE_ROLE allocate extent;alter table EP_R_ROLE_APPROVE_RECORD allocate extent;alter table EP_R_ROLE_RIGHT allocate extent;alter table EP_R_SAFE_POLICY allocate extent;alter table EP_SYS_ACCOUNTS_DESKTOP allocate extent;alter table EP_SYS_ACCOUNTS_WIDGETS allocate extent;alter table EP_SYS_ACCOUNT_SHORT_CUT allocate extent;alter table EP_SYS_CACHE_REFRESH_DATE allocate extent;alter table EP_SYS_CONSIGN_REC allocate extent;alter table EP_SYS_CQ_COND allocate extent;alter table EP_SYS_CQ_COND_DEF allocate extent;alter table EP_SYS_DROPBEAN_REFRESH_DATE allocate extent;alter table EP_SYS_ENTITY_AUDIT allocate extent;alter table EP_SYS_HELP_BOOKMARK allocate extent;alter table EP_SYS_MODIFY_DETAIL allocate extent;alter table EP_SYS_MODIFY_LOG allocate extent;alter table EP_SYS_OBJECT_CONSIGN allocate extent;alter table EP_SYS_PROPERTY_AUDIT allocate extent;alter table EP_SYS_REMOTE_APP allocate extent;alter table EP_SYS_REMOTE_MENU allocate extent;alter table EP_SYS_ROLE_CONSIGN allocate extent;alter table EP_SYS_ROLE_GROUP allocate extent;alter table EP_SYS_TABLE_INFO allocate extent;

执行修改后的文件之后,再用exp或者pl/sql导出的时候就能将空表导出了。

这篇关于ORACLE 11G使用exp或者pl/sql导出空表的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1075911

相关文章

SQL server数据库如何下载和安装

《SQLserver数据库如何下载和安装》本文指导如何下载安装SQLServer2022评估版及SSMS工具,涵盖安装配置、连接字符串设置、C#连接数据库方法和安全注意事项,如混合验证、参数化查... 目录第一步:打开官网下载对应文件第二步:程序安装配置第三部:安装工具SQL Server Manageme

C#连接SQL server数据库命令的基本步骤

《C#连接SQLserver数据库命令的基本步骤》文章讲解了连接SQLServer数据库的步骤,包括引入命名空间、构建连接字符串、使用SqlConnection和SqlCommand执行SQL操作,... 目录建议配合使用:如何下载和安装SQL server数据库-CSDN博客1. 引入必要的命名空间2.

使用Python删除Excel中的行列和单元格示例详解

《使用Python删除Excel中的行列和单元格示例详解》在处理Excel数据时,删除不需要的行、列或单元格是一项常见且必要的操作,本文将使用Python脚本实现对Excel表格的高效自动化处理,感兴... 目录开发环境准备使用 python 删除 Excphpel 表格中的行删除特定行删除空白行删除含指定

全面掌握 SQL 中的 DATEDIFF函数及用法最佳实践

《全面掌握SQL中的DATEDIFF函数及用法最佳实践》本文解析DATEDIFF在不同数据库中的差异,强调其边界计算原理,探讨应用场景及陷阱,推荐根据需求选择TIMESTAMPDIFF或inte... 目录1. 核心概念:DATEDIFF 究竟在计算什么?2. 主流数据库中的 DATEDIFF 实现2.1

MySQL 多列 IN 查询之语法、性能与实战技巧(最新整理)

《MySQL多列IN查询之语法、性能与实战技巧(最新整理)》本文详解MySQL多列IN查询,对比传统OR写法,强调其简洁高效,适合批量匹配复合键,通过联合索引、分批次优化提升性能,兼容多种数据库... 目录一、基础语法:多列 IN 的两种写法1. 直接值列表2. 子查询二、对比传统 OR 的写法三、性能分析

深入理解Go语言中二维切片的使用

《深入理解Go语言中二维切片的使用》本文深入讲解了Go语言中二维切片的概念与应用,用于表示矩阵、表格等二维数据结构,文中通过示例代码介绍的非常详细,需要的朋友们下面随着小编来一起学习学习吧... 目录引言二维切片的基本概念定义创建二维切片二维切片的操作访问元素修改元素遍历二维切片二维切片的动态调整追加行动态

MySQL中的LENGTH()函数用法详解与实例分析

《MySQL中的LENGTH()函数用法详解与实例分析》MySQLLENGTH()函数用于计算字符串的字节长度,区别于CHAR_LENGTH()的字符长度,适用于多字节字符集(如UTF-8)的数据验证... 目录1. LENGTH()函数的基本语法2. LENGTH()函数的返回值2.1 示例1:计算字符串

prometheus如何使用pushgateway监控网路丢包

《prometheus如何使用pushgateway监控网路丢包》:本文主要介绍prometheus如何使用pushgateway监控网路丢包问题,具有很好的参考价值,希望对大家有所帮助,如有错误... 目录监控网路丢包脚本数据图表总结监控网路丢包脚本[root@gtcq-gt-monitor-prome

SpringBoot+EasyExcel实现自定义复杂样式导入导出

《SpringBoot+EasyExcel实现自定义复杂样式导入导出》这篇文章主要为大家详细介绍了SpringBoot如何结果EasyExcel实现自定义复杂样式导入导出功能,文中的示例代码讲解详细,... 目录安装处理自定义导出复杂场景1、列不固定,动态列2、动态下拉3、自定义锁定行/列,添加密码4、合并

Python通用唯一标识符模块uuid使用案例详解

《Python通用唯一标识符模块uuid使用案例详解》Pythonuuid模块用于生成128位全局唯一标识符,支持UUID1-5版本,适用于分布式系统、数据库主键等场景,需注意隐私、碰撞概率及存储优... 目录简介核心功能1. UUID版本2. UUID属性3. 命名空间使用场景1. 生成唯一标识符2. 数