search
HomeDatabaseMysql Tutorial AMDU-- ASM文件转移工具

近日遇到一个问题,就是ASMdiskgroup无法挂载,通过分析之后,发现有会快存在,但是由于没有备份,没有办法重建diskgroup并从backup恢复--所以所以所以....备份


      近日遇到一个问题,就是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

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-r--r-- 1 oracle dba 545267712 Jul 3 18:14 sysaux.257.804295137 -rw-r--r-- 1 oracle dba 702554112 Jul 3 18:11 system.256.804295135 -rw-r--r-- 1 oracle dba 99622912 Jul 3 18:23 undotbs1.258.804295139 -rw-r--r-- 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,启动数据库,最终成功启动数据库

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What are the different storage engines available in MySQL?What are the different storage engines available in MySQL?Apr 26, 2025 am 12:27 AM

MySQLoffersvariousstorageengines,eachsuitedfordifferentusecases:1)InnoDBisidealforapplicationsneedingACIDcomplianceandhighconcurrency,supportingtransactionsandforeignkeys.2)MyISAMisbestforread-heavyworkloads,lackingtransactionsupport.3)Memoryengineis

What are some common security vulnerabilities in MySQL?What are some common security vulnerabilities in MySQL?Apr 26, 2025 am 12:27 AM

Common security vulnerabilities in MySQL include SQL injection, weak passwords, improper permission configuration, and unupdated software. 1. SQL injection can be prevented by using preprocessing statements. 2. Weak passwords can be avoided by forcibly using strong password strategies. 3. Improper permission configuration can be resolved through regular review and adjustment of user permissions. 4. Unupdated software can be patched by regularly checking and updating the MySQL version.

How can you identify slow queries in MySQL?How can you identify slow queries in MySQL?Apr 26, 2025 am 12:15 AM

Identifying slow queries in MySQL can be achieved by enabling slow query logs and setting thresholds. 1. Enable slow query logs and set thresholds. 2. View and analyze slow query log files, and use tools such as mysqldumpslow or pt-query-digest for in-depth analysis. 3. Optimizing slow queries can be achieved through index optimization, query rewriting and avoiding the use of SELECT*.

How can you monitor MySQL server health and performance?How can you monitor MySQL server health and performance?Apr 26, 2025 am 12:15 AM

To monitor the health and performance of MySQL servers, you should pay attention to system health, performance metrics and query execution. 1) Monitor system health: Use top, htop or SHOWGLOBALSTATUS commands to view CPU, memory, disk I/O and network activities. 2) Track performance indicators: monitor key indicators such as query number per second, average query time and cache hit rate. 3) Ensure query execution optimization: Enable slow query logs, record and optimize queries whose execution time exceeds the set threshold.

Compare and contrast MySQL and MariaDB.Compare and contrast MySQL and MariaDB.Apr 26, 2025 am 12:08 AM

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

How does MySQL's licensing compare to other database systems?How does MySQL's licensing compare to other database systems?Apr 25, 2025 am 12:26 AM

MySQL uses a GPL license. 1) The GPL license allows the free use, modification and distribution of MySQL, but the modified distribution must comply with GPL. 2) Commercial licenses can avoid public modifications and are suitable for commercial applications that require confidentiality.

When would you choose InnoDB over MyISAM, and vice versa?When would you choose InnoDB over MyISAM, and vice versa?Apr 25, 2025 am 12:22 AM

The situations when choosing InnoDB instead of MyISAM include: 1) transaction support, 2) high concurrency environment, 3) high data consistency; conversely, the situation when choosing MyISAM includes: 1) mainly read operations, 2) no transaction support is required. InnoDB is suitable for applications that require high data consistency and transaction processing, such as e-commerce platforms, while MyISAM is suitable for read-intensive and transaction-free applications such as blog systems.

Explain the purpose of foreign keys in MySQL.Explain the purpose of foreign keys in MySQL.Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools