Presentation is loading. Please wait.

Presentation is loading. Please wait.

NoCOUG 2005 Winter Conference NoCOUG 2005 Winter Conference Oracle 10g Backup and Recovery New Features Daniel T. Liu Senior Technical Consultant First.

Similar presentations


Presentation on theme: "NoCOUG 2005 Winter Conference NoCOUG 2005 Winter Conference Oracle 10g Backup and Recovery New Features Daniel T. Liu Senior Technical Consultant First."— Presentation transcript:

1 NoCOUG 2005 Winter Conference NoCOUG 2005 Winter Conference Oracle 10g Backup and Recovery New Features Daniel T. Liu Senior Technical Consultant First American Real Estate Solutions Date: Tuesday, February 8, 2005 @ 2:15 PM - 3:15 PM Venue: Room 103, Oracle Conference Center, Redwood Shores, CA

2 NoCOUG 2005, Daniel T. Liu2 Agenda Introduction –Oracle Database 10g –Challenges for Backup and Recovery –Types of Database Errors –Backup and Recovery Solutions

3 NoCOUG 2005, Daniel T. Liu3 Agenda Extended Flashback Features Enhanced RMAN Features Summary Q & A

4 NoCOUG 2005, Daniel T. Liu4 Introduction to Oracle 10g Grid Computing Concept –Utilizing computing resource as utility –Software level –Hardware level Grid Computing Challenges –Standardization –Security –Reliability

5 NoCOUG 2005, Daniel T. Liu5 Introduction to Oracle 10g Oracle Database 10 g New Features –Real Application Clusters –Oracle Streams –Cross-platform transportable tablespaces –Automatic Storage Management (ASM) –Self-Managing Database –New Backup and Recovery Features

6 NoCOUG 2005, Daniel T. Liu6 Challenges for Backup and Recovery Database size is getting bigger and bigger Database Backup Time –A DLT tape writes 6 MB/Second, or 21 GB/hour –A 2 TB database with one tape driver will take 97 hours to backup Database Recovery Time Is the backup good? Trouble shooting time

7 NoCOUG 2005, Daniel T. Liu7 Types of Database Errors Corruptions –Logical corruptions –Physical corruptions Human Errors –Accidentally drop, or truncate a table –Accidentally delete, update rows in a table –Accidentally delete a data file or drop a tablespace Disasters –War, terrorism –Earthquake, flood, fire or hurricane –No power for a long period of time –Server crash, malfunction of hardware

8 NoCOUG 2005, Daniel T. Liu8 Backup and Recovery Solutions Logical Methods –Export and Import –Data Pump –Flashback Functions Physical Methods –O/S Backup and Restore –RMAN Backup and Restore High Availability Methods –Data Guard –RAC –Oracle Streams

9 NoCOUG 2005, Daniel T. Liu9 Extended Flashback Functions Flashback Database Flashback Drop Flashback Table Flashback Versions Query Flashback Transaction Query

10 NoCOUG 2005, Daniel T. Liu10 Flashback Database Traditional recovery method uses backups and redo log files; Flashback Database is implemented using a new type of log file called Flashback Database logs. The Oracle database server periodically logs before images of data blocks in the Flashback Database logs. The data block images are used to quickly back out changes to the database during Flashback Database.

11 NoCOUG 2005, Daniel T. Liu11 Flashback Database Flashback Database reduces the time required to recover the database to a point in time. The time to restore a database is proportional to the number of changes that need to be backed out, not the size of the database. Flashback Database is faster than traditional point-in-time recovery.

12 NoCOUG 2005, Daniel T. Liu12 Flashback Database

13 NoCOUG 2005, Daniel T. Liu13 Flashback Database $ ps -ef | grep grid oracle 25124 1 0 16:32:05 ? 0:00 ora_s000_grid oracle 25116 1 0 16:32:04 ? 0:00 ora_reco_grid oracle 25169 1 0 16:32:22 ? 0:00 ora_rvwr_grid oracle 25112 1 0 16:32:04 ? 0:00 ora_ckpt_grid oracle 25110 1 0 16:32:04 ? 0:00 ora_lgwr_grid oracle 25108 1 0 16:32:04 ? 0:00 ora_dbw0_grid oracle 25114 1 0 16:32:04 ? 0:00 ora_smon_grid oracle 25118 1 0 16:32:04 ? 0:00 ora_cjq0_grid oracle 25120 1 0 16:32:04 ? 0:00 ora_rbal_grid oracle 25122 1 0 16:32:04 ? 0:00 ora_d000_grid oracle 25106 1 0 16:32:04 ? 0:00 ora_pmon_grid The list below shows all the background processes for ‘grid’ instance.

14 NoCOUG 2005, Daniel T. Liu14 Enabling Flashback Database Make sure the database is in archive mode. Configure the recovery area by setting the two parameters: –DB_RECOVERY_FILE_DEST –DB_RECOVERY_FILE_DEST_SIZE Open the database in MOUNT EXCLUSIVE mode and turn on the flashback feature: SQL> STARTUP MOUNT EXCLUSIVE; SQL> ALTER DATABASE FLASHBACK ON; Set the Flashback Database retention target: –DB_FLASHBACK_RETENTION_TARGET

15 NoCOUG 2005, Daniel T. Liu15 Disabling Flashback Database SQL> ALTER DATABASE FLASHBACK OFF; Determine if Flashback Database is enabled SQL> select flashback_on 2 from v$database; FLASHBACK_ON ------------ YES

16 NoCOUG 2005, Daniel T. Liu16 Monitoring Flashback Database SQL> select begin_time, flashback_data, 2 db_data, redo_data, ESTIMATED_FLASHBACK_SIZE 3 from v$flashback_database_stat; BEGIN_TIME FLASHBACK_DATA DB_DATA REDO_DATA ESTIMATED_FLASHBACK_SIZE -------------------- -------------- ---------- ---------- ------------------------ Feb 22 2004 01:05:14 147456 2719744 92160 0 Feb 22 2004 00:05:09 3891200 5857280 2537984 252788736 Feb 21 2004 23:05:04 7979008 13615104 3385344 254877696 Feb 21 2004 22:05:00 14893056 19857408 17463296 255737856 Feb 21 2004 21:04:55 4210688 6422528 2598912 254361600 Feb 21 2004 20:04:51 4333568 8962048 2775552 256475136 Feb 21 2004 19:04:46 4431872 7028736 2804736 258588672 Feb 21 2004 18:04:41 4202496 8511488 2635264 260726784 Feb 21 2004 17:04:37 4030464 6938624 2546688 263012352 Feb 21 2004 16:04:32 4005888 7479296 2512384 265420800 Feb 21 2004 15:04:27 3874816 6864896 2471936 267927552 Feb 21 2004 14:04:23 4153344 7028736 2578944 270532608 Feb 21 2004 13:04:18 3825664 7675904 2497536 273113088 13 rows selected.

17 NoCOUG 2005, Daniel T. Liu17 Flashback Database Retention Monitor the Flashback Database retention target SQL> select * 2 from v$flashback_database_log; OLDEST_FLASHBACK_SCN OLDEST_FLASHBACK_TIME RETENTION_TARGET FLASHBACK_SIZE ESTIMATED_FLASHBACK_SIZE -------------------- --------------------- --------------- - -------------- ------------------------ 2.2029E+12 Oct 06 2003 09:44:42 1440 48316416 The default value for flashback retention time is 1440 minutes.

18 NoCOUG 2005, Daniel T. Liu18 Flashback Database Example 1: Flashback a Database using RMAN RMAN> FLASHBACK DATABASE 2> TO TIME = TO_DATE 3> (‘06/25/03 12:00:00’,’MM/DD/YY HH:MI:SS’); Example 2: Flashback a database using SQL command SQL> FLASHBACK DATABASE TO TIMESTAMP (SYSDATE – 5/24); SQL> FLASHBACK DATABASE TO SCN 76239; SQL> ALTER DATABASE RESETLOGS;

