Explore the basic use of RMAN_02 in ORACLE

Source: Internet
Author: User

Related Links: Exploring the RMAN_01 concept of ORACLE http://www.bkjia.com/database/201205/132243.html RMAN is an implementation tool launched by Oracle8i to better implement database backup and recovery. It can achieve online database backup and recovery without affecting normal business operations. In addition, the Oracle software installation has existed at that time. You do not have to install or buy additional media. From today on, let's talk about the use and maintenance of RMAN: www.2cto.com 1. log on to and access RMANA, and access RMAN in Windows. It is easy to enter rman in the command line. C: \> rmanRecovery Manager: Release 10.2.0.4.0-Production on Fri May 18 10:45:58 2012 Copyright (c) 1982,200 7, Oracle. all rights reserved. RMAN> B. in Linux, you can enter RMAN in the command line. However, you must modify the oracle user environment variable as follows, in Linux, another RMAN command is not from Oracle. PATH = $ ORACLE_HOME/bin:/sbin: $ PATH: Run RMAN [oracle @ wwldb ~] $ RmanRecovery Manager: Release10.2.0.1.0-Production on Fri May 18 10:53:15 2012 Copyright (c) 1982,200 5, Oracle. all rights reserved. RMAN> Note: The above data enters RMAN and runs in NOCATALOGmoshi, so no directory is restored. Enter RMAN to go to The RMAN command line interface. Www.2cto.com 2. Obtain RMAN help [oracle @ wwldb ~] $ Rman help Argument Value Description specified target quoted-string connect-string for target databasecatalog quoted-string connect-string for recovery catalognocatalog none if specified, then no recoverycatalogw.file quoted-string name of input command filelog quoted-string name of output message log filetrace quoted-string name Of output debugging message log fileappend none if specified, log is opened inappend modedebug optional-args activate failed none show RMAN-nnnn prefix for allmessagessential D quoted-string send a command to the media managerpipe string building block for pipe namestimeout integer number of seconds to wait for pipe inputchecksyntax none check the command file for syntaxerrors 3. Start RMAN: number of connected targets Database rman \> connect target user/pwd @ db_name Note: 1. connect cannot be abbreviated as conn 2. Connection USER must have SYSDBA permission 3. Connection db_name must be in tnsnames. ora is configured and valid (that is, it can be connected through SQLPLUS). 4. target database must be in archivelog mode. 5. If it is local, OS authentication can be used. If it is remote, password file authentication is required. 6. The RMAN tool version must be the same as the target database version. 4. run the operating system command Egg in RMAN: RMAN> run {host "ls-artl";} RMAN> run {host "ifconfig ";} RMAN> run {host "pwd";}/home/oraclehost commandcomplete RMAN> run {host "ls";} Desktop sqlnet. loghost commandcomplete RMAN> exit 5. Execute the SQL command in RMAN to operate the database 5.1 start and close the database www.2cto.com RMAN> shutdown immediatedatabase closeddatabase dismountedOracle instance shut down RMAN> startupconnected to target database (not started) oracle Instance starteddatabase mounteddatabase openedTotal System Global Area 285212672 bytesFixed Size 1218968 bytesVariable Size 79693416 bytesDatabase Buffers 197132288 bytesRedo Buffers 7168000 bytes RMAN> 5.2 execute the SQL statement RMAN> SQL 'select * fromuser_tablespace' in RMAN '; SQL statement: select * fromuser_tablespaces RMAN> SQL 'alter system checkpoint'; SQL statement: alter system checkpointRMAN> for explanation, see red Note: rman is not sqlplus, rman show result of "SQL" command, but not show result of 'select .... '1970 execute bak in RMAN. SQL script RMAN> run {executescript bak. SQL} 6. Configure and view the environmental information of RMAN 6.1. view all configuration information of rman. RMAN> show all; using target database control file instead of recoverycatalogRMAN configuration parameters are: configure retention policy to redundancy 1; # default Note: You need TO retain several backup files when configuring redundancy, the default value is 1. It can also be changed to other non-zero positive integer values. Configure backup optimization off; # default
Note: The device backup is optimized and enabled. If the tablespace is read-only, it will be backed up for the first time and will not be backed up later. There are two options: off and on TO enable configure default device type to disk; # default note: the DEFAULT backup DEVICE can be sbt (TAPE), DISK (hard DISK ); the default value is hard disk configure controlfile autobackup off; # default www.2cto.com. Note: whether to back up the control file together during backup. The default value is off and no backup, it can also be an on backup ,. Configure controlfile autobackupformat for device type disk to '% F'; # default Note: CONFIGURE the path and file format FOR automatic BACKUP of control file configure device type disk PARALLELISM1 backup type to backupset; # default Note: configure the disk backup type. The default value is "backupset" or "copy ). The image copy value applies to disk backup, and tape only supports backup sets. Generally, more backup sets are used, which is more efficient. configure datafile backupcopies for device type disk to 1; # default Note: CONFIGURE the number of backup sets. The default value is 1; the backup set will contain configure archivelog backupcopies for device type disk to 1; # default Note: CONFIGURE the default backup path FOR archiving logs: configure maxsetsize to unlimited; # default note: the size of a single backup set is configured, Which is unlimited by default. We can configure it to 1G/100 M/1024 K or otherCONFIGURE encryption for database off; # default note: configuring backup data encryption is a new feature launched by 10Gr2. It is set to on. You can set encryption on identifyed by youpassword only; encrypt the backup and provide a password for restoration. Configureencryption algorithm 'aes128 '; # default Note: Specifies the Backup Data Encryption type. Configure archivelogdeletion policy to none; # default Note: CONFIGURE archive logs TO automatically delete configure snapshot controlfile name to '/DBSoft/product/10.2.0/db_1/dbs/snapcf_WWL.f' After backup '; # default Note: Configuring the snapshot of the control file can effectively improve the recovery of the control file. RMAN> 6.2 view the configuration information of a single parameter: RMAN> show retention policy; RMAN configuration parameters are: configure retention policy to redundancy 1; # default RMAN> show backup optimization; RMAN configuration parameters are: configure backup optimization off; # default RMAN> show default device type; RMAN configuration parameters are: configure default device type to disk; # default note: when viewing the parameter information, execute the parameter name after the input showall parameter. No You can also enter the TO, FORMAT, and for post-par value. 6.3 modify the configuration information of RMAN by executing the configure command. The following operations are performed to connect the parameter name and value: Egg1: RMAN> showcontrolfile autobackup; ----- check whether the value of the current parameter is off. RMAN configuration parameters are: configure controlfile autobackup off; # default RMAN> configure controlfile autobackup on; -- change to on, automatic backup control file new RMAN configuration parameters: www.2cto.com configure controlfile autobackup on; new RMAN configuration parameters are successfully stored RMAN> show controlfile autobackup; --- check that the modified one has been modified successfully. RMAN configuration parameters are: configure controlfile autobackup on; RMAN> Egg2: RMAN> CONFIGURECHANNEL 1 device type disk format'/DBBak/bak _ % d _ % M _ % D _ % U'; new RMANconfiguration parameters: configure channel 1 device type disk format'/DBBak/bak _ % d _ % M _ % D _ % U'; new RMANconfiguration parameters are successfully stored note: configure the backup path of the data file. RMAN> configurecontrolfile autobackup format for device type disk to '% F '; Old RMANconfiguration parameters: configure controlfileautobackup format for device type disk to'/DBBak/ctorl _ % d _ % M _ % D _ % U _ % F'; new RMANconfiguration parameters: configure controlfileautobackup format for device type disk to '% F'; new RMANconfiguration parameters are successfully stored RMAN> Note: CONFIGURE the backup path of the control file RMAN> show all; ------ view all information, the default backup path RMAN configurationparameters are: configure retentio has been changed. Npolicy to redundancy 1; configure backupoptimization off; # defaultCONFIGURE defaultdevice type to disk; # defaultCONFIGURE controlfileautobackup on; configure controlfile autobackup format fordevice type disk to '/DBBak/ctorl _ % d _ % M _ % D _ % U _ % F'; configure device typedisk parallelism 1 backup type to backupset; # defaultCONFIGURE datafilebackup copies for device type disk to 1; # defaultCONFIGURE ARCHI Velogbackup copies for device type disk to 1; # defaultCONFIGURE CHANNEL 1 device type diskformat '/DBBak/bak _ % d _ % M _ % D _ % U'; configure maxsetsizeto unlimited; # defaultCONFIGURE encryptionfor database off; # defaconfigconfigure your 'aes128 '; # defaultCONFIGURE your policy to none; # defaultCONFIGURE snapshotcontrolfile name to'/DBSoft/product/10.2.0/db_1/dbs/snapcf_WWL.f'; # Default www.2cto.com RMAN> 7. Learn and remember the backup file format: the format symbol that can be defined in the backup file is as follows: % c number of copies of the backup file % d database name % D time date (DD) % M Time month (MM) % F unique DBID-based name % n database name. To the right, enter a maximum of 8 characters % u. An eight-character name indicates the backup set creation time % p indicates the backup credits in the backup set, the number of files created from 1 to % U is a unique file name, % u _ % p _ % c % S backup Set ID % t backup set timestamp % T year month day format (YYYYMMDD) Note: % F is a unique name based on DBID, the format is in c-IIIIIIIIII-YYYYMMDD-QQ where iiiiiiiiiii is the database's DBID, YYYYMMDD is the date, QQ is the serial number of 1. 8. Based on the above configuration, perform a backup case: 1. To perform an rman backup, you must enable the data archiving function: SQL> shutdown immediate --- disable Database closed. database dismounted. ORACLE instance shut down. SQL> startupmount; ---- start the database to the mount state ORACLE instance started. total System Global Area 285212672 bytesFixed Size 1218968 bytesVariable Size 79693416 bytesDatabase Buffers 197132288 bytesRedo Buffers 7168000 bytesDatabase mounted. SQL> alter database archivelog ;--- Enable the archive function Database altered. SQL> archivelog list; --- view the Archive status Database logmode Archive Mode --- the Archive has the Automatic archival EnabledArchive destination enabled online logsequence 8 Next log sequence toarchive 10 Current log sequence 10SQL> 2. Execute rman full Database backup [oracle @ wwldbDBBak] $ rman target/--- log on to rman www.2cto.com Recovery Manager: release10.2.0.1.0-Production on Ç ú??=5 =â 18 18:56:47 201 2 Copyright (c) 1982,200 5, Oracle. all rights reserved. connected to target database: WWL (DBID = 5520179, not open) --- DBID of the current data and Instance name and status RMAN> backupdatabase; ----- execute the backup database command Starting backup at 18-5 Ô Â-12 ---- start the backup time using target database controlfile instead of recovery catalog ----- description of the data backup mode allocated channel: ORA_DISK_1 ---- distribution channel ORA_DISK_1: sid = 159 devtype = DISK ---- tell the backup device type to be hard DISK channel ORA_DISK_1: Startingfull datafile backupset ---- the backup mode is full backup channel ORA_DISK_1: specifying datafile (s) in backupset ---- retrieve the data file to be backed up based on the preceding conditions: input datafile fno = 00001 name =/DBData/WWL/system01.dbf ---- File Information input datafile fno = 00003 name =/DBData/WWL /sysaux01.dbfinput datafile fno = 00002 name =/DBData/WWL/undotbs01.dbfinput datafile fno = 00004 name =/DBData/WWL/users01.dbfchannel ORA_DISK_1: startingpiece 1 at 18-5 Ô Â-12 ---- tell Channel Start time channel ORA_DISK_1: finishedpiece 1 at 18-5 Ô Â-12 ---- tell the channel End time piecehandle =/DBBak/notify tag = INFORM comment = NONEchannel ORA_DISK_1: backupset complete, elapsed time: 00:01:05 ----- generate the backup file. In the/DBBak directory, the file name is defined in the Environment configuration. Finished backup at 18-5 Ô Â-12 Starting Control File andSPFILE Autobackup at 18-5 Ô Â-12 --- start the backup Control File piecehandle =/DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120518-01 comment = NONEFinished Control File andSPFILE Autobackup at 18-5 Ô Â-12 ------ generate a backup of the Control File, I didn't specify the backup path of controlfile, so the backup is in the default path, and the file name is generated using the % F parameter. RMAN> www.2cto.com 3. view the backup set information RMAN> listbackupset; --- execute the list backupst command to view the backup set information List of BackupSets ==================== BS Key Type LV Size Device Type Elapsed Time Completion time ------- ---- ------------ ----------- ------------ --------------- 2 Full 522.59 m disk 00:00:59 18-5 Ô Â-12 BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20120518T185700 Piece Name:/DBBak/bak_WWL_05_18_04nbaffs_1_1 -- backup file Name and path List of Datafiles in backup set 2 --- backup and NO. Comment: BS: is backup set number Key: Type: Backup Type, whether it is full backup or Incremental backup or differential backup LV Size: backup file Size after backup Device Type: media Type that stores backup files Elapsed Time: backup execution Time: backup completion Time File LV Type Ckp SCN Ckp Time Name ---- ---------- -------- ---- 1 Full 618100 18-5 Ô Â-12/DBData/WWL/system01.dbf 2 Full 618100 18-5 Ô Â-12 /DBData/WWL/undotbs01.dbf 3 Full 618100 18-5 Ô Â-12/DBData/WWL/sysaux01.dbf 4 Full 618100 18-5 Ô Â-12/DBData/WWL/users01.dbf note: file: Data File No. www.2cto.com Type: Backup Type Ckp SCN: checkpoint No. During backup Ckp Time: Checkpoint Time Name: backup Data File Name and path BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- ------------ ----------- ------------ ----------------- 3 Full 6.80 m disk 00:00:02 18-5 Ô Â-12 BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20120518T185806 Piece Name:/DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120518-01 Control File Included: Ckp SCN: 618100 Ckp time: 18-5 Ô Â-12 SPFILE encoded ded: Modification time: 18-5 Ô Â-12 RMAN> 4. view the backup file [oracle @ wwldbbak] $ pwd/DBBak [oracle @ wwldbDBBak] $ lsbak_WWL_05_18_04nbaffs_1_1 lost + found ---- the file name is configured with CONFIGURECHANNEL 1 device type disk format'/DBBak/bak _ % d _ % M _ % D _ % U '; settings for this parameter [oracle @ wwldbDBBak] $ ll www.2cto.com × Ü 20.0000535164-rw-r ----- 1 oracle oinstall 547987456 05-18 bak_WWL_05_18_04nbaffs_1_1drwxrwxr-x 2 oracle oinstall 16384 05-18 17: 35 lost + found [oracle @ wwldb DBBak] $ RMAN> showchannel; RMANconfiguration parameters are: CONFIGURECHANNEL 1 device type disk format'/DBBak/bak _ % d _ % M _ % D _ % U'; Author: Wu weilong

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.