1. logon and exit command of RMAN: Method 1: $ rmannocatrman directly enters rman to back up data in non-catalog mode, or do not use nocatalogrman> connect
1. Run the following command to log on and exit RMAN: Method 1: $ rman nocatalog directly enters rman and backs up data in non-catalog mode. Do not use nocatalogrman> connect
Method 1: $ rman nocatalog directly enters rman to back up data in a non-catalog mode. Do not use nocatalog.
Rman> connect target/connect to target database
Method 2: rmantarget/rman target/nocatalog
Method 3: rmantarget sys/oraclesys @ bys log on to the remote database or non-operating system verification database of the local machine.
Method 4: rmantarget sys/oraclesys log on to the default local database
Method 5: rman targetsys/oraclesys@192.168.0.181: 1521/orcl
Method 6: rmantarget sys/oraclesys @ xporacle: 1521/orcl
Exit: exit
You can run SQL commands such as SHUTDOWN IMMEDIATE and STARTUP MOUNT in RMAN.
Host is required to execute the operating system command.
SQL is required to execute SQL commands, and query statements cannot be executed.
2. RMAN internal query command
Show all view RMAN global configuration
RMAN> show channel;
RMAN> show device type;
RMAN> show default device type;
View the physical results of the target database in report schema. The table space and corresponding data file information are displayed.
List backup information:
RMAN> list backup;
RMAN> list backup of database;
RMAN> list backup of tablespacetable_name;
RMAN> list backup of controlfile;
RMAN> list backup of spfile;
RMAN> list backupset id. Here ID refers to the id number of the Backup set, such as 2 and 3.
Verify the backup information:
RMAN> crosscheck backup;
RMAN> crosscheck backup of database;
RMAN> crosscheck backup of tablespacesystem;
RMAN> crosscheck backup of controlfile;
RMAN> crosscheck backup of spfile;
RMAN> crosscheck archivelog all;
Delete backup
When executing the DELETE command, you need to understand the following:
If the discarded backup is an image copy of a separate data file, the image copy file will be deleted directly when the DELETE command is executed.
If an discarded backup set is considered a part of a backup set, the backup set can be deleted only when all other files in the backup set are discarded.
Tip:
Note that oracle defines obsolete and expired in contrast to our general understanding. The definition of Oracle is as follows. Physically, deleted files do not exist. After crosscheck is executed, oracle marks them as expired, for those backup sets that exceed the backup retention policy, it is marked as obsolete.
RMAN> report obsolete; report obsolete backup
RMAN> delete obsolete; -- delete old backup
RMAN> delete expired backup;
RMAN> delete expired copy; delete an EXPIRED copy.
RMAN> delete backupset 9; delete
RMAN> delete backuppiece evaluate F: \ backup \ DEMO_9.bak evaluate; delete a specific backup part
RMAN> delete backup; -- delete all backups
RMAN> delete copy; delete image copies
RMAN> delete datafilecopy ○ F: \ backup \ DEMO_9.bak ○ delete a specific image copy
Delete multiple specified backup sets at the same time, separated by commas
RMAN> delete backupset 62,62, 63,64, 65,66, 67;
Using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc # Cp # Status Device Type Piece Name
----------------------------------------------------
62 62 1 1 available disk/backup/ctl_c-2041679290-20130618-05
62 62 1 1 available disk/backup/ctl_c-2041679290-20130618-05
63 63 1 1 available disk/u01/app/oracle/flash_recovery_area/BYS001/backupset/2013_06_18/o1_mf_nnndf_TAG20130618T170650_8w08sc14 _. bkp
64 64 1 1 available disk/backup/ctl_c-2041679290-20130618-06
65 65 1 1 available disk/u01/app/oracle/flash_recovery_area/BYS001/backupset/2013_06_18/o1_mf_nnndf_TAG20130618T171003_8w08zcpq _. bkp
66 66 1 available disk/backup/ctl_c-2041679290-20130618-07
67 67 1 1 available disk/backup/full/bys001arch_bys0000008184400009_72
Do you really want to delete the aboveobjects (enter YES or NO )?
Delete archived logs:
RMAN> deletearchivelog all; Delete all archives
RMAN> delete archivelog until time 'sysdate-1'; delete the archive before the current day. -7 is 7 days ago.
RMAN> delete archivelog all delete input;
RMAN> delete backupset 22 format = ○ d: \ backup \ % u. bak ○ delete input;
Delete input object after backup
Changes the status of a backup set.
RMAN> change backupset id unavailable; -- available
RMAN> change backupset id keep foreverlogs; change to long-term backup
RMAN> change backupset id keep untiltime 'sysdate + 60' logs;
RMAN> change backupset id nokeep;
RMAN> report unrecoverable; report unrecoverable data files
Recommended reading:
Basic Oracle tutorial-copying a database through RMAN
Reference for RMAN backup policy formulation
RMAN backup learning notes
Oracle Database Backup encryption RMAN Encryption