Home Database Mysql Tutorial 【只读表空间--恢复-1】

【只读表空间--恢复-1】

Jun 07, 2016 pm 04:12 PM
read only backup recover Fault number space

1只读 ---备份只读 故障 只读 还原有故障的数据文件 2只读 ---备份只读 可写 故障 还原备份数据文件,重做recover 3只读 ---备份可写 只读 故障 还原备份数据文件,recover 1 进入rman,确保是否有备份的文件: [oracle@oracle ~]$ rman target /Recovery Man

1>只读 ---备份只读 故障 只读 还原有故障的数据文件
2>只读 ---备份只读 可写 故障 还原备份数据文件,重做recover
3>只读 ---备份可写 只读 故障 还原备份数据文件,recover
1>
进入rman,确保是否有备份的文件:
[oracle@oracle ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Nov 6 09:44:08 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JADL10G (DBID=2011508104)


RMAN> list backup of tablespace users;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 609.23M DISK 00:00:38 06-NOV-14
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20141106T063059
Piece Name: /u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T063059_b5o994hx_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 422818 06-NOV-14 /u01/oracle/oradata/jadl10g/users01.dbf
Copy after login

修改表空间为只读表空间:
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 09:45:35 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options


SQL> alter tablespace users read only;
Tablespace altered.
Copy after login

进入rman,重新备份数据库,删除以前备份的可以节省空间使用delete backup命令可以删除;
[oracle@oracle ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Nov 6 09:50:29 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JADL10G (DBID=2011508104)


RMAN> backup database; --备份数据库
Starting backup at 06-NOV-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=159 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/oracle/oradata/jadl10g/system01.dbf
input datafile fno=00003 name=/u01/oracle/oradata/jadl10g/sysaux01.dbf
input datafile fno=00005 name=/u01/oracle/oradata/jadl10g/example01.dbf
input datafile fno=00002 name=/u01/oracle/oradata/jadl10g/undotbs01.dbf
input datafile fno=00004 name=/u01/oracle/oradata/jadl10g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 06-NOV-14
channel ORA_DISK_1: finished piece 1 at 06-NOV-14
piece handle=/u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T095036_b5onzdz1_.bkp tag=TAG20141106T095036 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 06-NOV-14
channel ORA_DISK_1: finished piece 1 at 06-NOV-14
piece handle=/u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_ncsnf_TAG20141106T095036_b5oo15kf_.bkp tag=TAG20141106T095036 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 06-NOV-14
RMAN> exit
Recovery Manager complete.
Copy after login

删除users表空间(只读的文件)
[oracle@oracle ~]$ rm /u01/oracle/oradata/jadl10g/users01.dbf
连接到DB,执行查询发现报错:
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 09:52:33 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options


SQL> select * from scott.dept;
select * from scott.dept
*
ERROR at line 1:
ORA-01116: error in opening database file 4
ORA-01110: data file 4: '/u01/oracle/oradata/jadl10g/users01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3


SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
Copy after login

连接到rman:
[oracle@oracle ~]$ rman target /


Recovery Manager: Release 10.2.0.5.0 - Production on Thu Nov 6 09:53:40 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JADL10G (DBID=2011508104)


RMAN> sql 'alter database datafile 4 offline '; --数据文件脱机
using target database control file instead of recovery catalog
sql statement: alter database datafile 4 offline


RMAN> restore datafile 4; --恢复数据文件,此处可以是文件的路径 restore datafile '/u01/oracle/oradata/jadl10g/users01.dbf';
Starting restore at 06-NOV-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=136 devtype=DISK


channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /u01/oracle/oradata/jadl10g/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T095036_b5onzdz1_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T095036_b5onzdz1_.bkp tag=TAG20141106T095036
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 06-NOV-14


RMAN> sql 'alter database datafile 4 online '; ---连接数据文件


sql statement: alter database datafile 4 online


RMAN> exit
Recovery Manager complete.
Copy after login

连接到DB,执行查询发现可以查询到结果:
[oracle@oracle ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 09:55:00 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options


SQL> select * from scott.dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
2>
Copy after login

连接DB,修改表空间为可写:
[oracle@oracle ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 10:04:27 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Editio【本文来自鸿网互联 (http://www.68idc.cn)】n Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options


SQL> alter tablespace users read write;
Tablespace altered.


SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
Copy after login

删除users表空间(可写的表空间):
[oracle@oracle ~]$ rm /u01/oracle/oradata/jadl10g/users01.dbf
连接到DB,执行查询发现报错:
[oracle@oracle ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 10:05:32 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options


SQL> select * from scott.dept;
select * from scott.dept
*
ERROR at line 1:
ORA-01116: error in opening database file 4
ORA-01110: data file 4: '/u01/oracle/oradata/jadl10g/users01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options
Copy after login

连接到rman:
[oracle@oracle ~]$ rman target /


Recovery Manager: Release 10.2.0.5.0 - Production on Thu Nov 6 10:06:31 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JADL10G (DBID=2011508104)


RMAN> sql 'alter database datafile 4 offline ';


using target database control file instead of recovery catalog
sql statement: alter database datafile 4 offline


RMAN> restore datafile 4;


Starting restore at 06-NOV-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=159 devtype=DISK


channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /u01/oracle/oradata/jadl10g/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T095036_b5onzdz1_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/oracle/flash_recovery_area/JADL10G/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T095036_b5onzdz1_.bkp tag=TAG20141106T095036
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 06-NOV-14


RMAN> recover datafile 4;


Starting recover at 06-NOV-14
using channel ORA_DISK_1


starting media recovery
media recovery complete, elapsed time: 00:00:03


Finished recover at 06-NOV-14


RMAN> sql 'alter database datafile 4 online ';


sql statement: alter database datafile 4 online


RMAN> exit
Recovery Manager complete.
Copy after login

连接到DB,执行查询发现可以查询到结果:
[oracle@oracle ~]$ sqlplus / as sysdba


SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 6 10:08:18 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options


SQL> select * from scott.dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
Copy after login

 

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 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
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
1669
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
How to restore chat spark on TikTok How to restore chat spark on TikTok Mar 16, 2024 pm 01:25 PM

On Douyin, a short video platform full of creativity and vitality, we can not only enjoy a variety of exciting content, but also have in-depth communications with like-minded friends. Among them, chat sparks are an important indicator of the intensity of interaction between the two parties, and they often inadvertently ignite the emotional bonds between us and our friends. However, sometimes due to some reasons, the chat spark may be disconnected. So what should we do if we want to restore the chat spark? This tutorial guide will bring you a detailed introduction to the content strategy, hoping to help everyone. How to restore the spark of Douyin chat? 1. Open the Douyin message page and select a friend to chat. 2. Send messages and chat to each other. 3. If you send messages continuously for 3 days, you can get the spark logo. On a 3-day basis, send pictures or videos to each other

What should I do if my Black Shark phone cannot be turned on? Teach you how to save yourself! What should I do if my Black Shark phone cannot be turned on? Teach you how to save yourself! Mar 23, 2024 pm 04:06 PM

What should I do if my Black Shark phone cannot be turned on? Teach you how to save yourself! In our daily lives, mobile phones have become an indispensable part of us. For many people, the Black Shark mobile phone is a beloved gaming phone. But it is inevitable that you will encounter various problems, one of which is that the phone cannot be turned on. When you encounter such a situation, don't panic. Here are some solutions that I hope will help you. First of all, when the Black Shark phone cannot be turned on, first check whether the phone has enough power. It may be that the phone cannot be turned on due to exhausted battery.

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.

How to install, uninstall, and reset Windows server backup How to install, uninstall, and reset Windows server backup Mar 06, 2024 am 10:37 AM

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

Black Shark mobile phone charging troubleshooting and solutions Black Shark mobile phone charging troubleshooting and solutions Mar 22, 2024 pm 09:03 PM

Black Shark is a smartphone brand known for its powerful performance and excellent gaming experience. It is loved by gamers and technology enthusiasts. However, just like other smartphones, Black Shark phones will have various problems, among which charging failure is a common one. Charging failure will not only affect the normal use of the mobile phone, but may also cause more serious problems, so it is very important to solve the charging problem in time. This article will start with the common causes of Black Shark mobile phone charging failures and introduce methods to troubleshoot and solve charging problems. I hope it can help readers solve the problem of Black Shark mobile phones.

How to recover deleted emmo diary How to recover deleted emmo diary Feb 27, 2024 pm 04:40 PM

Emmo Diary is a software specially designed for recording your mood. It provides you with a private diary space, allowing you to record important or trivial things every day. Through unique emotion recognition technology, Emmo Diary can also help you better understand and deal with your emotions. But sometimes I find that my diary has been deleted by mistake and I don’t know how to restore it. So this tutorial guide will bring you a detailed recovery guide, hoping to help everyone in need. How can emmo retrieve his previous diary? 1. Click the [Settings] icon in the lower left corner of the emmo selection screen to enter; 2. Select the [Data Backup and Restore] icon on the screen and enter the operation.

How to restore deleted comments on Xiaohongshu? Any tips for deleted comments? How to restore deleted comments on Xiaohongshu? Any tips for deleted comments? Mar 27, 2024 am 11:56 AM

Xiaohongshu is a popular social e-commerce platform where users can share shopping experiences, life details, etc. During use, some users may experience their comments being deleted. So, how to restore deleted comments on Xiaohongshu? 1. How to restore deleted comments on Xiaohongshu? If it is found that a comment has been deleted by mistake, users can choose to wait for the official Xiaohongshu team to restore it. In this case, it’s best to be patient and wait as the official team may automatically process and resume comments after a while. If you find that a comment has been deleted, consider republishing similar content. But when reposting, please make sure the content complies with Xiaohongshu’s community guidelines to avoid being removed again. 3. Contact Xiaohongshu customer service: If you think your comment has been mistakenly

How to backup system with ghost-ghost backup tutorial How to backup system with ghost-ghost backup tutorial Mar 06, 2024 pm 04:30 PM

Recently, many friends have asked the editor how to back up the system with ghost. Next, let us learn the tutorial on how to back up the system with ghost. I hope it can help everyone. 1. After running Ghost, click "OK", as shown in the figure. 2. Click "Local" → "Partition" → "ToImage" (meaning: local → partition → to image file), as shown in the figure. 3. The Select Local Hard Disk window appears, click the hard disk where the partition to be backed up is located, and then click "OK", as shown in the figure. 4. The Select Source Partition window appears (the source partition is the partition you want to back up), click on the partition where the system is located (usually Zone 1, be sure to get it right), and then click "OK", as shown in the figure. 5. Play at this time

See all articles