Home Database Mysql Tutorial 丢失所有控制文件,还原所有数据文件,不还原控制文件,recoverd

丢失所有控制文件,还原所有数据文件,不还原控制文件,recoverd

Jun 07, 2016 pm 03:57 PM
lost control data document illustrate reduction

说明:创建表test03,切换日志,创建表test04,切换日志,删除所有数据文件,还原备份的所有数据文件,不需要还原控制文件;test03的归档日志没有丢失,test04的归档日志丢失,不能恢复test04 1、数据库所有控制文件丢失 2、还原备份之前的控制文件,数据文

说明:创建表test03,切换日志,创建表test04,切换日志,删除所有数据文件,还原备份的所有数据文件,不需要还原控制文件;test03的归档日志没有丢失,test04的归档日志丢失,不能恢复test04
1、数据库所有控制文件丢失 2、还原备份之前的控制文件,数据文件没做还原 3、until cancel using bakup controlfile跑部分归档日志
(1)一致性的全备
SQL> shutdown immediate;

# mkdir -p /oradata/bossbak/20140609allbackup
# cp -rf $ORACLE_BASE/oradata/boss/*.dbf /oradata/bossbak/20140609allbackup
# cp -rf $ORACLE_BASE/oradata/boss/*.ctl /oradata/bossbak/20140609allbackup
# cp -rf $ORACLE_HOME/dbs/spfileboss.ora /oradata/bossbak/20140609
# cd /oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/
# rm -rf *

(2)查看数据库的信息
SQL> select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
UNDOTBS1 ONLINE
SYSAUX ONLINE
TEMP ONLINE
USERS ONLINE
EXAMPLE ONLINE
TESTTBS01 ONLINE
TESTTBS02 OFFLINE
TESTTBS03 READ ONLY

SQL> select table_name,status,tablespace_name from user_tables where tablespace_name like 'TESTTBS%';

TABLE_NAME STATUS TABLESPACE_NAME
------------------------------ -------- ------------------------------
TEST01 VALID TESTTBS01
BOSS_NEW_TEST VALID TESTTBS01

(3)创建表test03,插入数据
SQL> create table test03 (id number, name varchar2(30)) tablespace testtbs01;
SQL> insert into test03 values(1, '11111');
SQL> insert into test03 values(2,'22222');
SQL> insert into test03 values(3,'33333');
SQL> insert into test03 values(1, '11111');
SQL> insert into test03 values(2,'22222');
SQL> insert into test03 values(3,'33333');
SQL> commit;

(4)进行日志切换
SQL> alter system switch logfile;
SQL> select group#,members,sequence#,archived,status,first_change# from v$log;

GROUP# MEMBERS SEQUENCE# ARC STATUS FIRST_CHANGE#
---------- ---------- ---------- --- ---------------- -------------
1 1 2 YES INACTIVE 675131
2 1 4 NO CURRENT 700583
3 1 3 YES ACTIVE 699759
SQL> alter system switch logfile;
SQL> alter system switch logfile;

SQL> create table test04 (id number, name varchar2(30)) tablespace testtbs01;
SQL> insert into test04 values(1, '11111');
SQL> insert into test04 values(2,'22222');
SQL> insert into test04 values(3,'33333');
SQL> commit;

SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;


SQL> select group#,members,sequence#,archived,status,first_change# from v$log;

GROUP# MEMBERS SEQUENCE# ARC STATUS FIRST_CHANGE#
---------- ---------- ---------- --- ---------------- -------------
1 1 8 YES INACTIVE 704201
2 1 7 YES INACTIVE 704199
3 1 9 NO CURRENT 704204

(5)备份全备后所有的归档日志
# pwd
/oracle/flash_recovery_area/BOSS/archivelog/2014_06_09
# cp -rf *.arc /oradata/bossbak/20140609

(6)删除全部归档,删除全部数据文件
# rm -rf *.arc

(7)关闭数据库
SQL> shutdown abort;
ORACLE instance shut down.

SQL> startup open;
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/oracle/oradata/boss/system01.dbf'
(8)还原备份的数据文件,不需要恢复控制文件
$ cp -rf *.dbf /oracle/oradata/boss

