Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to the basic commands of Rman

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

The main content of this article is "introduction to the basic commands of Rman". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "introduction to the basic commands of Rman".

You can use the RMAN environment to open and close the database:

[oracle@rosan ~] $rman target /

Recovery Manager: Release 10.2.0.4.0-Production on Mon Jul 21 15:01:20 2014

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to target database: ORCL (DBID=1370475407)

RMAN >

Connected to target database: ORCL (DBID=1300072061)

RMAN > shutdown immediate

Using target database control file instead of recovery catalog

Database closed

Database dismounted

Oracle instance shut down

RMAN >

RMAN > startup

Connected to target database (not started)

Oracle instance started

Database mounted

Database opened

Total System Global Area 515899392 bytes

Fixed Size 1268412 bytes

Variable Size 457180484 bytes

Database Buffers 54525952 bytes

Redo Buffers 2924544 bytes

RMAN >

Execute the sql statement:

RMAN > sql 'alter system switch logfile'

Using target database control file instead of recovery catalog

Sql statement: alter system switch logfile

Basic backup commands:

Full library backup:

SYS@orcl10g > alter system set db_recovery_file_dest_size=4G scope=both

/ / modify the size of flashback recovery area to 4G

RMAN > backup database

Specify the backup path:

RMAN > backup database format'/ u01Accord backupUniverse bakery% U'

Back up the tablespace:

RMAN > backup tablespace mytbs2

Back up the data file:

SYS@orcl10g > select tablespace_name,file_name, bytes/1048576 size_M from dba_data_files order by tablespace_name

TABLESPACE_NAME FILE_NAME SIZE_M

-

EXAMPLE / u01/app/oracle/oradata/orcl/example01.dbf 100

FLASHTBS / oracle_new/datafiles/flashtbs01.dbf 4

IND_TBS / oracle_new/datafiles/ind_tbs01.dbf 10

MYTBS2 / u01/app/oracle/newdata/mytbs201.dbf 5

MYTBS3 / u01/app/oracle/newdata/mytbs301.dbf 10

NEW_TBS / oracle_new/datafiles/new_tbs01.dbf 10

PART1 / oracle_new/datafiles/part01.dbf 10

PART2 / u01/app/oracle/part/part02.dbf 10

PART3 / u01/app/oracle/part/part03.dbf 10

SYSAUX / u01/app/oracle/oradata/orcl/sysaux01.dbf 280

SYSTEM / oracle_new/datafiles/system01.dbf 490

UNDO2 / u01/app/oracle/newdata/undo2.dbf 50

UNDOTBS1 / u01/app/oracle/oradata/orcl/undotbs01.dbf 30

UNDO_NEW / oracle_new/datafiles/undo01.dbf 100

USERS / u01/app/oracle/oradata/orcl/users01.dbf 441.25

RMAN > backup datafile'/ oracle_new/datafiles/new_tbs01.dbf'

Backup control files:

RMAN > backup current controlfile

Back up the archive log:

RMAN > backup archivelog all

Back up the archive log while backing up the control file:

RMAN > backup current controlfile plus archivelog

Back up the parameter file:

RMAN > backup spfile

Naming format of backup files:

Format:

Resetlog_id of% a:Oracle database

% c: number of copies of backup slices

% d: database name of Oracle

% D: DD of the current Tim

% e: archive serial number

% f: absolute file number

% F: determine a unique name based on DBID+ time

% U:%u_%p_%c

Single command: backup database

Batch command:

Rman > run {

2 > allocate channel cha1 type disk

3 > backup

4 > format'/ u01qqrmanbakUniple fullbacks% t'

5 > tag full-backup / / tags can be picked up by the way, it doesn't matter

6 > database

7 > release channel cha1

8 >}

There are three commands in this run, which are divided by semicolons.

Format:

% c: number of copies of backup slices (numbered from 1)

% d: database name

% D: number of days in the month (DD)

% M: the month in the year (MM)

% F: a unique name based on DBID, in the form of c-xxx-YYYYMMDD-QQ, where xxx bit the DBID,YYYYMMDD of the database is the date, and QQ is a sequence of 1-256

% n: database name and will be populated with x characters on the right to keep its length 8

% u: is an 8-character name composed of backup set number and establishment time compression. Use% u to generate a unique name for each backup set

% p: represents the number of the backup slice in the backup set, starting with 1

% U: is the shorthand for% u_%p_%c, which allows you to generate a unique name for each backup fragment (both disk files), which is the most commonly used naming method

% t: backup set timestamp

% T: format of year, month and day (YYYYMMDD)

The concept of channel: a channel is a connection between the rman and the target database. The "allocate channel" command starts a server process in the target database, and the server process must be defined to perform backup and restore operations to make

The type of Icano used

Channel control commands can be used to:

Control the OS resources used by rman

Affect parallelism

Specify the limit value of the bandwidth of the Icano (set the limit read rate parameter)

Specify a limit on the size of the backup slice (set limit kbytes)

Specify the limit value for the currently open file (set limit maxopenfiles)

Command to list backup information:

List

RMAN > list backup

/ / list all backup information

RMAN > list backup of

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-00558: error encountered while parsing input commands

RMAN-01009: syntax error: found ";": expecting one of: "archivelog, controlfile, database, datafile, spfile, tablespace"

RMAN-01007: at line 1 column 15 file: standard input

/ / Category view backup information

RMAN > list backup of spfile

Report report display commands:

RMAN > configure retention policy to redundancy 3

RMAN > report need backup

/ / according to the current backup retention policy, check which data objects do not meet the backup requirements

RMAN > report need backup tablespace system

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 3

Report of files with less than 3 redundant backups

File # bkps Name

1 2 / oracle_new/datafiles/system01.dbf

RMAN > report need backup tablespace part1

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 3

Report of files with less than 3 redundant backups

File # bkps Name

/ / check whether some specific tablespaces meet the backup requirements; if not, the data objects that need to be backed up are displayed.

/ / if it is satisfied, it is not displayed.

RMAN > report obsolete

/ / according to the backup retention policy, check which backup sets, or backup image copy, have exceeded the backup requirements and are no longer needed.

Delete command:

RMAN > delete obsolete

/ / Delete expired backups

RMAN > delete backupset 29

/ / Delete a specific backup set

RMAN > delete expired archivelog all

/ / Delete invalid archive log files

RMAN > delete backup

/ / Delete all backups

Crosscheck:

Cross-check command

RMAN > crosscheck

RMAN-00571: =

RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =

RMAN-00571: =

RMAN-00558: error encountered while parsing input commands

RMAN-01009: syntax error: found ";": expecting one of: "archivelog, backup, backuppiece, backupset, copy, controlfilecopy, datafilecopy, proxy"

RMAN-01007: at line 1 column 11 file: standard input

RMAN > crosscheck archivelog all

RMAN > crosscheck backupset 32

Using channel ORA_DISK_1

Crosschecked backup piece: found to be 'EXPIRED'

Backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_03_14/o1_mf_nnndf_TAG20120314T143542_7p0h2ydh_.bkp recid=32 stamp=777911742

Crosschecked 1 objects

RMAN > delete expired backup

/ / Delete invalid backups

*

How to back up data as copy:

RMAN > backup as copy tablespace bak

RMAN > list copy of tablespace "BAK"

RMAN > delete copy

At this point, I believe you have a deeper understanding of the "introduction to the basic commands of Rman". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report