Local rman backup and recovery test

Source: Internet
Author: User

-- Rman backup full database:
C: \ Documents ents and Settings \ Administrator> set oracle_sid = ora10
C: \ Documents ents and Settings \ Administrator> rman target/
RMAN> backup database format 'd: \ BACKUP1 \ % U ';
-- Compression backup:
RMAN> backup as compressed backupset database format 'd: \ BACKUP1 \ % U ';
Start backup from 10-9-11
Use the target database control file to replace the recovery directory
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 135 devtype = DISK
Channel ORA_DISK_1: Start all data file backup Sets
Channel ORA_DISK_1: Specifies the data file in the backup set.
Input data file fno = 00001 name = D: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORA10 \ SYSTEM01.DBF
Input data file fno = 00003 name = D: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORA10 \ SYSAUX01.DBF
Input data file fno = 00004 name = D: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORA10 \ USERS01.DBF
Input data file fno = 00002 name = D: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORA10 \ UNDOTBS01.DBF
Input data file fno = 00005 name = D: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORA10 \ EXAMPLE01.DBF
Channel ORA_DISK_1: Starting segment 1 from April 9 to April 11
Channel ORA_DISK_1: Completed from month 1 to month 11
Segment handle = D: \ BACKUP1 \ 0UMM7N25 flag = tag20151110t2000013 annotation = NONE
Channel ORA_DISK_1: Backup set completed. elapsed time: 00: 01: 46
The backup task is completed from April 9 to April 11.
Start Control File and SPFILE Autobackup from April 9 to April 11.
Segment handle = D: \ BACKUP1 \ C-739034189-20110910-01 comment = NONE
The Control File and SPFILE Autobackup tasks are completed from Month 9 to month 11.
-- Display backup set:
RMAN> list backup of database;
 
-- Restore Test
C: \ Documents and Settings \ Administrator> sqlplus/nolog;
SQL> conn/as sysdba #### the database has been connected and closed by the dba user
Connected.
SQL> shutdown immediate;
-- Delete a data file:
SQL> host del D: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ USERS01.DBF;
SQL> startup;
The ORACLE routine has been started.
Total System Global Area 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 205523844 bytes
Database Buffers 398458880 bytes
Redo Buffers 7135232 bytes
The database has been loaded.
ORA-01157: unable to identify/lock data file 4-see DBWR trace file
ORA-01110: data file 4: 'd: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORA10 \ USERS01.DBF'
 
-- Restore with rman:
C: \ Documents ents and Settings \ Administrator> set oracle_sid = ora10
C: \ Documents ents and Settings \ Administrator> rman target/
Recovery MANAGER: Release 10.2.0.1.0-Production on Saturday September 10 22:30:09 2011
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected to the target database: ORA10 (DBID = 739034189, not enabled)
 
RMAN> restore datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ USERS01.DBF ';
Start restore from 10-9-11
Use the target database control file to replace the recovery directory
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 155 devtype = DISK
Channel ORA_DISK_1: Recovering data file backup set
Channel ORA_DISK_1: Specifies the data file to be recovered from the backup set.
Restoring data file 00004 to D: \ ORACLE \ PRODUCT \ 10.2.0 \ ORADATA \ ORA10 \ USERS01.DBF
Channel ORA_DISK_1: Reading the backup segment D: \ BACKUP1 \ 14MM7NJ1
Channel ORA_DISK_1: recovered backup segment 1
Segment handle = D: \ BACKUP1 \ 14MM7NJ1 flag = tag20151110t211513
Channel ORA_DISK_1: Recovery completed, time: 00:00:16
The restore is completed from 10-9 months to 11 months.
 
RMAN> recover datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ USERS01.DBF ';
Start recover from 10-9-11
Use channel ORA_DISK_1
Restoring media...
Media Recovery completed. Time: 00:00:01
The recover is completed between 10-9 months and 11 months.
 
RMAN> alter database open;
Database opened
 
-- For the recovery statement, see:
C: \ Documents ents and Settings \ Administrator> set oracle_sid = ora10
C: \ Documents ents and Settings \ Administrator> rman target/
RMAN> restore datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ USERS01.DBF ';
RMAN> recover datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ USERS01.DBF ';
RMAN> alter database open;
-- EXAMPLE01.DBF file restoration method is the same as USERS01.DBF
 
-- Restore the SYSAUX01.DBF and SYSTEM01.DBF files according to the following (startup more ):
SQL> host del D: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ SYSAUX01.DBF
RMAN> startup
RMAN> restore datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ SYSAUX01.DBF ';
RMAN> recover datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ SYSAUX01.DBF ';
RMAN> alter database open;
SQL> host del D: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ SYSTEM01.DBF
RMAN> startup
RMAN> restore datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ SYSTEM01.DBF ';
RMAN> recover datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ SYSTEM01.DBF ';
RMAN> alter database open;
-- Delete control file:
SQL> host del D: \ oracle \ product \ 10.2.0 \ oradata \ ora10 \ CONTROL *;
-- Restore with rman:
C: \ Documents ents and Settings \ Administrator> set oracle_sid = ora10
C: \ Documents ents and Settings \ Administrator> rman target/
RMAN> set dbid 739034189 --- 3391142503 is the dbid displayed when you log on to rman.
Executing command: SET DBID
RMAN> startup
RMAN> restore controlfile from 'd: \ backup1 \ C-739034189-20110910-06; -- backup control file created
If Automatic Backup is enabled, you can use restore controlfile from autobackup.
RMAN> SQL 'alter database mount ';
RMAN> restore database;
RMAN> recover database;
RMAN> SQL 'alter database open resetlogs ';
RMAN>
 
-- Delete three groups of log files:
C: \ Documents ents and Settings \ Administrator> sqlplus "/as sysdba"
-- Close the database
SQL> shutdown immediate;
-- Delete 6 log files under D: \ oracle \ product \ 10.2.0 \ oradata \ ora10
-- Restart the listener before starting mount. lsnrctl enters the listener, stop the listener, and start the listener.
SQL> startup mount;
The ORACLE routine has been started.
Total System Global Area 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 276827012 bytes
Database Buffers 327155712 bytes
Redo Buffers 7135232 bytes
The database has been loaded.
-- Restore database
SQL> recover database until cancel;
Media recovery is completed.
-- Open the database in resetlogs Mode
SQL> alter database open resetlogs;
The database has been changed.
-- D: \ oracle \ product \ 10.2.0 \ oradata \ ora10 Automatic Recovery of 6 log files
SQL> select 8 from dual;
8
----------
8
-- Backup control file
SQL> alter database backup controlfile to trace;
The database has been changed.
-- Switch logs
SQL> alter system switch logfile;
The system has been changed.
SQL> alter system archive log current;
The system has been changed.

Author "srsunbing"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.