是否可以将自定义元数据字段添加到Oracle Data Dictionary?

发布于 2025-01-24 14:03:50 字数 557 浏览 3 评论 0原文

是否可以在列级(Oracle Data Dictionary)上添加元数据字段?

目的是持有一个标志,以识别表中单个数据项被匿名化的位置。

我是一名分析师(不是DBA),我正在使用Oracle SQL开发人员表面(并启用查询)column_name,data_type,nullable,data_default,column_id,data_default,column_id和我们的Oracle DB的元数据字段(请参阅PIC)。

我希望在此级别上添加另一个元数据字段(本质上是添加第二个“注释”字段)以保存“匿名”标志,以支持轻松查询我们标记的匿名数据。

如果有可能(建议 /支持),我将感谢任何建议描述启用此步骤所需的步骤,然后我可以与开发人员和DBA进行讨论。

Is it possible to add a metadata field at column-level (in the Oracle Data Dictionary)?

The purpose would be to hold a flag identifying where individual data items in a table have been anonymised.

I'm an analyst (not a DBA) and I'm using Oracle SQL Developer which surfaces (and enables querying of) the COLUMN_NAME, DATA_TYPE, NULLABLE, DATA_DEFAULT, COLUMN_ID, and COMMENTS metadata fields of our Oracle DB (see pic).

Screenshot of Data Dictionary fields in Oracle SQL Developer

I'd be looking to add another metadata field at this level (essentially, to add a second 'COMMENTS' field) to hold the 'Anonymisation' flag, to support easy querying of our flagged-anonymised data.

If it's possible (and advisable / supportable), I'd be grateful for any advice for describing the steps required to enable this, which I can then discuss with our Developer and DBA.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

陌伤浅笑 2025-01-31 14:03:51

简短答案:否。

但是您可以在哪里保留这些信息?

在您的数据模型中。

Oracle提供了免费的数据建模解决方案,Oracle SQL开发人员数据建模器。它提供了将表/视图列标记为敏感或PII的能力。

这些相同的型号可以存储在您的数据库中,因此可以通过SQL访问它们。

一旦您标记了所有敏感属性/列,然后将其存储回数据库,就可以将其查询。

免责声明:我为Oracle工作,我是Data Modeler的产品经理。

Short answer: NO.

But where could you keep that information?

In your data model.

Oracle provides a free data modeling solution, Oracle SQL Developer Data Modeler. It provides the ability to mark table/view columns as sensitive or PII.

Those same models can be stored back in your database so they can be accessed via SQL.

enter image description here

Once you've marked up all of your sensitive attributes/columns, and store it back into the database, you can query it back out.

enter image description here

Disclaimer: I work for Oracle, I'm the product manager for Data Modeler.

胡渣熟男 2025-01-31 14:03:51

[TL; dr]不要这样做。找到另一种方式。


如果建议使用

不要

修改数据字典; (除非Oracle Support告诉您)您可能会使您与Oracle的支持合同无效,并且可能会破坏数据库并使其无法使用。

如果可能

请不要这样做。

如果您真的想尝试一下,那仍然不要。

请找到一个您不在乎的数据库(不在乎bit很重要!),并登录为sysdba user和:

ALTER TABLE whichever_data_dictionary_table ADD anonymisation_flag VARCHAR2(10);

如果您真的很想尝试一下, 测试数据库是否断开(并且可能不会立即破裂,但以后在某个时候破裂),但是如果这样做,您几乎可以肯定的是,您不会从Oracle上获得任何支持。

我们是否说:“不要做” ...我们的意思是。

[TL;DR] Don't do it. Find another way.


If it's advisable

NO

Never modify the data dictionary; (unless Oracle support tells you to) you are likely to invalidate your support contract with Oracle and may break the database and make it unusable.

If it's possible

Don't do this.

If you really want to try it then still don't.

If you really, really want to try it then find a database you don't care about (the don't care about bit is important!) and log on as a SYSDBA user and:

ALTER TABLE whichever_data_dictionary_table ADD anonymisation_flag VARCHAR2(10);

Then you can test whether the database breaks (and it may not break immediately but at some point later), but if it does then you almost certainly will not get any support from Oracle in fixing it.

Did we say, "Don't do it"... we mean it.

烏雲後面有陽光 2025-01-31 14:03:51

如您所知,您不应该这样做。

但是,没有什么可以阻止您创建自己的表格,该表将包含这样的信息。

例如:

SQL> CREATE TABLE my_comments
  2  (
  3     table_name      VARCHAR2 (30),
  4     column_name     VARCHAR2 (30),
  5     anonymisation   VARCHAR2 (10)
  6  );

Table created.

用一些数据填充它:

SQL> insert into my_comments (table_name, column_name)
  2    select table_name, column_name
  3    from user_tab_columns
  4    where table_name = 'DEPT';

3 rows created.

设置匿名标志:

SQL> update my_comments set anonymisation = 'F' where column_name = 'DEPTNO';

1 row updated.

当您要获取此类信息时(以及来自user_tab_columns的更多数据,请使用(ofter)(outer)加入:

SQL> select u.table_name, u.column_name, u.data_type, u.nullable, m.anonymisation
  2  from user_tab_columns u left join my_comments m on m.table_name = u.table_name
  3                                                 and m.column_name = u.column_name
  4  where u.column_name = 'DEPTNO';

TABLE_NAME COLUMN_NAME     DATA_TYPE    N ANONYMISATION
---------- --------------- ------------ - ---------------
DEPT       DEPTNO          NUMBER       N F
DSV        DEPTNO          NUMBER       N
DSMV       DEPTNO          NUMBER       Y
EMP        DEPTNO          NUMBER       Y

SQL>

优势:您不会:打破数据库&您将拥有其他信息

:您必须手动维护表。

As you already know, you shouldn't do that.

But, nothing prevents you from creating your own table which will contain such an info.

For example:

SQL> CREATE TABLE my_comments
  2  (
  3     table_name      VARCHAR2 (30),
  4     column_name     VARCHAR2 (30),
  5     anonymisation   VARCHAR2 (10)
  6  );

Table created.

Populate it with some data:

SQL> insert into my_comments (table_name, column_name)
  2    select table_name, column_name
  3    from user_tab_columns
  4    where table_name = 'DEPT';

3 rows created.

Set the anonymisation flag:

SQL> update my_comments set anonymisation = 'F' where column_name = 'DEPTNO';

1 row updated.

When you want to get such an info (along with some more data from user_tab_columns, use (outer) join:

SQL> select u.table_name, u.column_name, u.data_type, u.nullable, m.anonymisation
  2  from user_tab_columns u left join my_comments m on m.table_name = u.table_name
  3                                                 and m.column_name = u.column_name
  4  where u.column_name = 'DEPTNO';

TABLE_NAME COLUMN_NAME     DATA_TYPE    N ANONYMISATION
---------- --------------- ------------ - ---------------
DEPT       DEPTNO          NUMBER       N F
DSV        DEPTNO          NUMBER       N
DSMV       DEPTNO          NUMBER       Y
EMP        DEPTNO          NUMBER       Y

SQL>

Advantages: you won't break the database & you'll have your additional info.

Drawbacks: you'll have to maintain the table manually.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文