RMAN 各种情况下恢复
完全恢复是指当数据文件出现介质失败时,使用RESTORE命令转储备份(到原存放地或可用的设备),然后再使用RECOVER命令将数据文件
一.RMAN 完全恢复
完全恢复是指当数据文件出现介质失败时,使用RESTORE命令转储备份(到原存放地或可用的设备),然后再使用RECOVER命令将数据文件恢复到失败点的状态。
SYSTEM表空间数据文件恢复要求数据库必须在mount状态进行,其他数据文件恢复既可以使数据库在mount状态,也可以是open状态进行;
当需要恢复所有数据文件或者要求在数据库级别恢复时,应该使用完全恢复,这时数据库需启动到mount状态;恢复至原存放地脚本如下(在open状态下运行此脚本):
RMAN> run{
2> startup force mount
3> restore database;
4> recover database;
5> alter database open;
6> }
Oracle 实例已启动
数据库已装载
系统全局区域总计 838860800 字节
Fixed Size 1293384 字节
Variable Size 742392760 字节
Database Buffers 88080384 字节
Redo Buffers 7094272 字节
启动 restore 于 13-5月 -13
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=157 devtype=DISK
通道 ORA_DISK_1: 正在恢复数据文件00007
输入数据文件副本 recid=36 stamp=815324562 文件名=D:\BACKUP\ORCL_124.BAK
数据文件 00007 的恢复目标: D:\RMAN.DBF
通道 ORA_DISK_1: 已复制数据文件 00007 的数据文件副本
输出文件名=D:\RMAN.DBF recid=37 stamp=815324790
通道 ORA_DISK_1: 正在开始恢复数据文件备份集
通道 ORA_DISK_1: 正在指定从备份集恢复的数据文件
正将数据文件00002恢复到E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
正将数据文件00003恢复到E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
正将数据文件00004恢复到E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
正将数据文件00005恢复到E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF
通道 ORA_DISK_1: 正在读取备份段 D:\ORCL_1318810635_112
通道 ORA_DISK_1: 已恢复备份段 1
段句柄 = D:\ORCL_1318810635_112 标记 = TAG20130513T144801
通道 ORA_DISK_1: 恢复完成, 用时: 00:01:36
通道 ORA_DISK_1: 正在开始恢复数据文件备份集
通道 ORA_DISK_1: 正在指定从备份集恢复的数据文件
正将数据文件00001恢复到E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
通道 ORA_DISK_1: 正在读取备份段 D:\BACKUP\ORCL_116.BAK
通道 ORA_DISK_1: 已恢复备份段 1
段句柄 = D:\BACKUP\ORCL_116.BAK 标记 = TAG20130513T145621
通道 ORA_DISK_1: 恢复完成, 用时: 00:00:46
完成 restore 于 13-5月 -13
启动 recover 于 13-5月 -13
使用通道 ORA_DISK_1
正在开始介质的恢复
介质恢复完成, 用时: 00:00:10
完成 recover 于 13-5月 -13
数据库已打开
恢复系统表空间至原存放地脚本如下
RMAN> run{
2> startup force mount
3> restore tablespace system;
4> recover tablespace system;
5> alter database open;
6> }
Oracle 实例已启动
数据库已装载
系统全局区域总计 838860800 字节
Fixed Size 1293384 字节
Variable Size 750781368 字节
Database Buffers 79691776 字节
Redo Buffers 7094272 字节
启动 restore 于 13-5月 -13
使用目标数据库控制文件替代恢复目录
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=156 devtype=DISK
通道 ORA_DISK_1: 正在开始恢复数据文件备份集
通道 ORA_DISK_1: 正在指定从备份集恢复的数据文件
正将数据文件00001恢复到E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
通道 ORA_DISK_1: 正在读取备份段 D:\BACKUP\ORCL_116.BAK
通道 ORA_DISK_1: 已恢复备份段 1
段句柄 = D:\BACKUP\ORCL_116.BAK 标记 = TAG20130513T145621
通道 ORA_DISK_1: 恢复完成, 用时: 00:00:55
完成 restore 于 13-5月 -13
启动 recover 于 13-5月 -13
使用通道 ORA_DISK_1
正在开始介质的恢复
存档日志线程 1 序列 661 已作为文件 F:\RMANBACKUP\ORCL\ARCHIVELOG\2013_05_13\O1_MF_1_661_8S13VN1G_.ARC 存在于磁盘上
存档日志线程 1 序列 662 已作为文件 F:\RMANBACKUP\ORCL\ARCHIVELOG\2013_05_13\O1_MF_1_662_8S14DQ98_.ARC 存在于磁盘上
存档日志线程 1 序列 663 已作为文件 F:\RMANBACKUP\ORCL\ARCHIVELOG\2013_05_13\O1_MF_1_663_8S14XX0Z_.ARC 存在于磁盘上
存档日志文件名 =F:\RMANBACKUP\ORCL\ARCHIVELOG\2013_05_13\O1_MF_1_661_8S13VN1G_.ARC 线程 =1 序列 =661
介质恢复完成, 用时: 00:00:04
完成 recover 于 13-5月 -13
数据库已打开
恢复系统表空间数据至其他可用设备
RMAN> run{
2> startup force mount
3> set newname for datafile 1 to 'd:\system01.dbf';
4> restore datafile 1;
5> switch datafile 1;
6> recover datafile 1;
7> alter database open;
8> }
Oracle 实例已启动
数据库已装载
系统全局区域总计 838860800 字节
Fixed Size 1293384 字节
Variable Size 754975672 字节
Database Buffers 75497472 字节
Redo Buffers 7094272 字节
正在执行命令: SET NEWNAME

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

AI Hentai Generator
Generate AI Hentai for free.

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

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

How to integrate GoWebSocket with a database: Set up a database connection: Use the database/sql package to connect to the database. Store WebSocket messages to the database: Use the INSERT statement to insert the message into the database. Retrieve WebSocket messages from the database: Use the SELECT statement to retrieve messages from the database.

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

Use the DataAccessObjects (DAO) library in C++ to connect and operate the database, including establishing database connections, executing SQL queries, inserting new records and updating existing records. The specific steps are: 1. Include necessary library statements; 2. Open the database file; 3. Create a Recordset object to execute SQL queries or manipulate data; 4. Traverse the results or update records according to specific needs.

PHP database connection guide: MySQL: Install the MySQLi extension and create a connection (servername, username, password, dbname). PostgreSQL: Install the PgSQL extension and create a connection (host, dbname, user, password). Oracle: Install the OracleOCI8 extension and create a connection (servername, username, password). Practical case: Obtain MySQL data, PostgreSQL query, OracleOCI8 update record.

Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.
