oracle删除所有的表
在我们不想删除数据库和用户的时候,但是需要删除所有的表的时候,可以如下处理:1.查询表名,拼接sql。select 'drop table ' || table_name || ';'from catwhere table_type = 'TABLE' ;2.查出结果,将结果复制出来,粘贴到sql窗口里面。3.,(执行删除语句之前一定要确保做好备份或者其他确认措施)检查无误以后,执行语句。...
·
在我们不想删除数据库和用户的时候,但是需要删除所有的表的时候,可以如下处理:
1.查询表名,拼接sql。
select 'drop table ' || table_name || ';'
from cat
where table_type = 'TABLE' ;
2.查出结果,将结果复制出来,粘贴到sql窗口里面。
3.(执行删除语句之前一定要确保做好备份或者其他确认措施)检查无误以后,执行语句。
另外查询所有的表的方法有:
-- CAT等同于USER_CATALOG
select * from user_catalog where table_type = 'TABLE' order by table_name asc;
-- TAB为sys用户下的视图,和CAT查出来的内容类似
select * from tab where tabtype = 'TABLE';
-- 用户自己的关系表,查出来的数据比上面的语句查出来的少
select table_name from user_tables;
-- desc作为降序排序的关键字,按照COLCODE 列降序展示表数据
-- desc也可以查看表的结构,错误用法: 直接在Plsql的sql窗口中执行,会报错。正确用法:新建command window(命令窗口),执行 desc 表名称。
desc xxx_table;
-- 查询数据字典视图
select * from dict where table_name='CAT';
1 CAT Synonym for USER_CATALOG
select * from dict where table_name='USER_CATALOG';
1 USER_CATALOG Tables, Views, Synonyms and Sequences owned by the user
select * from dict where table_name='USER_TABLES';
1 USER_TABLES Description of the user's own relational tables
更多推荐
已为社区贡献2条内容
所有评论(0)