19 NoCOUG 2005, Daniel T. Liu19 Flashback Drop Prior to Oracle 10g, a DROP command permanently removed objects from the database. SQL> DROP TABLE CUSTOMERS; In Oracle 10g, a DROP command places the object in the recycle bin. The extents allocated to the segment are not reallocated until you purge the object. You can restore the object from the recycle bin at any time.

20 NoCOUG 2005, Daniel T. Liu20 Recycle Bin A recycle bin contains all the dropped database objects until, –You permanently drop them with the PURGE command. –Recover the dropped objects with the FLASHBACK TABLE command. –There is no room in the tablespace for new rows or updates to existing rows. –The tablespace needs to be extended.

21 NoCOUG 2005, Daniel T. Liu21 Recycle Bin You can view the dropped objects in the recycle bin from two dictionary views: –USER_RECYCLEBIN: list all dropped user objects –DBA_RECYCLEBIN: list all dropped system- wide objects

22 NoCOUG 2005, Daniel T. Liu22 Example 1: Dropping an Object SQL> create table test (col_a varchar(4)); Table created. SQL> select object_name, original_name, 2 type, createtime, droptime 3 from user_recyclebin; no rows selected SQL> drop table test; Table dropped.

23 NoCOUG 2005, Daniel T. Liu23 Example 1: Dropping an Object SQL> select object_name, original_name, 2 type, createtime, droptime 3 from user_recyclebin; OBJECT_NAME ORIGINAL_NAME TYPE CREATETIME DROPTIME ------------------------------ ---------------- -- ---- ------------------- ------------------- BIN$0+ktoVCgEmXgNAAADiUEHQ==$0 TEST TABLE 2004-02-21:19:04:03 2004-02-21:19:04:41

24 NoCOUG 2005, Daniel T. Liu24 Example 1: Dropping an Object SQL> create table test (col_b varchar(4)); Table created. SQL> select object_name, original_name, 2 type, createtime, droptime 3 from user_recyclebin; OBJECT_NAME ORIGINAL_NAME TYPE CREATETIME DROPTIME ------------------------------ ---------------- -- ---- ------------------- ------------------- BIN$0+ktoVCgEmXgNAAADiUEHQ==$0 TEST TABLE 2004-02-21:19:04:03 2004-02-21:19:04:41 SQL> drop table test; Table dropped.

25 NoCOUG 2005, Daniel T. Liu25 Example 1: Dropping an Object SQL> select object_name, original_name, 2 type, createtime, droptime 3 from user_recyclebin; OBJECT_NAME ORIGINAL_NAME TYPE CREATETIME DROPTIME ------------------------------ ------------- --- ------ ------------------- -------- ----------- BIN$0+ktoVChEmXgNAAADiUEHQ==$0 TEST TABLE 2004-02-21:19:07:33 2004-02- 21:19:08:17 BIN$0+ktoVCgEmXgNAAADiUEHQ==$0 TEST TABLE 2004-02-21:19:04:03 2004-02- 21:19:04:41

26 NoCOUG 2005, Daniel T. Liu26 Example 1: Dropping an Object SQL> show recyclebin ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME ---------------- --------------------------- --- ------------ ------------------- TEST BIN$0+ktoVChEmXgNAAADiUEHQ==$0 TABLE 2004-02-21:19:08:17 TEST BIN$0+ktoVCgEmXgNAAADiUEHQ==$0 TABLE 2004-02-21:19:04:41

27 NoCOUG 2005, Daniel T. Liu27 Example 2: Restoring a Dropped Object This example will restore a dropped table test. SQL> flashback table “BIN$0+ktoVChEmXgNAAADiUEHQ==$0 ” to before drop; Flashback complete.

28 NoCOUG 2005, Daniel T. Liu28 Example 3: Dropping a Table Permanently This statement removes the table permanently: SQL> drop table test purge; Table dropped. This statement removes the table in the recycle bin: SQL> purge table "BIN$0+ktoVChEmXgNAAADiUEHQ==$0"; Table purged.

29 NoCOUG 2005, Daniel T. Liu29 Example 4: Dropping a Tablespace You can only issue this command when the tablespace users is empty. Object in the recycle bin of tablespace users will be purged: SQL> drop tablespace users; When you issue this command, objects in the tablespace users are dropped. They are not placed in the recycle bin. Any objects in the recycle bin belonging to the tablespace users are purged. SQL> drop tablespace users including contents;

