一、问题描述
需求要使用expdp备份数据,检查系统空间很小,不够放备份文件。直接给系统加空间不就得了,可是这样一来就要耽误时间,还要联系一大堆人员。此时ASM空间是很充足的,可不可以使用呢。接着就有以下的操作了。
二、实验
1.数据库建立directory
SYS@PROD1 > create directory databk as '+data/backup'; Directory created. . [oracle@sam1 ~]$ expdp system/oracle direcotry=databk dumpfile=all.dmp full=y LRM-00101: unknown parameter name 'direcotry' [oracle@sam1 ~]$ expdp system/oracle directory=databk dumpfile=all.dmp full=y Export: Release 11.2.0.3.0 - Production on Sat Feb 15 08:13:57 2020 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options ORA-39002: invalid operation ORA-39070: Unable to open the log file. ORA-29283: invalid file operation ORA-06512: at "SYS.UTL_FILE", line 536 ORA-29283: invalid file operation
此时会有以上报错,原因是日志无法写入ASM当中导致。可以以下两种方式解决:
A.使用NOLOGFILE=YES选项禁用日志。
B.将日志指定到系统的目录。
2.测试NOLOGFILE=YES 成功完成备份
[oracle@sam1 ~]$ expdp system/oracle directory=databk dumpfile=all.dmp full=y NOLOGFILE=YES Export: Release 11.2.0.3.0 - Production on Mon Feb 24 01:22:35 2020 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options Starting "SYSTEM"."SYS_EXPORT_FULL_01": system/******** directory=databk dumpfile=all.dmp full=y NOLOGFILE=YES Estimate in progress using BLOCKS method... Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA Total estimation using BLOCKS method: 4.809 GB Processing object type DATABASE_EXPORT/TABLESPACE Processing object type DATABASE_EXPORT/PROFILE Processing object type DATABASE_EXPORT/SYS_USER/USER Processing object type DATABASE_EXPORT/SCHEMA/USER Processing object type DATABASE_EXPORT/ROLE Processing object type DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT …... . . exported "SYSTEM"."REPCAT$_USER_PARM_VALUES" 0 KB 0 rows . . exported "SYSTEM"."SQLPLUS_PRODUCT_PROFILE" 0 KB 0 rows Master table "SYSTEM"."SYS_EXPORT_FULL_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYSTEM.SYS_EXPORT_FULL_01 is: +DATA/backup/all.dmp Job "SYSTEM"."SYS_EXPORT_FULL_01" completed with 1 error(s) at 01:25:42
3.测试将log写到其他位置 成功完成备份需要建立一个放log的directory
SYS@PROD1 > create directory logdump as '/home/oracle'; Directory created. [oracle@sam1 ~]$ expdp system/oracle directory=databk dumpfile=scott.dmp schemas=scott logfile=logdump:expdp_scott.log Export: Release 11.2.0.3.0 - Production on Mon Feb 24 04:50:37 2020 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01": system/******** directory=databk dumpfile=scott.dmp schemas=scott logfile=logdump:expdp_scott.log Estimate in progress using BLOCKS method... Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 320 KB Processing object type SCHEMA_EXPORT/USER Processing object type SCHEMA_EXPORT/SYSTEM_GRANT Processing object type SCHEMA_EXPORT/ROLE_GRANT Processing object type SCHEMA_EXPORT/DEFAULT_ROLE Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA Processing object type SCHEMA_EXPORT/TABLE/TABLE Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS . . exported "SCOTT"."DEPT" 5.929 KB 4 rows . . exported "SCOTT"."EMP" 8.562 KB 14 rows . . exported "SCOTT"."SALGRADE" 5.859 KB 5 rows . . exported "SCOTT"."TABLE1" 5.835 KB 2 rows . . exported "SCOTT"."TEST" 5.421 KB 1 rows . . exported "SCOTT"."BONUS" 0 KB 0 rows Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is: +DATA/backup/scott.dmp Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at 04:51:03 [oracle@sam1 ~]$ ls -l expdp_scott.log -rw-r--r-- 1 oracle asmadmin 2080 Feb 24 04:51 expdp_scott.log
三、总结
通过数据泵将备份文件备份在ASM磁盘组中,有一点需要注意的是ASM磁盘组中无法存储log日志,可这个expdp/impdp命令默认是要写日志的,最终的解决办法是使用参数关闭写日志,另一种就是建立操作系统级别的目录,使得日志写在另一个directory中即可。真是不学不知道,一学全知道。最后结束还是那句:where there is a will, there is a way.
编辑推荐:
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- 项目管理基本流程介绍,让你轻松管理项目
项目管理基本流程介绍,让你轻松管理项目
26-03-03 - pl/sql developer的一个小问题
pl/sql developer的一个小问题
26-03-03 - oracle 12c 静默安装以及使用问题小结
oracle 12c 静默安装以及使用问题小结
26-03-03 - 如何一次性操作几百个新浪博客?怎么同时登录新浪号?
如何一次性操作几百个新浪博客?怎么同时登录新浪号?
26-03-03 - 一台电脑怎么管理多个新浪博客?便捷方法告诉你!
一台电脑怎么管理多个新浪博客?便捷方法告诉你!
26-03-03 - 用的人比较多的自媒体分发软件,这款最安全!
用的人比较多的自媒体分发软件,这款最安全!
26-03-03 - 木鱼小铺:商家如何玩转社区团购小程序
木鱼小铺:商家如何玩转社区团购小程序
26-03-03 - Oracle 没有索引导致的DPR
Oracle 没有索引导致的DPR
26-03-03 - 怎么样批量操作多个易车号?一次性在易车号上发30篇文章
怎么样批量操作多个易车号?一次性在易车号上发30篇文章
26-03-03 - 适合大型企业!自媒体隐藏账号密码第三方应用
适合大型企业!自媒体隐藏账号密码第三方应用
26-03-03