SQL> col "文件名" for a40
SQL> set linesize 150
SQL> select
2 ts.name "表空间名"
3 , df.file# "文件号"
4 , df.checkpoint_change# "检查点"
5 , df.name "文件名"
6 , df.status "在线状态"
7 , rf.error "恢复原因"
8 , rf.change# "系统变更号"
9 , rf.time
10 from v$tablespace ts,v$datafile df,v$recover_file rf
11 where ts.ts#=df.ts# and df.file#=rf.file#
12 order by df.file#;
#####最近一次数据库正常启动后的scn
表空间名 文件号 检查点 文件名 在线状 恢复原因 系统变更号 TIME
------------------------------ ---------- ---------- ---------------------------------------- ------- ------------------ ---------- ------------
SYSTEM 1 704204 /oracle/oradata/boss/system01.dbf SYSTEM FILE NOT FOUND 0
UNDOTBS1 2 704204 /oracle/oradata/boss/undotbs01.dbf ONLINE FILE NOT FOUND 0
SYSAUX 3 704204 /oracle/oradata/boss/sysaux01.dbf ONLINE FILE NOT FOUND 0
USERS 4 704204 /oracle/oradata/boss/users01.dbf ONLINE FILE NOT FOUND 0
EXAMPLE 5 704204 /oracle/oradata/boss/example01.dbf ONLINE FILE NOT FOUND 0
TESTTBS01 6 704204 /oracle/oradata/boss/testtbs01_01.dbf ONLINE FILE NOT FOUND 0
TESTTBS01 7 704204 /oracle/oradata/boss/testtbs01_02.dbf ONLINE FILE NOT FOUND 0
TESTTBS02 8 652783 /oracle/oradata/boss/testtbs02_01.dbf OFFLINE OFFLINE NORMAL 0
TESTTBS03 9 652799 /oracle/oradata/boss/testtbs03_01.dbf ONLINE FILE NOT FOUND 0

SQL> col name for a40
SQL> select file#,name,status,CHECKPOINT_CHANGE#,recover from v$datafile_header;


FILE# NAME STATUS CHECKPOINT_CHANGE# REC
---------- ---------------------------------------- ------- ------------------ ---
1 ONLINE 0
2 ONLINE 0
3 ONLINE 0
4 ONLINE 0
5 ONLINE 0
6 ONLINE 0
7 ONLINE 0
8 OFFLINE 0
9 ONLINE 0

(9)复制部分的归档日志,基于终止恢复
# cp -rf o1_mf_1_3_9sbbrfsx_.arc o1_mf_1_4_9sbbsn5j_.arc /oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/

# cat boss_dbw0_8622.trc
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/oracle/oradata/boss/system01.dbf'
ORA-27041: unable to open file
Linux Error: 13: Permission denied

SQL> col name for a40;
SQL> set linesize 120;
SQL> select file#,name,status,CHECKPOINT_CHANGE#,recover from v$datafile_header;

FILE# NAME STATUS CHECKPOINT_CHANGE# REC
---------- ---------------------------------------- ------- ------------------ ---
1 /oracle/oradata/boss/system01.dbf ONLINE 700222 YES
2 /oracle/oradata/boss/undotbs01.dbf ONLINE 700222 YES
3 /oracle/oradata/boss/sysaux01.dbf ONLINE 700222 YES
4 /oracle/oradata/boss/users01.dbf ONLINE 700222 YES
5 /oracle/oradata/boss/example01.dbf ONLINE 700222 YES
6 /oracle/oradata/boss/testtbs01_01.dbf ONLINE 700222 YES
7 /oracle/oradata/boss/testtbs01_02.dbf ONLINE 700222 YES
8 OFFLINE 0
9 /oracle/oradata/boss/testtbs03_01.dbf ONLINE 652799

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/oracle/oradata/boss/system01.dbf'

SQL> recover database until cancel;
ORA-00279: change 700222 generated at 06/09/2014 11:16:10 needed for thread 1
ORA-00289: suggestion : /oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/o1_mf_1_3_%u_.arc
ORA-00280: change 700222 for thread 1 is in sequence #3


Specify log: {=suggested | filename | AUTO | CANCEL}

# ll
总用量 1047064
-rw-r----- 1 oracle oinstall 7094272 6月 9 11:21 control02.ctl
-rw-r----- 1 oracle oinstall 7094272 6月 9 11:21 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 6月 9 11:19 example01.dbf
-rw-r----- 1 oracle oinstall 622080 6月 9 12:38 o1_mf_1_3_9sbbrfsx_.arc
-rw-r----- 1 oracle oinstall 11264 6月 9 12:38 o1_mf_1_4_9sbbsn5j_.arc
-rw-r----- 1 oracle oinstall 2560 6月 9 12:38 o1_mf_1_5_9sbbst96_.arc
-rw-r----- 1 oracle oinstall 4336640 6月 9 12:38 o1_mf_1_6_9sbgg5or_.arc
-rw-r----- 1 oracle oinstall 1024 6月 9 12:38 o1_mf_1_7_9sbgg862_.arc
-rw-r----- 1 oracle oinstall 2560 6月 9 12:38 o1_mf_1_8_9sbggfm7_.arc

# cp -rf o1_mf_1_3_9sbbrfsx_.arc o1_mf_1_4_9sbbsn5j_.arc /oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/

SQL> recover database until cancel;
ORA-00279: change 700222 generated at 06/09/2014 11:16:10 needed for thread 1
ORA-00289: suggestion : /oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/o1_mf_1_3_%u_.arc
ORA-00280: change 700222 for thread 1 is in sequence #3


Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 700583 generated at 06/09/2014 11:33:33 needed for thread 1
ORA-00289: suggestion : /oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/o1_mf_1_4_%u_.arc
ORA-00280: change 700583 for thread 1 is in sequence #4
ORA-00278: log file '/oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/o1_mf_1_3_9sbbrfsx_.arc' no longer needed
for this recovery


