AMDU-- ASM文件搬运东西51CTO博客 - 亚美娱乐

AMDU-- ASM文件搬运东西51CTO博客

2019年04月24日08时58分44秒 | 作者: 语梦 | 标签: 文件,数据文件,测验 | 浏览: 1945


      近来遇到一个问题,便是ASM diskgroup无法挂载,经过剖析之后,发现有会快存在,可是由于没有备份,没有方法重建diskgroup并从backup康复所以所以所以....备份很重要啊!否则,哭!!是迟早的工作!经过处理这个问题,我在自己的测验环境测验了如安在ASM diskgroup无法mount的情况下,尽量抢救数据文件。

这儿运用到oracle 东西AMDU,该详细信息能够参阅AMDU functionality and usage (Doc ID 855791.1)


1. 由于diskgroup无法挂载,SPFILE、CONTROLFILE、DATAFILE都无法读取依据过程,咱们首要需求康复spfile文件,spfile文件存在的含义便是找到control_files的方位,假如spfile无法访问,需求查找备份。
SQL> show parameter control_files
+DATA/db/controlfile/current.260.804295233, +FRA/db/controlfile/current.256.804295237
2. 经过ASM实例找到asm_diskstring
SQL> show parameter disk
NAME           TYPE    VALUE
 - 
asm_diskgroups         string  DATA, FRA
asm_diskstring         string  /dev/sd*
3. 查找asm disk的途径,后续要指定diskstring来扫描磁盘
SQL> select NAME,STATE,TYPE,OFFLINE_DISKS,VOTING_FILES  from v$asm_diskgroup;  
 SQL> col PATH for a50
 SQL> col name for a10
 SQL> set line 200
 SQL> select DISK_NUMBER,GROUP_NUMBER,PATH,name from v$asm_disk;
DISK_NUMBER GROUP_NUMBER PATH                 NAME
-   
    1    2 /dev/oracleasm/disks/ASMDISK5        FRA_0001
    0    2 /dev/oracleasm/disks/ASMDISK4        FRA_0000
    2    1 /dev/oracleasm/disks/ASMDISK3        DATA_0002
DISK_NUMBER GROUP_NUMBER PATH                 NAME
-   
    1    1 /dev/oracleasm/disks/ASMDISK2        DATA_0001
    0    1 /dev/oracleasm/disks/ASMDISK1        DATA_0000
4. 在diskgroup mount状况,是不能运用amdu导出文件的履行amdu指令开端导出,遇到过错
$  amdu -diskstring /dev/oracleasm/disks/ASMDISK* -extract data.260
amdu_2013_07_03_17_29_13/
AMDU-00204: Disk N0005 is in currently mounted diskgroup DATA
AMDU-00201: Disk N0005: /dev/oracleasm/disks/ASMDISK1
检查发现磁盘组mount
$ crsctl status res -t

NAME     TARGET  STATE    SERVER       STATE_DETAILS

ora.DATA.dg
     ONLINE  ONLINE   single-db
ora.FRA.dg
     ONLINE  ONLINE   single-db
5. 导出操控文件
$  amdu -diskstring /dev/oracleasm/disks/ASMDISK* -extract data.260
amdu_2013_07_03_17_46_07/
[oracle@Single-DB amdu]$ cd amdu_2013_07_03_17_46_07/
[oracle@Single-DB amdu_2013_07_03_17_46_07]$ ls
DATA_260.f  report.txt


6. 测验挂载control file发现spfile也存放在磁盘组中无法nomount
$ sqlplus / as sysdba
SQL> startup nomount;
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file +DATA/db/spfiledb.ora
ORA-17503: ksfdopn:2 Failed to open file +DATA/db/spfiledb.ora
ORA-15056: additional error message
ORA-17503: ksfdopn:DGOpenFile05 Failed to open file +DATA/db/spfiledb.ora
ORA-17503: ksfdopn:2 Failed to open file +DATA/db/spfiledb.ora
ORA-15001: diskgroup "DATA" does not exist or is not mounted
ORA-06512: at line 4

