Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Oracle Database 11g.pdf
Скачиваний:
78
Добавлен:
10.06.2015
Размер:
12.69 Mб
Скачать

718  Appendix A  n  Lab Exercises

13.Bring the datafile online using the RMAN sql command calling the SQL statement alter database datafile online.

RMAN> sql ‘alter database datafile 4 online’; sql statement: alter database datafile 4 online

The datafile has been restored online and the lab is complete.

Lab 6.2: Performing a Change-Based Recovery with RMAN

In this activity, you will restore the database to a specific SCN, or system change number. This activity builds on the backup done in Exercise 4.2 in Chapter 4. You should have completed Exercise 4.2 prior to executing this activity. Please note that the output you experience from this exercise will probably differ from the output shown here.

1.Start SQL*Plus.

C:\oracle>sqlplus sys as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Fri Oct 3 00:35:25 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.

Enter password:

2.The database should already be started. If not, start it with the startup command. To determine the current SCN, issue the following query:

SQL> select current_scn from v$database; CURRENT_SCN

-----------

1095172

This is the SCN that we will recover to. Your SCN is likely to be very different.

3.Start RMAN. We will assume you are not using a recovery catalog during this exercise.

C:\oracle>rman target=/

Recovery Manager: Release 11.1.0.6.0 - Production on Fri Oct 3 00:37:44 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.

4.To prepare for the restore, put the database in MOUNT mode with the startup force mount RMAN command.

RMAN> startup force mount Oracle instance started

Lab 6.2: Performing a Change-Based Recovery with RMAN 

719

database mounted

 

 

 

Total System Global Area

364081152

bytes

 

Fixed Size

1333228

bytes

 

Variable Size

289409044

bytes

 

Database Buffers

67108864

bytes

 

Redo Buffers

6230016

bytes

 

5.Issue the restore database until scn command to restore the database to the SCN identified in step 3. In our case, the command will be restore database until scn 1095172; your command will have a different change number.

RMAN> restore database until scn 1095172; Starting restore at 10/03/2008 11:48:17

using target database control file instead of recovery catalog allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=155 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF

channel ORA_DISK_1: restoring datafile 00002 to C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF

channel ORA_DISK_1: restoring datafile 00003 to C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF

channel ORA_DISK_1: restoring datafile 00004 to C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_4G2Q1YTC_.DBF channel ORA_DISK_1: reading from backup piece C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_10_03 \O1_MF_NNNDF_TAG20081003T001928_4GCGCQQ4_.BKP

channel ORA_DISK_1:

piece handle=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_10_03 \O1_MF_NNNDF_TAG20081003T001928_4GCGCQQ4_.BKP tag=TAG20081003T001928 channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:07:25 Finished restore at 10/03/2008 11:55:44

6.Recover the database with the recover database until scn command. Our command would be recover database until scn 1095172; your command will have a different date and time.

RMAN> recover database until scn 1095172; Starting recover at 10/03/2008 11:57:24

720  Appendix A  n  Lab Exercises

using channel ORA_DISK_1 starting media recovery

archived log for thread 1 with sequence 3 is already on disk as file C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00003_0667012858.001 archived log for thread 1 with sequence 4 is already on disk as file C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_03 \O1_MF_1_4_4GCMC8GV_.ARC

archived log for thread 1 with sequence 1 is already on disk as file C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_03 \O1_MF_1_1_4GCO4G15_.ARC

archived log file name=C:\ORACLE\PRODUCT\11.1.0\DB_1\RDBMS\ARC00003_0667012858.001 thread=1 sequence=3

archived log file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2008_10_03 \O1_MF_1_4_4GCMC8GV_.ARC thread=1 sequence=4

media recovery complete, elapsed time: 00:00:28 Finished recover at 10/03/2008 11:57:54

7.Open the database with the alter database open resetlogs command.

RMAN> alter database open resetlogs; database opened

The database is open. This concludes the exercise.

Lab 6.3: Restoring a Control File from an Autobackup

In this activity, we will simulate loss of a control file and subsequent recovery. This activity builds on the backup done in Exercise 4.2. We assume that you have configured control-file autobackups as done in Exercise 4.1. You should have completed Exercises 4.1 and 4.2 prior to executing this activity. Please note that the output you experience from this exercise will probably differ from the output shown here.

1.Start SQL*Plus.

C:\oracle>sqlplus sys as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Fri Oct 3 00:35:25 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.

Enter password:

Lab 6.3: Restoring a Control File from an Autobackup 

721

2.The database should be started. If not, start the database with the startup force command. From the SQL*Plus prompt, determine the current location of the database control files by issuing the query select name from v$controlfile;.

SQL> select name from v$controlfile; NAME

------------------------------------

C:\ORACLE\ORADATA\ORCL\CONTROL01.CTL

C:\ORACLE\ORADATA\ORCL\CONTROL02.CTL

C:\ORACLE\ORADATA\ORCL\CONTROL03.CTL

3.Shut down the database and exit SQL*Plus.

SQL> shutdown immediate Database closed. Database dismounted.

ORACLE instance shut down. SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

4.From the OS, remove all of the database control files.

C:\oracle>del C:\ORACLE\ORADATA\ORCL\CONTROL01.CTL C:\oracle>del C:\ORACLE\ORADATA\ORCL\CONTROL02.CTL C:\oracle>del C:\ORACLE\ORADATA\ORCL\CONTROL03.CTL

5.Start RMAN.

C:\oracle>rman target=/

Recovery Manager: Release 11.1.0.6.0 - Production on Fri Oct 3 00:37:44 2008

Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database (not started)

6.Try to start up the database. What error do you get?

RMAN> startup

Oracle instance started

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

722  Appendix A  n  Lab Exercises

RMAN-03002: failure of startup command at 10/03/2008 12:09:57

ORA-00205: error in identifying control file, check alert log for more info

7.Issue the restore controlfile from autobackup command from RMAN to restore the control files.

RMAN> restore controlfile from autobackup; Starting restore at 10/03/2008 12:10:24

using target database control file instead of recovery catalog allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=155 device type=DISK

recovery area destination: c:\oracle\flash_recovery_area database name (or database unique name) used for search: ORCL channel ORA_DISK_1: AUTOBACKUP C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_09_28 \O1_MF_S_666651824_4G0KDSG5_.BKP found in the recovery area

AUTOBACKUP search with format “%F” not attempted because DBID was not set channel ORA_DISK_1: restoring control file from AUTOBACKUP C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_09_28 \O1_MF_S_666651824_4G0KDSG5_.BKP

channel ORA_DISK_1: control file restore from AUTOBACKUP complete output file name=C:\ORACLE\ORADATA\ORCL\CONTROL01.CTL

output file name=C:\ORACLE\ORADATA\ORCL\CONTROL02.CTL output file name=C:\ORACLE\ORADATA\ORCL\CONTROL03.CTL Finished restore at 10/03/2008 12:10:33

8.Mount the database.

RMAN> alter database mount; database mounted

released channel: ORA_DISK_1

9.Recover the database with the recover database command.

RMAN> recover database;

Starting recover at 10/03/2008 14:03:49

Starting implicit crosscheck backup at 10/03/2008 14:03:49 allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=150 device type=DISK Crosschecked 3 objects

Finished implicit crosscheck backup at 10/03/2008 14:03:54 Starting implicit crosscheck copy at 10/03/2008 14:03:54 using channel ORA_DISK_1

Finished implicit crosscheck copy at 10/03/2008 14:03:54

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]