Note_Tech

All technological notes.


Project maintained by simonangel-fong Hosted on GitHub Pages — Theme by mattgraham

DBA - Recovery Manager (RMAN)

Back


Commands

RMAN Command Description
host 'clear screen'; Clear screen
host 'clear'; Clear screen
show all; List all persistent settings
show <setting>; Show a persistent setting
configure <setting> <value>; Configure a persistent setting
configure <setting> clear; Set a persistent setting back to default
RESYNC CATALOG Execute catalog resynchronization
BACKUP DATABASE Backup the entire database
ALLOCATE CHANNEL Allocate a channel for executing a job command
RMAN Command Description
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF <days> DAYS; Configure the recovery window retention policy
CONFIGURE RETENTION POLICY TO REDUNDANCY <copies>; Configure the redundancy retention policy
CONFIGURE RETENTION POLICY TO NONE; Disable the retention policy

Oracle Recovery Manager (RMAN)

diagram_rman01


Connecting to RMAN and a Target Database

# call oraenv script to set environment vairable
. oraenv

# rman connect to the local db with the sYSBACKUP privilege.
rman target "'/ as sysbackup'"

Using SQL in RMAN

rman_sql_command01


Types of RMAN Commands



Job commands


Configuring Persistent Settings for RMAN


View all RMAN persistent settings

-- RMAN command to view all configuration settings
SHOW ALL;

-- sql command to display configuration settings that have been explicitly set.
SQL 'select * from V$RMAN_CONFIGURATION';
-- if no explicit settings, nothing returns.

rman_show_all01


Managing Persistent Settings

-- where <n> is the parallelism value.
CONFIGURE DEVICE TYPE <device> PARALLELISM <n>

SHOW CONTROLFILE AUTOBACKUP FORMAT;
SHOW EXCLUDE;
SHOW ALL;

CONFIGURE BACKUP OPTIMIZATION CLEAR;
CONFIGURE MAXSETSIZE CLEAR;
CONFIGURE DEFAULT DEVICE TYPE CLEAR;

Lab

Backup Database

-- in sqlplus
show parameter db_recovery_file_dest

-- in rman
BACKUP DATABASE;

lab_rman_backup

lab_rman_backup

Include all datafiles of CDB and all PDBs, along with control file and parameter file will be backed up. By default, using backup set

lab_rman_backup

lab_rman_backup


Setting the Date and Time Format for RMAN

# edite bash script
vi ~oracle/.bashrc

# apply bash script to export env var
. ~oracle/.bashrc
list backup;

lab_rman_backup

lab_rman_backup


View RMAN Configuration

-- Displays whether RMAN is configured to automatically back up the control file and server parameter file whenever a backup or copy operation is performed.
show controlfile autobackup;

-- Displays the retention policy settings for backups, which specify how long to keep backups and how they should be managed.
show retention policy;

-- Provides a summary report of the database schema, including information about the datafiles, tablespaces, and their sizes.
REPORT SCHEMA;

lab_rman_backup


Backup Tablespace

BACKUP TABLESPACE users, PDB1:USERS;

lab_rman_backup


Direct the Output to a File

-- do not use ~ for home,
-- rman will create the file
SPOOL LOG TO /tmp/test.log
-- will not display
List Backup
-- stop directing output to the file.
SPOOL LOG OFF

lab_rman_backup

lab_rman_backup


TOP