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

Lab 5.1: Implementing RVPC 

713

Lab 5.1: Implementing RVPC

In this lab, you will implement RMAN virtual private catalog (RVPC) in the recovery catalog.

1.First you need to create the RVPC database account. Log into the recovery-catalog database as a privileged user (for example, SYS) and issue the create user command.

C:\Documents and Settings\Robert>sqlplus rcat_user/rcat_user@rcat SQL*Plus: Release 11.1.0.6.0 - Production on Tue Sep 16 20:33:07 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining

and Real Application Testing options

SQL> create user rcat_001 identified by rcat_001 2 default tablespace rcat_data

3 quota unlimited on rcat_data; User created.

2.Grant the recovery_catalog_owner privilege to the new user. Here is an example of this operation:

SQL> grant recovery_catalog_owner to rcat_001; Grant succeeded.

3.Create the virtual catalog. To do this, you log into RMAN and use the create virtual catalog command, as shown in this example:

C:\Documents and Settings\Robert>rman catalog=rcat_001/rcat_001@rcat Recovery Manager: Release 11.1.0.6.0 - Production

on Tue Sep 16 20:30:04 2008

Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to recovery catalog database

RMAN> Create virtual catalog;

found eligible base catalog owned by RCAT_USER

created virtual catalog against base catalog owned by RCAT_USER

4.Now that you have created the RVPC account, you need to indicate to the recoverycatalog database which databases this account will have access too. Log into RMAN

714  Appendix A  n  Lab Exercises

and connect to the recovery catalog. Use the grant command and register the ORCL database to rcat_001.

C:\Documents and Settings\Robert>rman catalog=rcat_user/rcat_user@rcat Recovery Manager: Release 11.1.0.6.0 - Production

on Tue Sep 16 20:25:32 2008

Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to recovery catalog database

RMAN> grant catalog for database orcl to rcat_001; Grant succeeded.

5.Query the RC_DATABASE view and see that only the ORCL database can be seen in the RVPC.

C:\Documents and Settings\Robert>sqlplus rcat_001/rcat_001@rcat SQL*Plus: Release 11.1.0.6.0 - Production on Tue Sep 16 20:33:07 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application

Testing options

SQL> Select name from rc_database; NAME

--------

ORCL

Lab 6.1: Restoring a Datafile Online

In this activity, we will restore a datafile while the rest of the database is online. 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.Log into the database as SYS using SQL*Plus.

C:\oracle>set oracle_sid=orcl C:\oracle>sqlplus sys as sysdba

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

Enter password: Connected to:

Lab 6.1: Restoring a Datafile Online 

715

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining

and Real Application Testing options SQL>

2.Determine the location of the database datafiles and their associated FILE_ID’s.

SQL> select file_id, file_name from dba_data_files; FILE_ID FILE_NAME

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

4 C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_4G2Q1YTC_.DBF

3 C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF

2 C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF

1 C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF

3.Shut down the database.

SQL> shutdown abort ORACLE instance shut down.

4.Exit SQL*Plus.

SQL> quit

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 C:\oracle>

5.From the operating prompt, delete one of the database datafiles listed in step 3. Make sure, before you delete the file, that you note its datafile number, the filename, and the location. In our example, we will delete datafile 4, which is the datafile associated with the USERS tablespace.

C:\oracle>Del C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_4G2Q1YTC_.DBF

6.Log into the database as SYS using 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:

Connected to an idle instance.

716  Appendix A  n  Lab Exercises

7.Start the database. Notice the error that you receive.

SQL> startup

ORACLE instance started.

 

 

Total System Global Area

364081152

bytes

Fixed Size

1333228

bytes

Variable Size

264243220

bytes

Database Buffers

92274688

bytes

Redo Buffers

6230016

bytes

Database mounted.

 

 

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: ‘C:\ORACLE\FLASH_RECOVERY_AREA\ORCL\DATAFILE\O1_MF_USERS_4G2Q1YTC_.DBF’

8.Use the alter database datafile offline command to take datafile 4 offline.

SQL> Alter database datafile 4 offline; Database altered.

9.Open the database with the alter database open command. Exit SQL*Plus after the database has opened.

SQL> Alter database datafile 4 offline; Database altered.

SQL> alter database open; Database altered.

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

10.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. connected to target database (not started)

11.Restore database datafile 4 with the restore datafile command.

RMAN> restore datafile 4;

Starting restore at 10/03/2008 02:16:38

Lab 6.1: Restoring a Datafile Online 

717

using target database control file instead of

recovery catalog

 

allocated channel: ORA_DISK_1

 

 

channel ORA_DISK_1: SID=133 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 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:00:03

 

Finished restore at 10/03/2008 02:16:42

 

 

12.Recover datafile 4 with the recover datafile command.

RMAN> recover datafile 4;

Starting recover at 10/03/2008 02:17:53 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:01 Finished recover at 10/03/2008 02:17:55

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