如何仅列出我在Oracle SQL中创建的表? [英] How to list ONLY the tables I've created in Oracle SQL?

查看:85
本文介绍了如何仅列出我在Oracle SQL中创建的表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用SQL Plus的初学者,所以这听起来像是一个愚蠢的问题,但我真的不知道该怎么做.我找不到查看我创建的所有表的方法.我尝试了很多命令,例如

I am a beginner using SQL Plus, so this might sound like a stupid question but I really don't know how to do it. I cannot find a way to view all the tables I've created. I try a large number of commands like

SELECT owner, table_name
  FROM dba_tables`

SELECT table_name
  FROM user_tables

但是我总是以数千个结果结尾. 执行第一个命令后的图片

But i always end with a few thousand results. Pic after executing the first command

SELECT owner, table_name
  FROM dba_tables

基本上,自从我开始使用SQL Plus以来,我创建了大约15个表,而我忘记了一些名称.我想有一种方法可以只检查我创建的表,而不必在那里有数千个其他不必要的名称. 有人知道该怎么做吗?我将补充一点,我正在使用SYSTEM用户和oracle express.

Basically i created about 15 tables since i started using SQL Plus, and i forgot some of the names. I would like to have a way to check just the tables I created, without having a few thousand unnecessary other names in there. Does anybody know how to do that? I will add that i'm using the SYSTEM user and oracle express.

推荐答案

首先,您应该停止使用SYSTEM帐户.这仅适用于Oracle数据库.创建并使用一个新的数据库用户,您将比现在更省时省力.

First of all, you should stop using the SYSTEM account. That is for the Oracle database only. Create and use a new database user and you will save yourself many headaches worse than your current one.

要解决当前的问题,您想开箱即用地过滤出SYSTEM拥有的成千上万的表". (我的意思是成千上万-我从未数过它们.)

To solve your current problem, you want to filter out the "thousands of tables" that are owned by SYSTEM out of the box. (I'm taking your word it's thousands -- I have never counted them).

一个主意是:

SELECT object_name
FROM   dba_objects
WHERE  object_type = 'TABLE'
AND    owner = 'SYSTEM'
AND    created >= to_date('01-JAN-2018','DD-MON-YYYY')

...用开始使用SQL * Plus的日期替换2018年1月1日,希望不是安装数据库的同一天(否则可能无法正常工作)好)!

... replacing 01-JAN-2018 with the date when you started using SQL*Plus, which hopefully wasn't the same day that the database was installed (or else this might not work well)!

这篇关于如何仅列出我在Oracle SQL中创建的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