30 NoCOUG 2005, Daniel T. Liu30 Example 5: Purging the Recycle Bin This statement purges the user recycle bin: SQL> purge recyclebin; Recyclebin purged. This statement removes all objects from the recycle bin: SQL> purge dba_recyclebin; DBA Recyclebin purged. This statement purges all objects from tablespace users in the recycle bin: SQL> purge tablespace users; Tablespace purged.

31 NoCOUG 2005, Daniel T. Liu31 Flashback Table Flashback Table allows you to recover a table or tables to a specific point in time without restoring a backup. When you use the Flashback Table feature to restore a table to a specific point in time, all associated objects, such as, indexes, constraints, and triggers will be restored.

32 NoCOUG 2005, Daniel T. Liu32 Flashback Table Flashback Table operations are not valid for the following object types: –Tables that are part of a cluster –Materialized views –Advanced Queuing tables –Static data dictionary tables – System tables –Partitions of a table –Remote tables (via database link)

33 NoCOUG 2005, Daniel T. Liu33 UNDO_RETENTION Parameter Data used to recover a table is stored in the undo tablespace. You can use the parameter UNDO_RETENTION to set the amount of time you want undo information retained in the database. The default value for UNDO_RETENTION is 900 seconds (15 minutes).

34 NoCOUG 2005, Daniel T. Liu34 Guaranteed Retention When an active transaction uses all the undo tablespace, the system will start reusing undo space that would have been retained unless you have specified RETENTION GUARANTEE for the tablespace. To create an undo tablespace with the RETENTION GUARANTEE option, issue the following command: SQL> CREATE UNDO TABLEAPCE undo_tbs DATAFIEL ‘/u02/oradata/grid/undo_tbs01.dbf’ SIZE 1 G RETENTION GUARANTEE;

35 NoCOUG 2005, Daniel T. Liu35 Flashback Table Privileges You must have the FLASHBACK TABLE or FLASHBACK ANY TABLE system privilege to use the Flashback Table feature.

36 NoCOUG 2005, Daniel T. Liu36 Example 1: Flashback Table using SCN Table row movement must be enabled to flashback a table: SQL> ALTER TABLE billing ENABLE ROW MOVEMENT; This statement brings a table ‘billing’ back to a certain SCN number; SQL> FLASHBACK TABLE billing TO SCN 76230;

37 NoCOUG 2005, Daniel T. Liu37 Example 2: Flashback Table using TIMESTAMP This statement brings a table ‘billing’ back to a certain timestamp: SQL> FLASHBACK TABLE billing TO TIMESTAMP TO_TIMESTAMP(‘06/25/03 12:00:00’,’MM/DD/YY HH:MI:SS’);

38 NoCOUG 2005, Daniel T. Liu38 Flashback Versions Query Flashback Query was first introduced in Oracle9i, to provide a way for you to view historical data. In Oracle 10g, this feature has been extended. You can now retrieve all versions of the rows that exist or ever existed between the time the query was issued and a point back in time.

39 NoCOUG 2005, Daniel T. Liu39 Flashback Versions Query You can use the VERSIONS BETWEEN clauses to retrieve all historical data related to a row. The Flashback Versions Query feature retrieves all committed occurrences of the row. The row history data is stored in the undo tablespace.

40 NoCOUG 2005, Daniel T. Liu40 Flashback Versions Query The undo_retention initialization parameter specifies how long the database will keep the amount of committed undo information. If a new transaction needs to use undo space and there is not enough free space left, any undo information older than the specified undo retention period will be overwritten. You can set the undo tablespace option to RETENTION GUARANTEE to retain all row histories.

41 NoCOUG 2005, Daniel T. Liu41 Example 1 To verify the retention value for the tablespace, you can issue the following statement: SQL> select tablespace_name, retention 2 From dba_tablespaces; TABLESPACE_NAME RETENTION ------------------------------ ----------- SYSTEM NOT APPLY UNDOTBS1 NOGUARANTEE SYSAUX NOT APPLY TEMP NOT APPLY

