当前位置: 首页 > news >正文

Oracle Data Redaction和Oracle Data Pump

本实验的使用环境基于之前的博客:一个简单的Oracle Redaction实验

本实验参考文档为15.14 Oracle Data Redaction and Oracle Data Pump

先创建directory并赋权:

-- connect to database or pluggable database
alter session set container=orclpdb1;
CREATE OR REPLACE DIRECTORY test_dir AS '/u01/app/oracle/oradata/';
GRANT READ, WRITE ON DIRECTORY test_dir TO schema_user;

先以schema_user用数据泵导出:

$ expdp schema_user@orclpdb1 tables=employees directory=TEST_DIR dumpfile=expdp.dmpExport: Release 19.0.0.0.0 - Production on Mon Nov 20 08:13:33 2023
Version 19.20.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.
Password:Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Starting "SCHEMA_USER"."SYS_EXPORT_TABLE_01":  schema_user/********@orclpdb1 tables=employees directory=TEST_DIR dumpfile=expdp.dmp
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
Processing object type TABLE_EXPORT/TABLE/TABLE
ORA-31693: Table data object "SCHEMA_USER"."EMPLOYEES" failed to load/unload and is being skipped due to error:
ORA-28081: Insufficient privileges - the command references a redacted object.Master table "SCHEMA_USER"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCHEMA_USER.SYS_EXPORT_TABLE_01 is:/u01/app/oracle/oradata/expdp.dmp
Job "SCHEMA_USER"."SYS_EXPORT_TABLE_01" completed with 1 error(s) at Mon Nov 20 08:13:48 2023 elapsed 0 00:00:12

出错了,错误为:

$ oerr ora 28081
28081, 00000, "Insufficient privileges - the command references a redacted object."
// *Cause: The command referenced a redacted column in an
// object protected by a data redaction policy.
// *Action: If possible, modify the command to avoid referencing any
// redacted columns.  Otherwise, drop the data redaction policies that
// protect the referenced tables and views, or ensure that the user issuing
// the command has the EXEMPT REDACTION POLICY system privilege, then
// retry the operation.  The EXEMPT REDACTION POLICY system privilege
// is required for creating or refreshing a materialized view when the
// materialized view is based on an object protected by a data redaction
// policy.  The EXEMPT REDACTION POLICY system privilege is required for
// performing a data pump schema-level export including any object
// protected by a data redaction policy.  All data redaction policies are
// listed in the REDACTION_COLUMNS catalog view.

关键的错误是:

The EXEMPT REDACTION POLICY system privilege is required for performing a data pump schema-level export including any object protected by a data redaction policy.
执行数据泵架构级导出(包括受数据编辑策略保护的任何对象)需要 EXEMPT REDACTION POLICY 系统权限。

简单来说就是,想利用Data Redaction实现数据泵导出的脱敏是做不到的,因为其实质上是物理脱敏。因此,要么你绕过redact policy(利用EXEMPT REDACTION POLICY权限),要么你只导出元数据。

绕过redact policy可以用特权用户,如SYS:

$ expdp system@orclpdb1 tables=schema_user.employees directory=TEST_DIR dumpfile=expdp.dmpExport: Release 19.0.0.0.0 - Production on Mon Nov 20 08:20:26 2023
Version 19.20.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.
Password:Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Starting "SYSTEM"."SYS_EXPORT_TABLE_01":  system/********@orclpdb1 tables=schema_user.employees directory=TEST_DIR dumpfile=expdp.dmp
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/RADM_POLICY
. . exported "SCHEMA_USER"."EMPLOYEES"                   6.929 KB       2 rows
Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:/u01/app/oracle/oradata/expdp.dmp
Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at Mon Nov 20 08:20:41 2023 elapsed 0 00:00:11

绕过redact policy的数据泵导出的是原始数据:

$ strings /u01/app/oracle/oradata/expdp.dmp |grep '247-85-9056'
247-85-9056

文档里也提到了:

This means that, when you export objects with Data Redaction policies defined on them, the actual data in the protected tables is copied to the Data Pump target system without being redacted.

不过redact policy会被一并导出。

利用数据泵导入,验证redact policy也包含在数据泵导出中。

$ impdp system@orclpdb1 tables=schema_user.employees directory=TEST_DIR dumpfile=expdp.dmp remap_table=employees:employees_newImport: Release 19.0.0.0.0 - Production on Mon Nov 20 08:35:03 2023
Version 19.20.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.
Password:Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Master table "SYSTEM"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TABLE_01":  system/********@orclpdb1 tables=schema_user.employees directory=TEST_DIR dumpfile=expdp.dmp remap_table=employees:employees_new
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/RADM_POLICY
ORA-39083: Object type RADM_POLICY failed to create with error:
ORA-28069: A data redaction policy already exists on this object.Failing sql is:
BEGIN DBMS_REDACT.ADD_POLICY(object_schema => '"SCHEMA_USER"', object_name => '"EMPLOYEES"', policy_name => 'redact_policy', expression => '1=1', enable => TRUE);
DBMS_REDACT.ALTER_POLICY (object_schema => '"SCHEMA_USER"', object_name => '"EMPLOYEES"', policy_name => 'redact_policy', action => DBMS_REDACT.ADD_COLUMN, column_name => '"SOCIAL_SECURITY"', function_type => DBMS_REDACT.RANDOM, function_parameters => NULL);
END;Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "SCHEMA_USER"."EMPLOYEES_NEW"               6.929 KB       2 rows
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
Job "SYSTEM"."SYS_IMPORT_TABLE_01" completed with 1 error(s) at Mon Nov 20 08:35:21 2023 elapsed 0 00:00:15

出错了,原因是由于原表的redact policy已存在。那我们就先删除此policy。

然后导入就没问题了:

$ impdp system@orclpdb1 tables=schema_user.employees directory=TEST_DIR dumpfile=expdp.dmp remap_table=employees:employees_newImport: Release 19.0.0.0.0 - Production on Mon Nov 20 08:39:58 2023
Version 19.20.0.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.
Password:Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Master table "SYSTEM"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TABLE_01":  system/********@orclpdb1 tables=schema_user.employees directory=TEST_DIR dumpfile=expdp.dmp remap_table=employees:employees_new
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/RADM_POLICY
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "SCHEMA_USER"."EMPLOYEES_NEW"               6.929 KB       2 rows
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
Job "SYSTEM"."SYS_IMPORT_TABLE_01" successfully completed at Mon Nov 20 08:40:06 2023 elapsed 0 00:00:05

导入后,我们发现策略也导入了:

SQL> select count(*) from redaction_policies;COUNT(*)
----------1

相关文章:

Oracle Data Redaction和Oracle Data Pump

本实验的使用环境基于之前的博客:一个简单的Oracle Redaction实验 本实验参考文档为15.14 Oracle Data Redaction and Oracle Data Pump 先创建directory并赋权: -- connect to database or pluggable database alter session set containerorclpdb1;…...

python django 小程序图书借阅源码

开发工具: PyCharm,mysql5.7,微信开发者工具 技术说明: python django html 小程序 功能介绍: 用户端: 登录注册(含授权登录) 首页显示搜索图书,轮播图&#xff0…...

CI/CD --git版本控制系统

目录 一、git简介 二、git使用 三、github远程代码仓库 一、git简介 Git特点: 速度简单的设计对非线性开发模式的强力支持(允许成千上万个并行开发的分支)完全分布式有能力高效管理类似 Linux 内核一样的超大规模项目(速度和数…...

CSS中2种复合选择器

1:交集选择器 作用:选中同时符合多个条件的元素 语法:选择器1选择器2选择器n{} 注意:若交集选择器中有元素选择器,必须使用元素选择器开头 2:并集选择器 作用:同时选择多个选择器对应的元素 语法:选择…...

【Skynet 入门实战练习】开发环境搭建 | 运行第一个项目 | debug console 简单使用

文章目录 写在前面开发环境搭建skynet配置文件项目,启动! debug console 写在前面 本系列【Skynet 入门实战练习】所有源码同步:https://gitee.com/Cauchy_AQ/skynet_practice 开发环境搭建 skynet skynet 框架地址:https://g…...

【探索嵌入式虚拟化技术与应用】— 虚拟化技术深入浅出自学系列

🌈个人主页: Aileen_0v0🔥系列专栏:【探索嵌入式虚拟化技术与应用】💫个人格言:"没有罗马,那就自己创造罗马~" 目录 一、虚拟技术的发展历史 1.1传统技术的局限性: ​编辑 1.2云计算和万物互联技术的发展机遇&#x…...

MIB 6.1810实验Xv6 and Unix utilities(5)find

难度:moderate Write a simple version of the UNIX find program for xv6: find all the files in a directory tree with a specific name. Your solution should be in the file user/find.c. 题目要求:实现find ,即在某个路径中,找出某…...

百度爬虫的工作原理解析

百度作为中国最大的搜索引擎,其工作原理备受关注。本文将深入探讨百度爬虫的工作原理,介绍其基本流程以及关键技术,帮助读者更好地理解搜索引擎背后的技术核心。 百度爬虫是百度搜索引擎的重要基石,它们被广泛用于收集互联网上的网…...

Linux入门必备指令

Linux学习之路起始篇——Linux基本指令 文章目录 Linux学习之路起始篇——Linux基本指令**一、ls指令****二、pwd命令****三、cd命令****四、touch指令****五、mkdir命令****六、rm命令****七、man 命令****八、cp命令****九、mv命令****10、cat 指令****十一、tac命令** 前言&…...

linux系统环境下mysql安装和基本命令学习

此篇文章为蓝桥云课--MySQL的学习记录 块引用部分为自己的实验部分,其余部分是课程自带的知识,链接如下: MySQL 基础课程_MySQL - 蓝桥云课 本课程为 SQL 基本语法及 MySQL 基本操作的实验,理论内容较少,动手实践多&am…...

Monitor 原理

每个 Java 对象都可以关联一个 Monitor 对象,如果使用 synchronized 给对象上锁(重量级)之后,该对象头的 Mark Word 中就被设置指向 Monitor 对象的指针。 Monitor组成内容 EntryList(入口列表) 当一个线…...

Java核心知识点整理大全7-笔记

目录 4.1.9. JAVA 锁 4.1.9.1. 乐观锁 4.1.9.2. 悲观锁 4.1.9.3. 自旋锁 4.1.9.4. Synchronized 同步锁 Synchronized 作用范围 Synchronized 核心组件 Synchronized 实现 4.1.9.5. ReentrantLock Lock 接口的主要方法 非公平锁 公平锁 ReentrantLock 与 synchronized …...

Flink Operator 使用指南 之 全局配置

背景 在上一个章节中已经介绍了基本的Flink-Operator安装,但是在实际的数据中台的项目中,用户可能希望看到Flink Operator的运行日志情况,当然这可以通过修改Flink-Operator POD的文件实现卷挂载的形势将日志输出到宿主机器的指定目录下,但是这种办法对数据中台的产品不是…...

手把手教你通过CODESYS V3进行PLC编程(一)

教程背景 宏集MC系列模块化控制器是基于Raspberry Pi的高性能4核控制器,运动控制循环时间最快可达500微秒,实现了计算能力和成本之间的最佳平衡,适用于多轴运动控制和CNC控制。 教程目的 本系列教程将使用宏集MC系列控制器,详细…...

《算法通关村—进制转换问题处理模板》

《算法通关村—进制转换问题处理模板》 先来一个题热热身 504. 七进制数 给定一个整数 num,将其转化为 7 进制,并以字符串形式输出。 示例 1: 输入: num 100 输出: "202"示例 2: 输入: num -7 输出: "-10"提示: …...

python接口自动化测试之接口数据依赖

一般在做自动化测试时,经常会对一整套业务流程进行一组接口上的测试,这时候接口之间经常会有数据依赖,那又该如何继续呢? 那么有如下思路: 抽取之前接口的返回值存储到全局变量字典中。初始化接口请求时,…...

s28.CentOS、Ubuntu、Rocky Linux系统初始化脚本v6版本

CentOS、Ubuntu、Rocky系统初始化脚本 Shell脚本源码地址: Gitee:https://gitee.com/raymond9/shell Github:https://github.com/raymond999999/shell 可以去上面的Gitee或Github仓库代码拉取脚本。 版本功能v6版更新内容1.由于CentOS 6…...

go同步锁 sync mutex

goroutine http://127.0.0.1:3999/concurrency/11 go tour 到此 就结束了. 继续 学习 可以 从 以下网站 文档 https://golang.org/doc/ https://golang.org/doc/code https://golang.org/doc/codewalk/functions/ 博客 https://go.dev/blog/ wiki 服务器教程 服务器…...

使用项目自动生成的dokcerfile第一次构建时把加载aps5.0失败无法找到加载的文件

第一次构建初始化项目自带的dockerfile,内容如下: #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.#FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base #WORKDIR /a…...

ACREL DC energy meter Application in Indonesia

安科瑞 华楠 Abstract: This article introduces the application of Acrel DC meters in base station in Indonesia.The device is measuring current,voltage and energy together with hall current sensor. 1.Project Overview This company is located in Indonesia a…...

后进先出(LIFO)详解

LIFO 是 Last In, First Out 的缩写,中文译为后进先出。这是一种数据结构的工作原则,类似于一摞盘子或一叠书本: 最后放进去的元素最先出来 -想象往筒状容器里放盘子: (1)你放进的最后一个盘子&#xff08…...

在软件开发中正确使用MySQL日期时间类型的深度解析

在日常软件开发场景中,时间信息的存储是底层且核心的需求。从金融交易的精确记账时间、用户操作的行为日志,到供应链系统的物流节点时间戳,时间数据的准确性直接决定业务逻辑的可靠性。MySQL作为主流关系型数据库,其日期时间类型的…...

【Python】 -- 趣味代码 - 小恐龙游戏

文章目录 文章目录 00 小恐龙游戏程序设计框架代码结构和功能游戏流程总结01 小恐龙游戏程序设计02 百度网盘地址00 小恐龙游戏程序设计框架 这段代码是一个基于 Pygame 的简易跑酷游戏的完整实现,玩家控制一个角色(龙)躲避障碍物(仙人掌和乌鸦)。以下是代码的详细介绍:…...

ubuntu搭建nfs服务centos挂载访问

在Ubuntu上设置NFS服务器 在Ubuntu上,你可以使用apt包管理器来安装NFS服务器。打开终端并运行: sudo apt update sudo apt install nfs-kernel-server创建共享目录 创建一个目录用于共享,例如/shared: sudo mkdir /shared sud…...

AtCoder 第409​场初级竞赛 A~E题解

A Conflict 【题目链接】 原题链接:A - Conflict 【考点】 枚举 【题目大意】 找到是否有两人都想要的物品。 【解析】 遍历两端字符串,只有在同时为 o 时输出 Yes 并结束程序,否则输出 No。 【难度】 GESP三级 【代码参考】 #i…...

质量体系的重要

质量体系是为确保产品、服务或过程质量满足规定要求,由相互关联的要素构成的有机整体。其核心内容可归纳为以下五个方面: 🏛️ 一、组织架构与职责 质量体系明确组织内各部门、岗位的职责与权限,形成层级清晰的管理网络&#xf…...

【JavaWeb】Docker项目部署

引言 之前学习了Linux操作系统的常见命令,在Linux上安装软件,以及如何在Linux上部署一个单体项目,大多数同学都会有相同的感受,那就是麻烦。 核心体现在三点: 命令太多了,记不住 软件安装包名字复杂&…...

vue3+vite项目中使用.env文件环境变量方法

vue3vite项目中使用.env文件环境变量方法 .env文件作用命名规则常用的配置项示例使用方法注意事项在vite.config.js文件中读取环境变量方法 .env文件作用 .env 文件用于定义环境变量,这些变量可以在项目中通过 import.meta.env 进行访问。Vite 会自动加载这些环境变…...

uniapp 开发ios, xcode 提交app store connect 和 testflight内测

uniapp 中配置 配置manifest 文档:manifest.json 应用配置 | uni-app官网 hbuilderx中本地打包 下载IOS最新SDK 开发环境 | uni小程序SDK hbulderx 版本号:4.66 对应的sdk版本 4.66 两者必须一致 本地打包的资源导入到SDK 导入资源 | uni小程序SDK …...

解决:Android studio 编译后报错\app\src\main\cpp\CMakeLists.txt‘ to exist

现象: android studio报错: [CXX1409] D:\GitLab\xxxxx\app.cxx\Debug\3f3w4y1i\arm64-v8a\android_gradle_build.json : expected buildFiles file ‘D:\GitLab\xxxxx\app\src\main\cpp\CMakeLists.txt’ to exist 解决: 不要动CMakeLists.…...