Exiting with failure status due to previous erro异常处理

Posted Liujun_Deng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Exiting with failure status due to previous erro异常处理相关的知识,希望对你有一定的参考价值。

系统:CentOS 7.6

在备份ORACLE_HOME时报出以下异常:

[oracle@dbserver ~]$ tar -cvfp product.tar.gz /u01/app/oracle/

/u01/app/oracle/oradata/orcl/temp01.dbf

/u01/app/oracle/archive/

tar: Exiting with failure status due to previous errors

经查询资料,确认造成此异常最有可能是tar命令压缩的某个文件过程中,

该用户并不具备读权限,因此切换root用户进行压缩,如下:

[root@dbserver ~]# tar -cvfp product.tar.gz /u01/app/oracle/

tar: Exiting with failure status due to previous errors

说明:依然报出此异常

问题:

1、如何确定错误根源?

2、tar命令打印出"previous errors"到底是什么错误?

要找到这些信息,可以把tar命令的标准输出(stdout)进行过滤,如下:

[oracle@dbserver ~]$ tar zcvf product.tar.gz /u01/app/oracle/ >/dev/null

tar: Removing leading `/ from member names

tar: /u01/app/oracle/product/11.2.0/db_1/bin/nmb: Cannot open: Permission denied

tar: /u01/app/oracle/product/11.2.0/db_1/bin/nmhs: Cannot open: Permission denied

tar: /u01/app/oracle/product/11.2.0/db_1/bin/nmo: Cannot open: Permission denied

tar: Exiting with failure status due to previous errors

此时可以判断,造成此异常原因如下:

1、无权限 — 切换root解决

2、去除文件名中前导的根目录“/”  

说明:对于异常原因2,tar命令在压缩文件时,默认使用相对路径,如果使用绝对路径,便会报该错误.

此时可以加参数P,不要去掉文件名开头的/,使用绝对路径进行压缩,如下:

[root@dbserver ~]# tar -zcvPf product.tar.gz /u01/app/oracle >/dev/null

[root@dbserver ~]# ll                    

total 2617380

-rw-r--r--. 1 root root  233770311 Mar  2 14:04 alert_jbzyydb2.log20220302

-rw-------. 1 root root       2307 Nov 25 21:05 anaconda-ks.cfg

drwxr-xr-x. 2 root root          6 Nov 25 21:27 Desktop

drwxr-xr-x. 2 root root          6 Nov 25 21:27 Documents

drwxr-xr-x. 2 root root          6 Nov 25 21:27 Downloads

-rw-r--r--. 1 root root       2400 Nov 25 21:11 initial-setup-ks.cfg

drwxr-xr-x. 2 root root          6 Nov 25 21:27 Music

drwxr-xr-x. 2 root root          6 Nov 25 21:27 Pictures

-rw-r--r--  1 root root 2446414252 Apr 19 23:43 product.tar.gz

drwxr-xr-x. 2 root root          6 Nov 25 21:27 Public

drwxr-xr-x. 2 root root          6 Nov 25 21:27 Templates

drwxr-xr-x. 2 root root          6 Nov 25 21:27 Videos

注意:-zcvPf不能写出-zcvfP,P不能放到最后,因为f必须紧跟要创建的文件名称.

以上是关于Exiting with failure status due to previous erro异常处理的主要内容,如果未能解决你的问题,请参考以下文章

tar: This does not look like a tar archive tar: Skipping to next header tar: Exiting with failure st

threadid=1: thread exiting with uncaught exception (group=0x417cce00)问题

hdfs格式化exiting with status1怎么办?

threadid=1: thread exiting with uncaught exception (group=0x40fca9a8)的问题

FAILURE: Build failed with an exception.

[Cypress] Test XHR Failure Conditions with Cypress