ORA-00279: change 700603 generated at 06/09/2014 11:34:12 needed for thread 1
ORA-00289: suggestion : /oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/o1_mf_1_5_%u_.arc
ORA-00280: change 700603 for thread 1 is in sequence #5
ORA-00278: log file '/oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/o1_mf_1_4_9sbbsn5j_.arc' no longer needed
for this recovery


ORA-00308: cannot open archived log '/oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/o1_mf_1_5_9sbbst96_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

SQL> recover database until cancel;
ORA-00279: change 700603 generated at 06/09/2014 11:34:12 needed for thread 1
ORA-00289: suggestion : /oracle/flash_recovery_area/BOSS/archivelog/2014_06_09/o1_mf_1_5_%u_.arc
ORA-00280: change 700603 for thread 1 is in sequence #5


Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.

SQL> alter database open resetlogs;

SQL> select * from test03;

ID NAME
---------- ----------------------------------------
1 11111
2 22222
3 33333

SQL> select * from test04;
select * from test04
*
ERROR at line 1:
ORA-00942: table or view does not exist

Statement of this Website
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

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 Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
Use ddrescue to recover data on Linux Use ddrescue to recover data on Linux Mar 20, 2024 pm 01:37 PM

DDREASE is a tool for recovering data from file or block devices such as hard drives, SSDs, RAM disks, CDs, DVDs and USB storage devices. It copies data from one block device to another, leaving corrupted data blocks behind and moving only good data blocks. ddreasue is a powerful recovery tool that is fully automated as it does not require any interference during recovery operations. Additionally, thanks to the ddasue map file, it can be stopped and resumed at any time. Other key features of DDREASE are as follows: It does not overwrite recovered data but fills the gaps in case of iterative recovery. However, it can be truncated if the tool is instructed to do so explicitly. Recover data from multiple files or blocks to a single

Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation! Open source! Beyond ZoeDepth! DepthFM: Fast and accurate monocular depth estimation! Apr 03, 2024 pm 12:04 PM

0.What does this article do? We propose DepthFM: a versatile and fast state-of-the-art generative monocular depth estimation model. In addition to traditional depth estimation tasks, DepthFM also demonstrates state-of-the-art capabilities in downstream tasks such as depth inpainting. DepthFM is efficient and can synthesize depth maps within a few inference steps. Let’s read about this work together ~ 1. Paper information title: DepthFM: FastMonocularDepthEstimationwithFlowMatching Author: MingGui, JohannesS.Fischer, UlrichPrestel, PingchuanMa, Dmytr

Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Apr 01, 2024 pm 07:46 PM

The performance of JAX, promoted by Google, has surpassed that of Pytorch and TensorFlow in recent benchmark tests, ranking first in 7 indicators. And the test was not done on the TPU with the best JAX performance. Although among developers, Pytorch is still more popular than Tensorflow. But in the future, perhaps more large models will be trained and run based on the JAX platform. Models Recently, the Keras team benchmarked three backends (TensorFlow, JAX, PyTorch) with the native PyTorch implementation and Keras2 with TensorFlow. First, they select a set of mainstream

What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code. What to do if the 0x80004005 error code appears. The editor will teach you how to solve the 0x80004005 error code. Mar 21, 2024 pm 09:17 PM

When deleting or decompressing a folder on your computer, sometimes a prompt dialog box "Error 0x80004005: Unspecified Error" will pop up. How should you solve this situation? There are actually many reasons why the error code 0x80004005 is prompted, but most of them are caused by viruses. We can re-register the dll to solve the problem. Below, the editor will explain to you the experience of handling the 0x80004005 error code. Some users are prompted with error code 0X80004005 when using their computers. The 0x80004005 error is mainly caused by the computer not correctly registering certain dynamic link library files, or by a firewall that does not allow HTTPS connections between the computer and the Internet. So how about

Slow Cellular Data Internet Speeds on iPhone: Fixes Slow Cellular Data Internet Speeds on iPhone: Fixes May 03, 2024 pm 09:01 PM

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! May 06, 2024 pm 04:13 PM

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile

Alibaba 7B multi-modal document understanding large model wins new SOTA Alibaba 7B multi-modal document understanding large model wins new SOTA Apr 02, 2024 am 11:31 AM

New SOTA for multimodal document understanding capabilities! Alibaba's mPLUG team released the latest open source work mPLUG-DocOwl1.5, which proposed a series of solutions to address the four major challenges of high-resolution image text recognition, general document structure understanding, instruction following, and introduction of external knowledge. Without further ado, let’s look at the effects first. One-click recognition and conversion of charts with complex structures into Markdown format: Charts of different styles are available: More detailed text recognition and positioning can also be easily handled: Detailed explanations of document understanding can also be given: You know, "Document Understanding" is currently An important scenario for the implementation of large language models. There are many products on the market to assist document reading. Some of them mainly use OCR systems for text recognition and cooperate with LLM for text processing.

See all articles