记一次oracle数据库恢复
某客户给sysaux表空间添加了数据文件,但有在操作系统层rm删除了数据文件,更悲催的的是之前归档所在的磁盘损坏,恢复所需要的归档那是没指望了,也一年多没进行
某客户给sysaux表空间添加了数据文件,但有在操作系统层rm 删除了数据文件,更悲催的的是之前归档所在的磁盘损坏,恢复所需要的归档那是没指望了,也一年多没进行过数据库备份了,
现记录恢复过程如下:(虚拟机上重新模拟该恢复过程)
1 数据文件状态如下
SQL> select file#,name,status from v$datafile;
FILE# NAME STATUS
---------- ---------------------------------------- -------
1 /oracle/CRM/ZBCRM/system01.dbf SYSTEM
2 /oracle/CRM/ZBCRM/sysaux01.dbf ONLINE
3 /oracle/CRM/ZBCRM/undotbs01.dbf ONLINE
4 /oracle/CRM/ZBCRM/users01.dbf ONLINE
5 /oracle/CRM/ZBCRM/sysaux02.dbf RECOVER
2 重新生成操作系统层删除的数据文件
SQL> alter database create datafile '/oracle/CRM/ZBCRM/sysaux02.dbf';
Database altered.
注意,香港服务器,当我们用 alter database create datafile 创建数据文件时,数据文件头部scn以及rba.seq号均取自于该数据文件创建时控制文件中记录的scn和rba.seq号.
3 此刻数据文件头部信息如下:
SQL> select hxfil,fhscn,fhrba_seq from x$kcvfh;
HXFIL FHSCN FHRBA_SEQ
---------- ---------------- ----------
1 1047892 18
2 1047892 18
3 1047892 18
4 1047892 18
5 1026926 1
这里可以明确看出5号数据文件恢复需要从seq号为1的归档开始恢复,香港空间,但实际上seq#=1及其之后的归档已经不存在了,虚拟主机,所以如下恢复失败:
SQL> recover datafile 5;
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 5: '/oracle/CRM/ZBCRM/sysaux02.dbf'
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/oracle/CRM/ZBCRM/sysaux02.dbf'
4 用bbed调整5号数据文件如下几个偏移量
ub4 kcvfhcpc @140 ------检查点计数
ub4 kcvfhccc @148 ------总是比检查点计数少1
ub4 kcvcptim @492 ------检查点时间
ub4 kscnbas @484 ------scn的低位
ub2 kscnwrp @488 ------scn的高位
[oracle@oracle ~]$ bbed parfile=bbed.par
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Thu Jul 25 14:26:45 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

Oracle database paging uses ROWNUM pseudo-columns or FETCH statements to implement: ROWNUM pseudo-columns are used to filter results by row numbers and are suitable for complex queries. The FETCH statement is used to get the specified number of first rows and is suitable for simple queries.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

The steps to open an Oracle database are as follows: Open the Oracle database client and connect to the database server: connect username/password@servername Use the SQLPLUS command to open the database: SQLPLUS