42 NoCOUG 2005, Daniel T. Liu42 Example 2 SQL> create table emp (name varchar2(10), salary number(8,2)); Table created. SQL> insert into emp values ('DANIEL',2000); 1 row created. SQL> commit; Commit complete.

43 NoCOUG 2005, Daniel T. Liu43 Example 2 SQL> update emp set salary = 3000 where name = 'DANIEL'; 1 row updated. SQL> commit; Commit complete.

44 NoCOUG 2005, Daniel T. Liu44 Example 2 SQL> select * from emp; NAME SALARY ---------- DANIEL 3000 SQL> select * from emp versions between scn minvalue and maxvalue; NAME SALARY ---------- DANIEL 3000 DANIEL 2000

45 NoCOUG 2005, Daniel T. Liu45 Flashback Transaction Query It provides a way for you to view changes made to the database at the transaction level. It allows you to diagnose problems in your database and perform analysis and audit transactions. You can use this feature in conjunction with the Flash Versions Query feature to roll back the changes made by a transaction.

46 NoCOUG 2005, Daniel T. Liu46 Flashback Transaction Query You can retrieve the transaction history from flashback_transaction_query view: Name Null? Type ------------------------------------ -------- -------------- XID RAW(8) START_SCN NUMBER START_TIMESTAMP DATE COMMIT_SCN NUMBER COMMIT_TIMESTAMP DATE LOGON_USER VARCHAR2(30) UNDO_CHANGE# NUMBER OPERATION VARCHAR2(32) TABLE_NAME VARCHAR2(256) TABLE_OWNER VARCHAR2(32) ROW_ID VARCHAR2(19) UNDO_SQL VARCHAR2(4000)

47 NoCOUG 2005, Daniel T. Liu47 Example SQL> select versions_xid, name, salary 2 from emp 3 versions between scn minvalue and maxvalue; VERSIONS_XID NAME SALARY ---------------- ---------- ---------- 0003000E00000FE2 DANIEL 3000 DANIEL 2000 SQL> select * 2 from flashback_transaction_query 3 where xid = '0003000E00000FE2';

48 NoCOUG 2005, Daniel T. Liu48 Example SQL> select xid, start_scn, start_timestamp, 2 table_name, undo_sql 3 from flashback_transaction_query 4 where xid = '0009001F000000B2‘; XID START_SCN START_TIMESTAMP TABLE_NAME UNDO_SQL ---------------- ---------- -------------------- ---- ------ --------------------------------------------------------- ---------------------- 0009001F000000B2 714980 Feb 21 2004 23:30:31 EMP update "ORACLE"."EMP" set "SALARY" = ‘2000' where ROWID = 'AAAMWJAAEAAAAFsAAA';

49 NoCOUG 2005, Daniel T. Liu49 Summary - Flashback Flashback Database Flashback Drop Flashback Table Flashback Versions Query Flashback Transaction Query

50 NoCOUG 2005, Daniel T. Liu50 Enhanced RMAN Features Automated File Creation During Recovery Simplified Recovery Through Resetlogs Change-Aware Incremental Backups Automated Disk-Based Backup and Recovery RMAN Database Dropping and Deregistration

51 NoCOUG 2005, Daniel T. Liu51 Automated File Creation During Recovery This feature enhances RMAN recovery by automatically creating and recovering datafiles that have never been backed up. In order to recover a data file that has never been backed up, you need the archive log files from the time of the data file creation until the time at which you want to stop the recovery process and a copy of the control file with the information regarding the data file.

52 NoCOUG 2005, Daniel T. Liu52 Automated File Creation During Recovery

53 NoCOUG 2005, Daniel T. Liu53 Simplified Recovery Through Resetlogs After performing an incomplete (Point-in- time) recovery, you need to open the database with RESETLOGS option: SQL> alter database open resetlogs;

54 NoCOUG 2005, Daniel T. Liu54 Simplified Recovery Through Resetlogs This RESETLOGS operation creates a new incarnation of the database and resets the logs. Prior to Oracle 10g, the newly generated redo log files could not be used with the backups taken in the past. Therefore, it was important to take an immediate backup since all previous backups became invalid. In addition, if you used RMAN catalog for future backups, you needed to issue the following command to make the RMAN catalog aware of the new incarnation of the database. RMAN> reset database;

