发现如果人品不好做试验都是问题很多,晚上又把fstab给写错了,导致系统不能起来,因为当时处理该故障未截图,后续在网上找了几张图片,大体说明处理思路
系统启动报 filesystems 失败,输入root密码进入repair filesystem模式
尝试修改 /etc/fstab 发现系统是read-only模式
重新mount -n -o remount,rw /重新mount文件系统
重新修改/etc/fstab,除掉错误记录,然后使用init 6/reboot命令重启系统
Category Archives: 操作系统
extundelete恢复Linux被删除文件
今天群中有个朋友的客户闲着没事rm掉了数据文件,然后讨论到使用extundelete进行了恢复,抢救了部分未被覆盖的数据文件。该软件官方地址:http://extundelete.sourceforge.net/
安装extundelete
[root@xifenfei tmp]# bunzip2 extundelete-0.2.0.tar.bz2 [root@xifenfei tmp]# tar xvf extundelete-0.2.0.tar extundelete-0.2.0/ extundelete-0.2.0/README extundelete-0.2.0/acinclude.m4 extundelete-0.2.0/configure.ac extundelete-0.2.0/aclocal.m4 extundelete-0.2.0/Makefile.am extundelete-0.2.0/Makefile.in extundelete-0.2.0/config.h.in extundelete-0.2.0/configure extundelete-0.2.0/compile extundelete-0.2.0/depcomp extundelete-0.2.0/install-sh extundelete-0.2.0/missing extundelete-0.2.0/LICENSE extundelete-0.2.0/autogen.sh extundelete-0.2.0/src/ extundelete-0.2.0/src/Makefile.am extundelete-0.2.0/src/Makefile.in extundelete-0.2.0/src/extundelete.cc extundelete-0.2.0/src/block.c extundelete-0.2.0/src/insertionops.cc extundelete-0.2.0/src/block.h extundelete-0.2.0/src/extundelete.h extundelete-0.2.0/src/extundelete-priv.h extundelete-0.2.0/src/jfs_compat.h extundelete-0.2.0/src/kernel-jbd.h [root@xifenfei tmp]# cd extundelete-0.2.0 [root@xifenfei extundelete-0.2.0]# ./configure Configuring extundelete 0.2.0 Writing generated files to disk [root@xifenfei extundelete-0.2.0]# make && make install make -s all-recursive Making all in src Making install in src /usr/bin/install -c 'extundelete' '/usr/local/bin/extundelete'
恢复操作命令
--umount或者read only 分区 umount /dev/partition mount -o remount,ro /dev/partition --恢复文件 xtundelete /dev/partition --restore-all extundelete /dev/partition --restore-directory /backup/gnutool-delete extundelete /dev/partition --restore-files /etc/passwd
测试恢复
--基于目录恢复 [root@xifenfei tmp]#extundelete /dev/sdb1 --restore-directory /u01/xifenfei Loading filesystem metadata ... 160 groups loaded. Loading journal descriptors ... 23 descriptors loaded. Writing output to directory RECOVERED_FILES/ Failed to restore file /u01/xifenfei Could not find correct inode number past inode 2. [root@xifenfei tmp]# cd RECOVERED_FILES/ [root@xifenfei RECOVERED_FILES]# ll total 0 --未成功 --基于磁盘恢复 [root@xifenfei RECOVERED_FILES]#extundelete /dev/sdb1 --restore-all Loading filesystem metadata ... 160 groups loaded. Loading journal descriptors ... 23 descriptors loaded. Writing output to directory RECOVERED_FILES/ Searching for recoverable inodes in directory / ... 4 recoverable inodes found. Looking through the directory structure for deleted files ... Failed to restore inode 1966081 to file RECOVERED_FILES/xifenfei:Inode does not correspond to a regular file. Restored inode 1966082 to file RECOVERED_FILES/xifenfei/xff.txt Failed to restore inode 1966083 to file RECOVERED_FILES/xifenfei/xff:Inode does not correspond to a regular file. Restored inode 1966084 to file RECOVERED_FILES/xifenfei/xff/xff.txt132 0 recoverable inodes still lost. [root@xifenfei RECOVERED_FILES]# ll total 4 drwxr-xr-x 3 root root 4096 Aug 31 21:36 RECOVERED_FILES [root@xifenfei RECOVERED_FILES]# cd RECOVERED_FILES/ [root@xifenfei RECOVERED_FILES]# ll total 4 drwxr-xr-x 3 root root 4096 Aug 31 21:36 xifenfei [root@xifenfei RECOVERED_FILES]# cd xifenfei/ [root@xifenfei xifenfei]# ll total 20 drwxr-xr-x 2 root root 4096 Aug 31 21:36 xff -rw-r--r-- 1 root root 13231 Aug 31 21:36 xff.txt [root@xifenfei xifenfei]# cd xff [root@xifenfei xff]# ll total 16 -rw-r--r-- 1 root root 13231 Aug 31 21:36 xff.txt132 --恢复成功 --基于文件恢复 [root@xifenfei xff]# extundelete /dev/sdb1 --restore-files /u01/xifenfei/xff.txt Loading filesystem metadata ... 160 groups loaded. Loading journal descriptors ... 23 descriptors loaded. Writing output to directory RECOVERED_FILES/ [root@xifenfei xff]# cd RECOVERED_FILES/ [root@xifenfei RECOVERED_FILES]# ll total 0 --未成功
通过上述实验证明extundelete还是有很大的不完整性,基于整个磁盘的恢复功能较为强大,基于目录和文件的恢复还不够强大.不过该软件在很多时候还是有救火的功能,特别是当蛋筒的人员删除了数据库的部分文件之时.
iscsiadm主要操作命令
当前包含磁盘
[root@xifenfei ~]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 2355 18916506 83 Linux /dev/sda2 2356 2610 2048287+ 82 Linux swap / Solaris Disk /dev/sdb: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 2610 20964793+ 83 Linux Disk /dev/sdc: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdc doesn't contain a valid partition table Disk /dev/sdd: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdd1 1 100 803218+ 83 Linux /dev/sdd2 101 1000 7229250 83 Linux
查看iscsi运行情况
[root@xifenfei ~]# rpm -aq|grep iscsi iscsi-initiator-utils-6.2.0.872-10.0.1.el5 [root@xifenfei ~]# chkconfig --list |grep iscsi iscsi 0:off 1:off 2:on 3:on 4:on 5:on 6:off iscsid 0:off 1:off 2:off 3:on 4:on 5:on 6:off [root@xifenfei ~]# ps -ef|grep iscs root 2753 2 0 Jun21 ? 00:00:00 [iscsi_eh] root 15793 1 0 09:08 ? 00:00:00 brcm_iscsiuio root 15800 1 0 09:08 ? 00:00:00 iscsid root 15802 1 0 09:08 ? 00:00:00 iscsid root 19533 15269 0 10:11 pts/1 00:00:00 grep iscs
配置iscsi存储
[root@xifenfei ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.254:3260 192.168.1.254:3260,1 iqn.2006-01.com.openfiler:tsn.32b32087937b [root@xifenfei ~]# iscsiadm -m node –T iqn.2006-01.com.openfiler:tsn.32b32087937b -p 192.168.1.254:3260 -l Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.32b32087937b, portal: 192.168.1.254,3260] Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.32b32087937b, portal: 192.168.1.254,3260] successful. [root@xifenfei ~]# iscsiadm -m node –T iqn.2006-01.com.openfiler:tsn.32b32087937b -p 192.168.1.254:3260 >--op update -n node.startup -v automatic
当前包含磁盘
[root@xifenfei ~]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 2355 18916506 83 Linux /dev/sda2 2356 2610 2048287+ 82 Linux swap / Solaris Disk /dev/sdb: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 2610 20964793+ 83 Linux Disk /dev/sdc: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdc doesn't contain a valid partition table Disk /dev/sdd: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdd1 1 100 803218+ 83 Linux /dev/sdd2 101 1000 7229250 83 Linux Disk /dev/sde: 1073 MB, 1073741824 bytes 34 heads, 61 sectors/track, 1011 cylinders Units = cylinders of 2074 * 512 = 1061888 bytes Disk /dev/sde doesn't contain a valid partition table Disk /dev/sdf: 1073 MB, 1073741824 bytes 34 heads, 61 sectors/track, 1011 cylinders Units = cylinders of 2074 * 512 = 1061888 bytes Disk /dev/sdf doesn't contain a valid partition table Disk /dev/sdg: 1073 MB, 1073741824 bytes 34 heads, 61 sectors/track, 1011 cylinders Units = cylinders of 2074 * 512 = 1061888 bytes Disk /dev/sdg doesn't contain a valid partition table
卸载iscsi存储
[root@xifenfei ~]# iscsiadm -m node --logoutall=all Logging out of session [sid: 3, target: iqn.2006-01.com.openfiler:tsn.32b32087937b, portal: 192.168.1.254,3260] Logout of [sid: 3, target: iqn.2006-01.com.openfiler:tsn.32b32087937b, portal: 192.168.1.254,3260] successful. [root@xifenfei ~]# iscsiadm -m node --op delete --targetname iqn.2006-01.com.openfiler:tsn.32b32087937b
当前包含磁盘
[root@xifenfei ~]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 2355 18916506 83 Linux /dev/sda2 2356 2610 2048287+ 82 Linux swap / Solaris Disk /dev/sdb: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 2610 20964793+ 83 Linux Disk /dev/sdc: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdc doesn't contain a valid partition table Disk /dev/sdd: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdd1 1 100 803218+ 83 Linux /dev/sdd2 101 1000 7229250 83 Linux
iscsi操作总结
增加iscsi存储 (1)发现iscsi存储:iscsiadm -m discovery -t st -p ISCSI_IP (2)查看iscsi发现记录:iscsiadm -m node (3)登录iscsi存储:iscsiadm -m node -T LUN_NAME -p ISCSI_IP -l (4)开机自动: iscsiadm -m node –T LUN_NAME -p ISCSI_IP --op update -n node.startup -v automatic 删除iscsi存储 (1)登出iscsi存储 iscsiadm -m node -T LUN_NAME -p ISCSI_IP -u (2)对出iscsi所有登录 iscsiadm -m node --logoutall=all (3)删除iscsi发现记录:iscsiadm -m node -o delete -T LUN_NAME -p ISCSI_IP 登入需验证码的节点 (1)开启认证 iscsiadm -m node -T LUN_NAME -o update --name node.session.auth.authmethod --value=CHAP *.使用-o同--op (2)添加用户 iscsiadm -m node -T LUN_NAME --op update --name node.session.auth.username --value=[用户名] (3)添加密码 iscsiadm –m node –T LUN_NAME –op update –name node.session.auth.password –value=[密码]
拷贝windows中datafile header方法(ocopy)
在很多时候,我们需要对数据文件的头部进行分析,但是因为人不在本地,数据文件本身很大,网络又不好.这个时候我们可能要求对方传过来文件文件的头部几M即可.在unix/linux中可以使用dd实现该需求;在win中可以使用ocopy实现该需求.dd实现请参考:dd操作数据文件;这里讲win下面实现方法:
ocopy语法
D:\>ocopy OCOPY v2.0 - Copyright 1989-1993 Oracle Corp. All rights reserved. Usage: ocopy from_file [to_file [a | size_1 [size_n]]] ocopy -b from_file to_drive ocopy -r from_drive to_dir
ocopy拷贝数据文件header
D:\>ocopy E:\oracle\oradata\xifenfei\SYSAUX01.DBF d:\sysaux.dbf 20480 1 D:\SYSAUX.DBF OCOPY - Write error. --忽略(未找到原因) D:\>dir sysaux* 驱动器 D 中的卷没有标签。 卷的序列号是 000B-FBCB D:\ 的目录 2012/05/07 22:28 1,024 SYSAUX.DB2 2012/05/07 22:28 1,024 SYSAUX.DB3 2012/05/07 22:28 1,024 SYSAUX.DB4 2012/05/07 22:28 1,024 SYSAUX.DB5 2012/05/07 22:28 1,024 SYSAUX.DB6 2012/05/07 22:28 1,024 SYSAUX.DB7 2012/05/07 22:28 1,024 SYSAUX.DB8 2012/05/07 22:28 1,024 SYSAUX.DB9 2012/05/07 22:28 20,971,520 SYSAUX.DBF 9 个文件 20,979,712 字节 0 个目录 28,771,282,944 可用字节 --SYSAUX.DBF是我们需要的文件
上传到linux中bbed验证
[oracle@xifenfei ~]$ bbed Password: BBED: Release 2.0.0.0.0 - Limited Production on Fri May 25 08:31:12 2012 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> set filename '/home/oracle/sysaux.dbf' FILENAME /home/oracle/sysaux.dbf BBED> set blocksize 8192 BLOCKSIZE 8192 --从win中拷贝的数据库,第一个block非bbed有效块 BBED> set block 2 BLOCK# 2 BBED> map File: /home/oracle/sysaux.dbf (0) Block: 2 Dba:0x00000000 ------------------------------------------------------------ Data File Header struct kcvfh, 360 bytes @0 ub4 tailchk @8188 BBED> map /v File: /home/oracle/sysaux.dbf (0) Block: 2 Dba:0x00000000 ------------------------------------------------------------ Data File Header struct kcvfh, 360 bytes @0 struct kcvfhbfh, 20 bytes @0 struct kcvfhhdr, 76 bytes @20 ub4 kcvfhrdb @96 struct kcvfhcrs, 8 bytes @100 ub4 kcvfhcrt @108 ub4 kcvfhrlc @112 struct kcvfhrls, 8 bytes @116 ub4 kcvfhbti @124 struct kcvfhbsc, 8 bytes @128 ub2 kcvfhbth @136 ub2 kcvfhsta @138 struct kcvfhckp, 36 bytes @140 ub4 kcvfhcpc @176 ub4 kcvfhrts @180 ub4 kcvfhccc @184 struct kcvfhbcp, 36 bytes @188 ub4 kcvfhbhz @224 struct kcvfhxcd, 16 bytes @228 word kcvfhtsn @244 ub2 kcvfhtln @248 text kcvfhtnm[30] @250 ub4 kcvfhrfn @280 struct kcvfhrfs, 8 bytes @284 ub4 kcvfhrft @292 struct kcvfhafs, 8 bytes @296 ub4 kcvfhbbc @304 ub4 kcvfhncb @308 ub4 kcvfhmcb @312 ub4 kcvfhlcb @316 ub4 kcvfhbcs @320 ub2 kcvfhofb @324 ub2 kcvfhnfb @326 ub4 kcvfhprc @328 struct kcvfhprs, 8 bytes @332 struct kcvfhprfs, 8 bytes @340 ub4 kcvfhtrt @356 ub4 tailchk @8188 --数据块拷贝出来正常
ORACLE在AIX中产生SOFTWARE PROGRAM ABNORMALLY TERMINATED警告原因
数据库中发现如下错误
该错误的解决方案:ORA-07445[dbgrmqmqpk_query_pick_key()+0f88]
Dump file /oracle/diag/rdbms/sgerp5/sgerp5/incident/incdir_579300/sgerp5_m000_7602504_i579300.trc Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ORACLE_HOME = /oracle/product/11.1.0/db_1 System name: AIX Node name: sgerp5 Release: 1 Version: 6 Machine: 00C8F0564C00 Instance name: sgerp5 Redo thread mounted by this instance: 1 Oracle process number: 138 Unix process pid: 7602504, image: oracle@sgerp5 (m000) *** 2012-05-11 03:52:35.200 *** SESSION ID:(752.5029) 2012-05-11 03:52:35.200 *** CLIENT ID:() 2012-05-11 03:52:35.200 *** SERVICE NAME:(SYS$BACKGROUND) 2012-05-11 03:52:35.200 *** MODULE NAME:(MMON_SLAVE) 2012-05-11 03:52:35.200 *** ACTION NAME:(Auto-Purge Slave Action) 2012-05-11 03:52:35.200 Dump continued from file: /oracle/diag/rdbms/sgerp5/sgerp5/trace/sgerp5_m000_7602504.trc ORA-07445: exception encountered: core dump [dbgrmqmqpk_query_pick_key()+0f88] [SIGSEGV] [ADDR:0xB38F0000000049][PC:0x100213C08] [Address not mapped to object] []
errpt错误说明
在产生7445错误的同时观察aix系统错误日志发现SOFTWARE PROGRAM ABNORMALLY TERMINATED错误
sgerp5_[oracle]-->errpt -aj A924A5FC --------------------------------------------------------------------------- LABEL: CORE_DUMP IDENTIFIER: A924A5FC Date/Time: Fri May 11 03:52:55 BEIST 2012 Sequence Number: 471 Machine Id: 00C8F0564C00 Node Id: sgerp5 Class: S Type: PERM WPAR: Global Resource Name: SYSPROC Description SOFTWARE PROGRAM ABNORMALLY TERMINATED Probable Causes SOFTWARE PROGRAM User Causes USER GENERATED SIGNAL Recommended Actions CORRECT THEN RETRY Failure Causes SOFTWARE PROGRAM Recommended Actions RERUN THE APPLICATION PROGRAM IF PROBLEM PERSISTS THEN DO THE FOLLOWING CONTACT APPROPRIATE SERVICE REPRESENTATIVE Detail Data SIGNAL NUMBER 6 USER'S PROCESS ID: 7602504 FILE SYSTEM SERIAL NUMBER 14 INODE NUMBER 0 367648 CORE FILE NAME /oracle/diag/rdbms/sgerp5/sgerp5/cdump/core_7602504/core PROGRAM NAME oracle STACK EXECUTION DISABLED 0 COME FROM ADDRESS REGISTER sskgmcrea 0 PROCESSOR ID hw_fru_id: 1 hw_cpu_id: 2 ADDITIONAL INFORMATION skgdbgcra 224 ?? ksdbgcra 3D0 ssexhd 978 ?? Symptom Data REPORTABLE 1 INTERNAL ERROR 0 SYMPTOM CODE PCSS/SPI2 FLDS/oracle SIG/6 FLDS/skgdbgcra VALU/224
错误原因
This error is logged when a software program abnormally ends and causes a core dump. Users might not be exiting applications correctly, the system might have been shut down while users were working in application, or the user's terminal might have locked up and the application stopped 1)这里也就是说如果oracle进程在aix机器上异常终止,并且产生了一个core dump文件, 就会出现SOFTWARE PROGRAM ABNORMALLY TERMINATED警告信息 2)用户登录系统没有正常退出,而系统被关闭 3)用户强制终止一个一个lock,而导致进程停止
本次AIX日志警告原因:由于进程7602504异常终止(ORA-07445错误)并且产生了 /oracle/diag/rdbms/sgerp5/sgerp5/cdump/core_7602504/core dump 文件,从而有了AIX中的SOFTWARE PROGRAM ABNORMALLY TERMINATED警告信息