Backup Flashcards

1
Q

What is ARCHIVELOG mode?

A

Oracle saves the filled redo logs which allows you to recover the database to any point in time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is NOARCHIVELOG mode?

A

The filled redo logs are overwritten and not saved. In this mode, you can only restore the backed up data but no changes that were made AFTER the backup.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

‘What’s a consistent backup?

A

A consistent backup is when you can restore the database without performing a recovery. This is because the datafile(s) and the control file(s) contain data taken from the same point in time and therefore, have the same SCN.

Note: This usually only occurs when a database is shutdown gracefully (i.e. SHUTDOWN NORMAL -or- SHUTDOWN TRANSACTIONAL).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What’s an inconsistent backup?

A

An inconsistent backup contains datafiles from different points in time (i.e. different SCN’s) because changes are being committed while the database is still online. Therefore, you must apply archived and online redo logs to the backup in order to recover the database to the current point in time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s a hot backup?

A

A backup that is made while the database is online (i.e. most common backup)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s a cold backup?

A

A backup made while the database is offline (i.e. usually during a scheduled maintenance window).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 3 types of backups you can perform?

A
  • Whole Database - Backup all files including the control file.
  • Tablespace - Backup all the datafiles that belong to a tablespace
  • Datafile - Backup a single datafile
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the most important Backup Guidelines?

A
  • Multiplex & Mirror the Control Files (on separate disks managed by different disk controllers)
  • Multiplex the Archive Redo Logs (LOG_ARCHIVE_MIN_SUCCEED_DEST = 2)
  • Backup the SPFILE (or init.ora)
  • Backup sqlnet.ora
  • Backup tnsnames.ora
  • Backup listener.ora
  • Backup password file
  • Perform frequent backups
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Multiplexing?

A

Multiple copies of a file that are being written to at the same time by the Oracle software.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Mirroring?

A

Mirroring involves multiple disks in a RAID array that are exact copies of each other.

Ex: If you have two copies of a control file in a mirrored RAID array you will actually have four copies in total.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the Flash Recovery Area?

A

The default location on disk for storing every file related to backup and recovery operations:

Note: The FRA is efficient because it allows for fast recovery because all the necessary files are located on disk instead of tape. Also, Oracle manages the files in your FRA using Automatic Disk-Based Backup and Recovery which makes managing the backup and recovery files easier.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What backup-related files can the FRA store?

A
  • Datafile Copies (image copies of datafiles using the BACKUP AS COPY command)
  • RMAN Backup Pieces (OS file containing the backup of a datafile, a control file, and archived redo logs)
  • Incremental Backups
  • Control File Auto-Backups
  • Archived Redo Logs
  • Online Redo Logs
  • Current Control Files
  • Flashback Logs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Automatic Disk-based Backup and Recovery?

A

Oracle manages the backup, including datafiles, archive redo log files, control files, online redo log files and any other files you include in your FRA (i.e. SPFILE, tnsnames.ora, listener.ora).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you enable Automatic Disk-based Backup and Recovery?

A

You must:

  1. Configure an FRA
  2. Allocate Disk Space to the FRA
  3. Allocate MAX disk size to the FRA (i.e. 100GB)
  4. Specify how long to keep backup-related files
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you configure an FRA?

A

You must set five initialization parameters either at the creation of the database or dynamically:

  1. DB_RECOVERY_FILE_DEST_SIZE=___ (Sets the max size of the FRA)
  2. DB_RECOVERY_FILE_DEST=___ (Sets the location of the FRA on disk)
  3. DB_CREATE_FILE_DEST=___ (Sets the location of the datafiles, control files, and online redo logs)
  4. LOG_ARCHIVE_DEST_1 = ‘LOCATION=USE_DB_CREATE_FILE_DEST’
  5. LOG_ARCHIVE_DEST_2 = ‘LOCATION=USE_DB_RECOVERY_FILE_DEST’

Note: You MUST set the location of the FRA (Parameters 1 & 2) on a disk SEPARATE from where the active database files are

Note: You MUST set DB_RECOVERY_FILE_DEST_SIZE first!

Note: LOG_ARCHIVE_DEST_n sets the location of the archived redo log files. We have the archive redo logs going to the location with the datafiles AND the FRA.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you dynamically configure the FRA?

A

SQL> ALTER SYSTEM SET

DB_RECOVERY_FILE_DEST_SIZE=100GB SCOPE=BOTH;

SQL> ALTER SYSTEM SET

DB_RECOVERY_FILE_DEST =‘/u01/app/oracle…’ SCOPE=BOTH;

Note: SCOPE=BOTH ensures the changes are writtenly permanently to the SPFILE.

17
Q

How do you backup the FRA?

A

RMAN> BACKUP RECOVERY AREA (Backs up every file in the FRA to tape)

RMAN> BACKUP RECOVERY FILES (Backs up every file in the FRA as well as recovery-related files on the OS to tape).

