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

Lab 4.2: Creating an RMAN Incremental Backup  

709

piece handle=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \AUTOBACKUP\2008_09_11\O1_MF_S_665181628_4DMP5C9P_.BKP comment=NONE Finished Control File and SPFILE Autobackup at 11-SEP-08

4.Restart the database with the RMAN command alter database open.

RMAN> Alter database open; database opened

Lab 4.2: Creating an RMAN

Incremental Backup

In this lab, we will be creating an incremental backup. We will also be looking at the size of the resulting backup sets to compare the backup set sizes and the impacts of the level-0 and level-1 incremental backups.

1.Log into the database using SQL*Plus.

C:\oracle\admin\ORCL\wallet>set oracle_sid=orcl C:\oracle\admin\ORCL\wallet>sqlplus “/ as sysdba”

SQL*Plus: Release 11.1.0.6.0 - Production on Thu Sep 11 18:56:27 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>

2.Query the LOG_MODE column of the V$DATABASE view to confirm that the database is in ARCHIVELOG mode. If the database is not in ARCHIVELOG mode, refer to Chapter 2 for information on how to put the database in ARCHIVELOG mode.

SQL> Select log_mode from v$database; LOG_MODE

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

ARCHIVELOG

3.Exit SQL*Plus and start RMAN.

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition

710  Appendix A  n  Lab Exercises

Release 11.1.0.6.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options C:\oracle\admin\ORCL\wallet>rman target=/

Recovery Manager: Release 11.1.0.6.0 - Production on Thu Sep 11 18:58:55 2008

Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: ORCL (DBID=1190537904)

4.Execute the RMAN backup using the backup database command. Include the incremental level 0 option. You will back up the archived redo logs at the same time with the plus archivelog option. Remove the archived redo logs after they are backed up using the delete input option.

RMAN> Backup incremental level 0 database plus archivelog delete input;

5.Exit RMAN and log into SQL*Plus.

6.Query the V$BACKUP_DATAFILE and V$BACKUP_SET views to determine the size of the backup image (found in the BLOCKS column).

SQL> select a.set_count, a.start_time, a.completion_time, sum(b.blocks) 2 from v$backup_set a, v$backup_datafile b

3where a.set_count=b.set_count

4and to_char(a.start_time, ‘mm/dd/yyyy hh24:mi:ss’)=

5 (select to_char(max(start_time), ‘mm/dd/yyyy hh24:mi:ss’)

6from v$backup_set

7where incremental_level=0)

8 group

by a.set_count, a.start_time, a.completion_time ;

SET_COUNT

START_TIM COMPLETIO SUM(B.BLOCKS)

----------

---------

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

155

11-SEP-08

11-SEP-08

144318

7.Exit RMAN. Sign into the database using SQL*Plus. Add a table to the scott (or any other) schema. Insert and commit records into that table.

RMAN> Exit

Recovery Manager complete.

C:\Documents and Settings\Robert>Sqlplus scott/tiger SQL*Plus: Release 11.1.0.6.0 - Production on

Thu Sep 11 20:37:39 2008

Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to:

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production

Lab 4.3: Creating an Image-Copy Backup 

711

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

SQL> Create table my_new_table (id number); Table created.

SQL> Insert into my_new_table values (1); 1 row created.

SQL> Commit; Commit complete. SQL> Exit

8.Sign into RMAN. Perform a level-1 incremental backup.

RMAN> Backup incremental level 1 database plus archivelog delete input;

9.Query the V$BACKUP_DATAFILE and V$BACKUP_SET views again to determine the size of the backup image (found in the BLOCKS column). Since we are not doing an outer join here, the query will not return any rows until the backup in step 8 has completed. Note that the level-1 incremental backup is much smaller in the output than that in step 6.

SQL> select a.set_count, a.start_time, a.completion_time, sum(b.blocks) 2 from v$backup_set a, v$backup_datafile b

3where a.set_count=b.set_count

4and to_char(a.start_time, ‘mm/dd/yyyy hh24:mi:ss’)=

5 (select to_char(max(start_time), ‘mm/dd/yyyy hh24:mi:ss’)

6from v$backup_set

7where incremental_level=1)

8

group by a.set_count, a.start_time, a.completion_time ;

SET_COUNT START_TIM

COMPLETIO SUM(B.BLOCKS)

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

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

 

159 11-SEP-08

11-SEP-08

45

Lab 4.3: Creating an Image-Copy Backup

In this lab, you will create an image-copy backup of your database. We assume your database is in ARCHIVELOG mode for this backup.

1.Log into the database using SQL*Plus.

C:\oracle\admin\ORCL\wallet>set oracle_sid=orcl C:\oracle\admin\ORCL\wallet>sqlplus “/ as sysdba”

SQL*Plus: Release 11.1.0.6.0 - Production on Thu Sep 11 18:56:27 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved.

712  Appendix A  n  Lab Exercises

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>

2.Using the backup as copy command, create an image copy of the database.

RMAN> Backup as copy database; Starting backup at 11-SEP-08 using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00002 name=C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF output file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \DATAFILE\O1_MF_SYSAUX_4DMQJBMK_.DBF tag=TAG20080911T211158

RECID=23 STAMP=665183712

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:03:16 channel ORA_DISK_1: starting datafile copy

input datafile file number=00001 name=C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF output file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \DATAFILE\O1_MF_SYSTEM_4DMQPMC7_.DBF tag=TAG20080911T211158

RECID=24 STAMP=665184016

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:04:56 channel ORA_DISK_1: starting datafile copy

input datafile file number=00005 name=C:\ORACLE\ORADATA\ORCL\UNDOTBS02.DBF output file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \DATAFILE\O1_MF_UNDOTBS2_4DMR03BY_.DBF tag=TAG20080911T211158

RECID=25 STAMP=665184046

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy

input datafile file number=00004 name=C:\ORACLE\ORADATA\ORCL\USERS01.DBF output file name=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL \DATAFILE\O1_MF_USERS_4DMR0S6S_.DBF tag=TAG20080911T211158

RECID=26 STAMP=665184058

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 11-SEP-08

Starting Control File and SPFILE Autobackup at 11-SEP-08 piece handle=C:\ORACLE\FLASH_RECOVERY_AREA\ORCL

\AUTOBACKUP\2008_09_11\O1_MF_S_665184060_4DMR163F_.BKP comment=NONE Finished Control File and SPFILE Autobackup at 11-SEP-083.

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