55 NoCOUG 2005, Daniel T. Liu55 Simplified Recovery Through Resetlogs In Oracle 10g, you no longer have to back up your database following an incomplete recovery and OPEN RESETLOGS operations. This new feature is also applicable to the following two scenarios: –When you perform a recovery using a backup control file and open the database with the RESETLOGS operation. –When you need to reinstantiate the old primary database following a failover.

56 NoCOUG 2005, Daniel T. Liu56 Simplified Recovery Through Resetlogs Benefits of Simplified Recovery Through Resetlogs –There is no need to perform a full backup after an incomplete recovery. –There is no need to recreate a new standby database after a failover operation. –There is no need to change any backup scripts as there are no changes to the recovery commands to take advantage of this functionality.

57 NoCOUG 2005, Daniel T. Liu57 Simplified Recovery Through Resetlogs Benefits of Simplified Recovery Through Resetlogs –You can take incremental backups based on full backups of a previous incarnation when you use RMAN. –Block media recovery can restore backups from parent incarnation backups and recover the corrupted blocks through a RESETLOGS operation.

58 NoCOUG 2005, Daniel T. Liu58 Simplified Recovery Through Resetlogs How does it work? –Oracle 10g introduces a new format specification for archived log files. –This new format avoids overwriting archived redo log files with the same sequence number across incarnations. SQL> show parameter log_archive_format NAME TYPE VALUE ---------------------------- ----------- ------------ log_archive_format string %t_%s_%r.dbf

59 NoCOUG 2005, Daniel T. Liu59 Simplified Recovery Through Resetlogs The format specification is %r and represents the resetlogs id. It is included in the default format for the LOG_ARCHIVE_FORMAT initialization parameter. It will ensure that a unique name is constructed for the archived redo log file during RMAN restore and SQL*plus auto recovery mode.

60 NoCOUG 2005, Daniel T. Liu60 Simplified Recovery Through Resetlogs During the RESETLOGS operation, the information in V$LOG_HISTORY and V$OFFLINE_RANGE records are no longer cleared. In addition, two new columns have been added to indicate the incarnation the records belong to: –RESETLOGS_CHANGE# –RESETLOGS_TIME.

61 NoCOUG 2005, Daniel T. Liu61 Simplified Recovery Through Resetlogs SQL> select recid, thread#, sequence#, resetlogs_change#,resetlogs_time 2 from v$log_history 3 where rownum < 20; RECID THREAD# SEQUENCE# RESETLOGS_CHANGE# RESETLOGS_TIME ---------- ---------- ---------- ----------------- -------------------- 1 1 1 1 Aug 12 2003 18:48:54 2 1 2 1 Aug 12 2003 18:48:54 3 1 3 1 Aug 12 2003 18:48:54 4 1 4 1 Aug 12 2003 18:48:54 5 1 5 1 Aug 12 2003 18:48:54 6 1 6 1 Aug 12 2003 18:48:54 7 1 7 1 Aug 12 2003 18:48:54 8 1 8 1 Aug 12 2003 18:48:54 9 1 9 1 Aug 12 2003 18:48:54 10 1 10 1 Aug 12 2003 18:48:54 11 1 11 1 Aug 12 2003 18:48:54 12 1 12 1 Aug 12 2003 18:48:54 13 1 13 1 Aug 12 2003 18:48:54 14 1 14 1 Aug 12 2003 18:48:54 15 1 15 1 Aug 12 2003 18:48:54

62 NoCOUG 2005, Daniel T. Liu62 Change-Aware Incremental Backups In previous releases of the Oracle database, when you perform an incremental backup, RMAN has to examine every block in the data file to determine which blocks have been changed. The time to perform an incremental backup is proportional to the size of the data files. Therefore, to perform an incremental backup on a very large database can take some time even if you have just changed a few blocks.