7. 那就修正一个新的pfile文件

$ cp init.ora spfilebk.ora
$ vi spfilebk.ora
~~~~~~~~~~~~~~~
db_name=DB
sga_target=1G
processes = 150
audit_trail =db
db_block_size=8192
db_domain=
db_recovery_file_dest_size=2G
open_cursors=300
remote_login_passwordfile=EXCLUSIVE
undo_tablespace=UNDOTBS1
control_files = /u01/amdu/amdu_2013_07_03_17_46_07/DATA_260.f
compatible =11.2.0
~~~~~~~~~~~~~~~
8. 经过导出的操控文件发动数据库到mount形式,成功发动,阐明AMDU导出的数据时正确的,持续。。。。。
$ sqlplus / as sysdba
SQL> startup nomount pfile=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilebk.ora;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size      2220200 bytes
Variable Size     281022296 bytes
Database Buffers    780140544 bytes
Redo Buffers      5554176 bytes
SQL> alter database mount;
Database altered.
9. 检查数据文件的方位,然后逐个导出
SQL> select name from v$datafile;
NAME

+DATA/db/datafile/system.256.804295135
+DATA/db/datafile/sysaux.257.804295137
+DATA/db/datafile/undotbs1.258.804295139
+DATA/db/datafile/users.259.804295141
$  amdu -diskstring /dev/oracleasm/disks/ASMDISK* -extract data.256   <<<<<<<<<<<<<<system
$  amdu -diskstring /dev/oracleasm/disks/ASMDISK* -extract data.257   <<<<<<<<<<<<<<sysaux
$  amdu -diskstring /dev/oracleasm/disks/ASMDISK* -extract data.258   <<<<<<<<<<<<<<undotbs1
$  amdu -diskstring /dev/oracleasm/disks/ASMDISK* -extract data.259   <<<<<<<<<<<<<<users .
10. 重命名数据文件,并移动到同一个目录下,预备挂载数据文件
$ mv amdu_2013_07_03_18_12_56/DATA_257.f sysaux.257.804295137
$ mv amdu_2013_07_03_18_22_23/DATA_259.f users.259.804295141
$ mv amdu_2013_07_03_18_23_06/DATA_258.f undotbs1.258.804295139
$ ll
-rw-rr 1 oracle dba 545267712 Jul  3 18:14 sysaux.257.804295137
-rw-rr 1 oracle dba 702554112 Jul  3 18:11 system.256.804295135
-rw-rr 1 oracle dba  99622912 Jul  3 18:23 undotbs1.258.804295139
-rw-rr 1 oracle dba 5251072 Jul  3 18:22 users.259.804295141
11. 挂载前需求修正pfile文件,下面是open数据库是control file怎么辨认不同途径的datafile, 我运用convert参数来处理(也能够是用set newname的方法)db_file_name_convert=+DATA/db/datafile,/u01/amdu/amdu_datafile 添加完pfile,发动数据库,终究成功发动数据库
SQL> startup pfile=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilebk.ora;
[oracle@Single-DB ~]$ sqlplus / as sysdba
Connected to an idle instance.
SQL> startup pfile=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilebk.ora;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size      2220200 bytes
Variable Size     281022296 bytes
Database Buffers    780140544 bytes
Redo Buffers      5554176 bytes
Database mounted.
Database opened.
SQL>  select status, instance_name  from v$instance;
STATUS   INSTANCE_NAME
 
OPEN   db
总结,备份很重要!!由于是在我测验库上进行的试验,我没有损坏数据文件来彻底模仿客户问题。可是经过这个测验,咱们能够承认的是,在ASM diskgroup无法挂载的情况下,咱们是有方法将数据文件读出(即使是坏的),然后咱们在针对详细的坏块测验block康复(估量没有备份,这个也没辙了)。可是至少,数据文件摆在咱们面前了,咱们还有其他许多方法去测验修正,再不可,也仅仅丢掉部分数据,由于其间或许仅仅单个数据文件的单个block损坏。总归,数据文件弄出来了,剩余的,持续研讨吧。


版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表亚美娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章