1. Related views
V $ backup_files
V $ backup_set
V $ backup_piece
V $ backup_redolog
V $ backup_spfile
V $ backup_device
V $ rman_configuration
V $ archived_log
V $ backup_upload uption
V $ copy_uption
V $ database_block_corruption
V $ backup_datafile
2. view the Server sessions corresponding to the Channel
Use the SET command id command
Query v $ process and V $ session to determine which session corresponds to the RMAN Channel
SQL> select Sid, username, client_info from V $ session
2 Where client_info is not null;
Sid username client_info
----------------------------------------------------------------------
146 sys RMAN channel = ora_disk_1
148 sys RMAN channel = ora_disk_2
150 sys RMAN channel = ora_disk_3
-- The following uses the SET command id command
RMAN> run {
2> allocate channel category type disk;
3> set command ID to 'rman ';
4> Backup as copy datafile 4
5> Format '/u01/APP/Oracle/rmanbak/DD _ % U ';
6>}
SQL> select Sid, username, client_info from V $ session
2 Where client_info is not null;
Sid username client_info
----------------------------------------------------------------------
140 sys id = RMAN
SQL> select Sid, spid, client_info
2 from V $ PROCESS p, V $ session s
3 where P. ADDR = S. paddr
4 and client_info like '% id = % ';
Sid spid client_info
----------------------------------------------------
140 5002 id = RMAN
-- View the complete progress of RMAN
SQL> select Sid, serial #, context, SOFAR, totalwork,
2 round (SOFAR/totalwork * 100,2) "% complete"
3 from V $ session_longops
4 where opname like 'rman: %'
5 and opname not like 'rman: Aggregate %'
6 and totalwork! = 0;
-- Obtain the SID and spid information of the service process that RMAN uses to perform backup operations using the following SQL statement:
Select Sid, spid, client_info
From v $ PROCESS p, V $ session s
Where p. ADDR = S. paddr
And client_info like '% id = RMAN %'
3. Automatic RMAN backup in Linux
Backup script + crontab
Bak_inc0: Incremental backup, which is used for backup every Sunday
Bak_inc1: Incremental backup, which uses Incremental Backup every Wednesday. Backup data changes from Sunday to Wednesday
Bak_inc2: Incremental backup at the level, which backs up incremental backups generated on a daily basis. For example, from Sunday to Monday, from Monday to Tuesday
-- The following is a level-increment script, which is processed by other levels and levels according to law. What is different is the backup level and tag
[Oracle @ oradb Scripts] $ cat bak_inc0
Run {
Allocate channel category type disk;
Backup as compressed backupset incremental level 0
Format '/u01/Oracle/BK/rmbk/incr0 _ % d _ % U'
Tag 'day _ encr0'
Database Plus archivelog Delete input;
Release Channel identifier;
}
Test scripts one by one
[Oracle @ oradb BK] $ RMAN target/log =/u01/Oracle/BK/log/bak_inc0.log/
> Export file =/u01/Oracle/BK/scripts/bak_inc0.rcv
RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
[Oracle @ oradb BK] $
Edit crontab
[Root @ oradb ~] # Whoami
Root
[Root @ oradb ~] # Crontab-e-u Oracle
45 23 ** 0 RMAN target/log =/u01/Oracle/BK/log/bak_inc0.log append partition file =/u01/Oracle/BK/scripts/bak_inc0.rcv
45 23 ** 1 RMAN target/log =/u01/Oracle/BK/log/bak_inc2.log append partition file =/u01/Oracle/BK/scripts/bak_inc2.rcv
45 23 ** 2 RMAN target/log =/u01/Oracle/BK/log/bak_inc2.log append partition file =/u01/Oracle/BK/scripts/bak_inc2.rcv
45 23 ** 3 RMAN target/log =/u01/Oracle/BK/log/bak_inc1.log append partition file =/u01/Oracle/BK/scripts/bak_inc1.rcv
45 23 ** 4 RMAN target/log =/u01/Oracle/BK/log/bak_inc2.log append partition file =/u01/Oracle/BK/scripts/bak_inc2.rcv
45 23 ** 5 RMAN target/log =/u01/Oracle/BK/log/bak_inc2.log append partition file =/u01/Oracle/BK/scripts/bak_inc2.rcv
45 23 ** 6 RMAN target/log =/u01/Oracle/BK/log/bak_inc2.log append partition file =/u01/Oracle/BK/scripts/bak_inc2.rcv
"/Tmp/crontab. xxxxinbzgr" 7l, 791c written
Crontab: Installing new crontab
Save and restart crontab.
[Root @ oradb ~] # Service crond restart
Stopping crond: [OK]
Starting crond: [OK]
Check whether automatic backup is successfully executed