Oracle中如何排除和查找RecycleBin的值
How to exclude and lookup the value of RecycleBin in Oracle
在Oracle 11g中查询约束时,执行如下查询。
SELECT
CC.OWNER as "owner"
, CC.TABLE_NAME as "tableName"
, CC.COLUMN_NAME as "columnName"
, CC.CONSTRAINT_NAME as "constraintName"
, CC.POSITION as "position"
FROM ALL_CONS_COLUMNS CC
WHERE CC.OWNER IN ('<schemaName>')
ORDER BY CC.POSITION ASC;
但是recyclebin中的数据也被搜索到如下图。
(作为参考,下图中的所有者是架构名称Docker。)
我 运行 Mac OS Docker。是不是因为是Docker环境才出现?
我根本不需要这些数据,所以我想看看。
除了使用 purge recyclebin 命令清除回收站中的数据之外,还有什么方法吗?
您可能会使用这样一个事实,即 ALL_TABLES 不会 return 已 删除 的表,所以OWNER, TABLE_NAME
上的简单 inner join 将进行消除:
SELECT
CC.OWNER as "owner"
, CC.TABLE_NAME as "tableName"
, CC.COLUMN_NAME as "columnName"
, CC.CONSTRAINT_NAME as "constraintName"
, CC.POSITION as "position"
FROM ALL_CONS_COLUMNS CC
JOIN ALL_TABLES T on T.OWNER = CC.OWNER and T.TABLE_NAME = CC.TABLE_NAME /* Added line */
WHERE CC.OWNER IN ('REPORTER')
ORDER BY CC.POSITION ASC;
在Oracle 11g中查询约束时,执行如下查询。
SELECT
CC.OWNER as "owner"
, CC.TABLE_NAME as "tableName"
, CC.COLUMN_NAME as "columnName"
, CC.CONSTRAINT_NAME as "constraintName"
, CC.POSITION as "position"
FROM ALL_CONS_COLUMNS CC
WHERE CC.OWNER IN ('<schemaName>')
ORDER BY CC.POSITION ASC;
但是recyclebin中的数据也被搜索到如下图。 (作为参考,下图中的所有者是架构名称Docker。)
我 运行 Mac OS Docker。是不是因为是Docker环境才出现?
我根本不需要这些数据,所以我想看看。
除了使用 purge recyclebin 命令清除回收站中的数据之外,还有什么方法吗?
您可能会使用这样一个事实,即 ALL_TABLES 不会 return 已 删除 的表,所以OWNER, TABLE_NAME
上的简单 inner join 将进行消除:
SELECT
CC.OWNER as "owner"
, CC.TABLE_NAME as "tableName"
, CC.COLUMN_NAME as "columnName"
, CC.CONSTRAINT_NAME as "constraintName"
, CC.POSITION as "position"
FROM ALL_CONS_COLUMNS CC
JOIN ALL_TABLES T on T.OWNER = CC.OWNER and T.TABLE_NAME = CC.TABLE_NAME /* Added line */
WHERE CC.OWNER IN ('REPORTER')
ORDER BY CC.POSITION ASC;