63 NoCOUG 2005, Daniel T. Liu63 Change-Aware Incremental Backups In Oracle 10g, you can create a block change tracking file that records the blocks modified since the last backup. RMAN uses the tracking file to determine which blocks to include in the incremental backup. RMAN no longer needs to examine the entire data file. The time to perform an incremental backup is now proportional to the amount of content modified since the last backup.

64 NoCOUG 2005, Daniel T. Liu64 Change-Aware Incremental Backups Here are the steps RMAN will perform to do an incremental backup: –Read the Block Change Tracking File to determine which blocks in the data file need to be read. –Only scan the changed blocks in the data file and then back them up.

65 NoCOUG 2005, Daniel T. Liu65 Change-Aware Incremental Backups

66 NoCOUG 2005, Daniel T. Liu66 Change-Aware Incremental Backups How big is the Block Change Tracking File? –The database size in bytes: the block change tracking file contains data representing every data file block in the database. The data is approximately 1/250000 of the total size of the database. –The number of enabled threads: In a Real Application Cluster (RAC) environment, the instances update different areas of the tracking file without any locking or inter-node block swapping. You enable block change tracking for the entire database and not for individual instances.

67 NoCOUG 2005, Daniel T. Liu67 Change-Aware Incremental Backups How big is the Block Change Tracking File? –The number of old backups: The block change tracking file keeps a record of all changes between previous backups, in addition to the modification since the last backup. It retains the change history for a maximum of eight backups.

68 NoCOUG 2005, Daniel T. Liu68 Change-Aware Incremental Backups The size of the file is calculated by the following formula: Size of the Block Change Tracking File = ( ( (Threads*2) + number of old backups ) * database size in bytes ) / 250,000

69 NoCOUG 2005, Daniel T. Liu69 Change-Aware Incremental Backups The minimum size for the block change tracking file is 10 MB. By using this formula, a 2 TB database with only one thread, and having five backups in the RMAN repository will require a block change tracking file of 59 MB.

70 NoCOUG 2005, Daniel T. Liu70 Change-Aware Incremental Backups Enabling Block Change Tracking –By default, Oracle will not record block change information. –To enable this feature, you need to issue the following command: SQL> alter database enable block change tracking;

71 NoCOUG 2005, Daniel T. Liu71 Change-Aware Incremental Backups Disabling Block Change Tracking SQL> alter database disable block change tracking; Monitoring the status of Block Change Tracking: SQL> select file, status, bytes 2 from v$block_change_tracking; STATUSFILEBYTES ------------------------------------------------------ ENABLED/dba/backup/01_mf_yzmrr7.chg10,000,000

72 NoCOUG 2005, Daniel T. Liu72 Automated Disk-Based Backup and Recovery Prior to Oracle 10g, disk files that were created by RMAN utility or ARCH process had no knowledge of one another. Furthermore, they were not aware of the sizes of the file system on which they created files. Database administrators need to routinely clean up the old archive logs or old RMAN files. It is nice to have a unified disk storage location where you can manage all recovery related files. Now you can achieve this in Oracle 10g by specifying a Recovery Area

73 NoCOUG 2005, Daniel T. Liu73 Automated Disk-Based Backup and Recovery The recovery area is a unified disk storage location for all recovery related files and activities in an Oracle Database. Those files include: –Control file –Online redo log files –Archived log files –Flashback logs –Control file autobackups –Data file copies –RMAN files

74 NoCOUG 2005, Daniel T. Liu74 Automated Disk-Based Backup and Recovery The recovery area is defined by setting two initialization parameters. These two parameters can be dynamically altered or disabled. –The db_recovery_file_dest_size sets the disk limit, expressed in bytes –The db_recovery_file_dest sets the location for the recovery area

75 NoCOUG 2005, Daniel T. Liu75 Automated Disk-Based Backup and Recovery Set the disk limit for recovery area to 100 GB: SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 100G; Set the recovery area destination: SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = ‘/dba/backup/’;

76 NoCOUG 2005, Daniel T. Liu76 Automated Disk-Based Backup and Recovery Alter a Recovery Area SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 200G; Disabling a Recovery Area SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = ‘ ’ ;