18
Q

What view can I use to see FRA-related information?

A

V$RECOVERY_FILE_DEST

Ex: SQL> SELECT * FROM V$RECOVERY_FILE_DEST;

Note: This view can be used to check the current location, disk quota, space in use, total files, and space reclaimable by deleting files.

19
Q

What view can I use to check the space being used by different types of files in the FRA?

A

V$FLASH_RECOVERY_AREA_USAGE

Ex: SQL> SELECT * FROM V$FLASH_RECOVERY_AREA_USAGE

20
Q

How do you delete obsolete backup files?

A

RMAN> DELETE OBSOLETE;

21
Q

What are the ways you can connect to RMAN?

A
  • Connect using Database Authentication:
    • $ rman
    • RMAN> CONNECT TARGET /
  • Connect using OS Authentication:
    • $ rman target /
  • Connect to the Recovery Catalog (Recommended):
    • $ rman target d0dv catalog rman/rman@d0dv

Note: In the example above the rman user is connecting to the target database “d0dv” through the recovery catalog @ d0dv.

22
Q

Explain RMAN Scripting?

A

RMAN comes with a scripting language that allows you to automate backup tasks easily. You can store scripts in the recovery catalog (i.e. stored scripts) or as text files.

Note: Stored scripts are advantageous as they allow anyone logging into RMAN to use them.

23
Q

What are Command Files and how do you use them?

A

Command Files (.cmd) are OS files that contain RMAN commands that need to be executed. They can be executed from the OS or from RMAN.

Ex: Command File “testfile.cmd” contains the command:

BACKUP DATABASE PLUS ARCHIVELOG;

OS Execution: $ rman target / @testfile.cmd

OS Execution using Recovery Catalog:

$ rman target d0dv catalog rman/rman@d0dv CMDFILE testfile.cmd LOG outfile.txt

RMAN Execution: RMAN> @testfile.cmd

24
Q

How do you create Stored Scripts?

A

Stored scripts in RMAN are created using the CREATE SCRIPT command followed by the contents which are enclosed in { }.

Ex:

RMAN> CREATE SCRIPT nightly_backup {

ALLOCATE CHANNEL c1 TYPE DISK;

BACKUP DATABASE FORMAT ‘/u01/app/oracle/%u’

SQL ‘ALTER DATABASE BACKUP CONTROLFILE TO TRACE’;

}

25
Q

How do you execute RMAN Scripts?

A

Execute Stored Scripts with the RUN & EXECUTE SCRIPT commands

Ex:

RMAN> RUN {EXECUTE SCRIPT nightly_backup;}

RMAN> RUN {EXECUTE GLOBAL SCRIPT nightly_backup;}

26
Q

How do you check the syntax of RMAN scripts?

A

Use the CHECKSYNTAX command

Ex:

OS: $ rman CHECKSYNTAX @/tmp/testfile.cmd

RMAN: RMAN> CHECKSYNTAX @testfile.cmd

27
Q

What’s a Global RMAN Script?

A

Global RMAN scripts are scripts that can be used in any database that’s registered in the Recovery Catalog unlike Local RMAN Scripts which can be used only in the database you created them in.

28
Q

How do you create Global RMAN Scripts?

A

Use the CREATE GLOBAL SCRIPT command

Ex:

RMAN> CREATE GLOBAL SCRIPT global_full_backup {

BACKUP DATABASE PLUS ARCHIVELOG;

DELETE OBSOLETE;

}

29
Q

How do you print the contents of a script?

A

Use the PRINT SCRIPT command

Ex:

RMAN> PRINT SCRIPT nightly_backup;

RMAN> PRINT GLOBAL SCRIPT global_full_backup;

30
Q

How do you list all the stored scripts in the Recovery Catalog?

A

Use the LIST SCRIPT NAMES command

Ex:

RMAN> LIST SCRIPT NAMES; (Lists all scripts for the database you’re connected to)

RMAN> LIST ALL SCRIPT NAMES; (List all scripts for every database in the recovery catalog)

31
Q

How do you delete RMAN scripts?

A

Use the DELETE SCRIPT command

Ex:

RMAN> DELETE SCRIPT‘nightly_backup’;

RMAN> DELETE GLOBAL SCRIPT‘global_full_backup’;

32
Q

How do you update a Stored Script?

A

Use the REPLACE SCRIPT command

Ex:

RMAN> REPLACE SCRIPT nightly_backup {

new commands;

}

RMAN> REPLACE GLOBAL SCRIPT nightly_backup {

new commands;

}

33
Q

What is a Backup Piece?

A

An OS file containing the backup of a datafile, control file, and/or archive redo log file.

34
Q

What is a Backup Set?

A

A logical object on disk that contains one or more backup pieces.

Note: RMAN creates a Backup Set anytime any BACKUP command(s) are used.