Oracle透明数据加密:数据泵文件导出

不带加密的数据泵导出

先给hr用户赋予DATA_PUMP_DIR的读写权限:

sql 复制代码
SQL> grant read, write on directory DATA_PUMP_DIR to hr;

Grant succeeded.

expdp导出配置文件:

bash 复制代码
$ cat exp.par
DIRECTORY=DATA_PUMP_DIR
DUMPFILE=dataonly.dmp
CONTENT=DATA_ONLY

导出:

bash 复制代码
$ expdp hr/Welcome1@orclpdb1 parfile=exp.par

Export: Release 19.0.0.0.0 - Production on Thu Jul 11 01:27:32 2024
Version 19.16.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

UDE-28002: operation generated ORACLE error 28002
ORA-28002: the password will expire within 7 days

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Starting "HR"."SYS_EXPORT_SCHEMA_01":  hr/********@orclpdb1 parfile=exp.par
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . exported "HR"."EMPLOYEES"                            17.08 KB     107 rows
. . exported "HR"."LOCATIONS"                            8.437 KB      23 rows
. . exported "HR"."DBTOOLS$EXECUTION_HISTORY"            8.398 KB       1 rows
. . exported "HR"."JOB_HISTORY"                          7.195 KB      10 rows
. . exported "HR"."JOBS"                                 7.109 KB      19 rows
. . exported "HR"."DEPARTMENTS"                          7.125 KB      27 rows
. . exported "HR"."COUNTRIES"                            6.367 KB      25 rows
. . exported "HR"."REGIONS"                              5.546 KB       4 rows
Master table "HR"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for HR.SYS_EXPORT_SCHEMA_01 is:
  /u01/app/oracle/admin/ORCL/dpdump/0CE9C0F43A7F3441E06500001702E44D/dataonly.dmp
Job "HR"."SYS_EXPORT_SCHEMA_01" successfully completed at Thu Jul 11 01:27:36 2024 elapsed 0 00:00:04

文件大小:

bash 复制代码
$ ls -l dataonly.dmp
-rw-r-----. 1 oracle dba 360448 Jul 11 01:50 dataonly.dmp

搜索敏感文字,如电话的区号:

bash 复制代码
$ strings /u01/app/oracle/admin/ORCL/dpdump/0CE9C0F43A7F3441E06500001702E44D/dataonly.dmp|grep -i "650\."|sort|uniq
650.121.1234
650.121.1834
650.121.2004
650.121.2019
650.121.2034
650.121.2874
650.121.2994
650.121.8009
650.123.1234
650.123.2234
650.123.3234
650.123.4234
650.123.5234
650.124.1214
650.124.1224
650.124.1334
650.124.1434
650.124.5234
650.124.6234
650.124.7234
650.124.8234
650.127.1634
650.127.1734
650.127.1834
650.127.1934
650.501.1876
650.501.2876
650.501.3876
650.501.4876
650.505.1876
650.505.2876
650.505.3876
650.505.4876
650.507.9811
650.507.9822
650.507.9833
650.507.9844
650.507.9876
650.507.9877
650.507.9878
650.507.9879
650.509.1876
650.509.2876
650.509.3876
650.509.4876

带加密的数据泵导出

带加密的配置文件:

bash 复制代码
$ cat exp.par
DIRECTORY=DATA_PUMP_DIR
DUMPFILE=dataonly.dmp
CONTENT=DATA_ONLY
ENCRYPTION=DATA_ONLY

加密导出:

bash 复制代码
[oracle@instance-20231220-1113-19c-iaas tde]$ expdp hr/Welcome1@orclpdb1 parfile=exp.par

Export: Release 19.0.0.0.0 - Production on Thu Jul 11 01:44:20 2024
Version 19.16.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

UDE-28002: operation generated ORACLE error 28002
ORA-28002: the password will expire within 7 days

Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Starting "HR"."SYS_EXPORT_SCHEMA_01":  hr/********@orclpdb1 parfile=exp.par
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . exported "HR"."EMPLOYEES"                            17.09 KB     107 rows
. . exported "HR"."LOCATIONS"                            8.445 KB      23 rows
. . exported "HR"."DBTOOLS$EXECUTION_HISTORY"            8.406 KB       1 rows
. . exported "HR"."JOB_HISTORY"                          7.203 KB      10 rows
. . exported "HR"."JOBS"                                 7.117 KB      19 rows
. . exported "HR"."DEPARTMENTS"                          7.132 KB      27 rows
. . exported "HR"."COUNTRIES"                            6.375 KB      25 rows
. . exported "HR"."REGIONS"                              5.554 KB       4 rows
Master table "HR"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for HR.SYS_EXPORT_SCHEMA_01 is:
  /u01/app/oracle/admin/ORCL/dpdump/0CE9C0F43A7F3441E06500001702E44D/dataonly.dmp
Job "HR"."SYS_EXPORT_SCHEMA_01" successfully completed at Thu Jul 11 01:44:38 2024 elapsed 0 00:00:16

没有输出了:

bash 复制代码
$ strings /u01/app/oracle/admin/ORCL/dpdump/0CE9C0F43A7F3441E06500001702E44D/dataonly.dmp|grep -i "650\."|sort|uniq

加密后的文件大小:

sql 复制代码
$ ls -l dataonly.dmp
-rw-r-----. 1 oracle dba 360448 Jul 11 01:44 dataonly.dmp

文件大小没有变化。

参考

相关推荐
毕业设计制作和分享3 小时前
ssm《数据库系统原理》课程平台的设计与实现+vue
前端·数据库·vue.js·oracle·mybatis
Dingww10118 小时前
梧桐数据库中的网络地址类型使用介绍分享
数据库·oracle·php
2401_857026239 小时前
Spring Boot框架下的知识管理与多维分类
spring boot·后端·oracle
shiran小坚果15 小时前
AWS RDS MySQL内存使用
数据库·mysql·云计算·database·aws
刘艳兵的学习博客16 小时前
刘艳兵-DBA027-在Oracle数据库,通常可以使用如下方法来得到目标SQL的执行计划,那么通过下列哪些方法得到的执行计划有可能是不准确的?
数据库·oracle·面试·database·刘艳兵
秋意钟18 小时前
MySql事务
数据库·mysql·oracle
Mephisto.java19 小时前
【大数据学习 | HBASE】hbase的整体架构
大数据·sql·oracle·json·hbase·database
蚊子不吸吸1 天前
DevOps开发运维简述
linux·运维·ci/cd·oracle·kubernetes·gitlab·devops
Gauss松鼠会1 天前
GaussDB的向量化处理技术
运维·数据库·database·gaussdb
Ayka1 天前
Linux Qt 6安装Oracle QOCI SQL Driver插件(适用WSL)
linux·sql·qt·oracle·oci