77 NoCOUG 2005, Daniel T. Liu77 Automated Disk-Based Backup and Recovery Recovery Area Space Management –When the recovery area is less than 90% full, Oracle does not delete eligible files immediately, to minimize the need to restore recent files from tape during recovery. The recovery area can thus serve as a kind of cache for tape. –Once the recovery area is 90% full, Oracle will issue a warning to users. –The Oracle database server and RMAN will continue to create files in the recovery area until 100% of the disk limit is reached.

78 NoCOUG 2005, Daniel T. Liu78 Automated Disk-Based Backup and Recovery Recovery Area Space Management –Once the recovery area is 100% full, the RMAN retention policy is used to indicate what files will be deleted in order to make space for newer files. –The db_flashback_retention_target parameter specifies how long Oracle will keep the flashback logs in the flashback recovery area. However, flashback logs won't be deleted even if it exceeds the duration specified by the flashback retention period unless more space is needed in the recovery area for other files.

79 NoCOUG 2005, Daniel T. Liu79 Automated Disk-Based Backup and Recovery New RMAN command for Recovery Area RMAN> BACKUP RECOVERY AREA; RMAN> BACKUP RECOVERY FILES;

80 NoCOUG 2005, Daniel T. Liu80 Automated Disk-Based Backup and Recovery Oracle 10g has a new dynamic performance view for monitoring the recovery area: SQL> desc v$recovery_file_dest Name Null? Type ------------------------------- -------- ----------- NAME VARCHAR2(513) SPACE_LIMIT NUMBER SPACE_USED NUMBER SPACE_RECLAIMABLE NUMBER NUMBER_OF_FILES NUMBER

81 NoCOUG 2005, Daniel T. Liu81 Automated Disk-Based Backup and Recovery Example: SQL> select * from v$recovery_file_dest; NAME SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES ------------ ------------- ------------ ----------------- ---------------- /dba/backup 2147483648 458219520 0 49

82 NoCOUG 2005, Daniel T. Liu82 RMAN Database Dropping and Deregistration In Oracle 10g, you can drop a database and remove its entry from the RMAN catalog. The following statement drops the entire database and removes the database files: RMAN> drop database; The following statement drops the entire database, removes the database files, and deletes all backup copies of the database and the archive log files: RMAN> drop database including backups;

83 NoCOUG 2005, Daniel T. Liu83 RMAN Database Dropping and Deregistration The above two statements drop the database and delete the database files. However, they do not unregister the database from the RMAN catalog. The following statement will remove the database information from the RMAN catalog: RMAN> unregister database grid;

84 NoCOUG 2005, Daniel T. Liu84 Summary - RMAN Features Automated File Creation During Recovery Simplified Recovery Through Resetlogs Change-Aware Incremental Backups Automated Disk-Based Backup and Recovery RMAN Database Dropping and Deregistration

85 NoCOUG 2005, Daniel T. Liu85 Summary Oracle Database 10g Grid Computing Challenges For Backup and Recovery Different Types of Database Errors Solutions for Backup and Recovery Oracle 10g Extended Flashback Features Oracle 10g Enhanced RMAN Features

86 NoCOUG 2005, Daniel T. Liu86 Questions & Answers

87 NoCOUG 2005, Daniel T. Liu87 References Oracle Database 10g New Features, Ault, Liu and Tumma; Rampant Techpress; Recovery Manager Reference, 10g Release; Backup and Recovery Advanced Users Guide, 10g Release; I would also like to acknowledge the assistance of Larry Bailey of FARES, Tammy Bednar, Larry Carpenter, Roger Peterson, Schwinn Ulrike of Oracle Corporation.

88 NoCOUG 2005, Daniel T. Liu88 Thanks For Coming !! Daniel Liu Contact Information Phone: (714) 701-3346 Email: dliu@firstam.com Email: daniel_t_liu@yahoo.com Company Web Site: http://www.firstam.com


Download ppt "NoCOUG 2005 Winter Conference NoCOUG 2005 Winter Conference Oracle 10g Backup and Recovery New Features Daniel T. Liu Senior Technical Consultant First."

Similar presentations


Ads by Google