Home Database Mysql Tutorial Oracle:RMAN 备份与恢复实例

Oracle:RMAN 备份与恢复实例

Jun 07, 2016 pm 05:03 PM
number

命令: connect target / (connect target system/oracle@ora10g,如果数据库没有起来,也可要直接在rman命令下用startup进行启动

1. 检查数据库模式:
   sqlplus /nolog
   conn /as sysdba
   archive log list (查看数据库是否处于归档模式中)

   若为非归档,则修改数据库归档模式。
   startup mount
   alter database archivelog
   alter database open

2.连接到target数据库

命令: connect target  / (connect target system/Oracle@ora10g,如果数据库没有起来,也可要直接在rman命令下用startup进行启动数据库) 
可以连接到target database.(rman 一边连接到target数据库,另外一边连接到control file(nocatalog mode),control file 中存储rman 的备份信息)

3.用list backupset 命令查看有没有备份的东西

4. 常用备份命令:
 备份全库:
RMAN> backup database plus archivelog delete input;     (备份全库及控制文件、服务器参数文件与所有归档的重做日志,并删除旧的归档日志)
备份表空间:
RMAN> backup tablespace system plus archivelog delete input;     (备份指定表空间及归档的重做日志,并删除旧的归档日志)_
备份归档日志:
RMAN> backup archivelog all delete input;


======================对整个数据库进行备份==================

1.对整个数据库进行全备份(full backup)。

    只要输入命令: backup database;

2.list backupset 查看备份的具体信息

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    6.80M      DISK        00:00:02     06-DEC-08     
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20081206T201041
        Piece Name: /home/oracle/flash_recovery_area/ORA10G/backupset/2008_12_06/o1_mf_ncsnf_TAG20081206T201041_4mntz78s_.bkp
  Control File Included: Ckp SCN: 782019       Ckp time: 06-DEC-08
  SPFILE Included: Modification time: 06-DEC-08

BS(backupset), piece是一个文件,一个BS包含多个piece.

3.rman中缺省的参数,可以通过 show all ;
来进行查看(RMAN configuration parameters),我们在使用backup database命令中,可以把这些default value 用固定的值来进行替代.

4.我们可以把备份的文件才备份的目录中拷贝到磁带上,,然后删除备份目录下面的备份文件,如果下次需要恢复的话,只要把文件重新拷回到用来的备份目录就可以了
5.查看control file 文件中的备份信息(因为我们做的备份是在nocatalog模式下),control file 在/u01/oracle/oradata/ora10g目录下,由于control file 是个二进制文件,要查看control file 文件中的内容,用strings control03.ctl,发现control03.ctl中有rman备份的信息了

 
====================0级增量备份===============

概念:全备份和0级增量备份。全备份和0级增量备份几乎是一样的。唯一的区别,0级增量备份能作为增量备份的基础,而全备份不能作为增量备份的基础。其它方面完全一致

1.backup incremental level=0(leve 0) database;(增量为0的备份)
2.backup incremental level 1(level=1) database;(增量为1的备份)
 
在上面的备份中,我们备份了datafile,controlfile和parameter file.没有备份的文件有归档日志,重做日志和口令文件没有备份.口令文件不需要备份,我们用orapw来创建一个

新的口令文件.rman 在nocatalog模式下,不能够对redo log file 进行备份


===================备份archivelog 在nocatalog模式下=================

命令:backup database plus archivelog delete input(delete input的意思在备份完成后,删除 archivelog文件,这个选项可要可不要,这个命令也可以用 backup incremental level=0(1,2...)来进行备份)


=======================备份表空间====================

backup tablespace tablespacename

如果我们不知道tablespace的名字,在rman中,可要通过report schema命令,来查看表空间的名字

MAN> report schema;
Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    480      SYSTEM               ***     /home/oracle/oradata/ora10g/system01.dbf
2    25       UNDOTBS1             ***     /home/oracle/oradata/ora10g/undotbs01.dbf
3    250      SYSAUX               ***     /home/oracle/oradata/ora10g/sysaux01.dbf
4    5        USERS                ***     /home/oracle/oradata/ora10g/users01.dbf
5    200      PERFSTAT             ***     /home/oracle/oradata/ora10g/perfstat.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /home/oracle/oradata/ora10g/temp01.dbf

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

C program to find the largest prime factor of a number C program to find the largest prime factor of a number Aug 27, 2023 am 10:09 AM

PrimeFactor−Innumbertheory,theprimefactorsofapositiveintegeraretheprimenumbersthatdividethatintegerexactly.Theprocessoffindingthesenumbersiscalledintegerfactorization,orprimefactorization.Example−Primefactorsof288are:288=2x2x2x2x2

Top 10 Global Digital Virtual Currency Trading Platform Ranking (2025 Authoritative Ranking) Top 10 Global Digital Virtual Currency Trading Platform Ranking (2025 Authoritative Ranking) Mar 06, 2025 pm 04:36 PM

In 2025, global digital virtual currency trading platforms are fiercely competitive. This article authoritatively releases the top ten digital virtual currency trading platforms in the world in 2025 based on indicators such as transaction volume, security, and user experience. OKX ranks first with its strong technical strength and global operation strategy, and Binance follows closely with high liquidity and low fees. Platforms such as Gate.io, Coinbase, and Kraken are at the forefront with their respective advantages. The list covers trading platforms such as Huobi, KuCoin, Bitfinex, Crypto.com and Gemini, each with its own characteristics, but investment should be cautious. To choose a platform, you need to consider factors such as security, liquidity, fees, user experience, currency selection and regulatory compliance, and invest rationally

Top 10 exchanges in the currency circle in 2025 latest digital currency app rankings Top 10 exchanges in the currency circle in 2025 latest digital currency app rankings Feb 27, 2025 pm 06:33 PM

Ranking of the top ten virtual currency trading platforms (latest in 2025): Binance: Global leader, high liquidity, and regulation has attracted attention. OKX: Large user base, supports multiple currencies, and provides leveraged trading. Gate.io: A senior exchange, with a variety of fiat currency payment methods, providing a variety of trading pairs and investment products. Bitget: Derivatives Exchange, high liquidity, low fees. Huobi: An old exchange that supports a variety of currencies and trading pairs. Coinbase: A well-known American exchange, strictly regulated. Phemex and so on.

Top 10 digital currency trading platforms The latest list of top 10 digital currency trading platforms Top 10 digital currency trading platforms The latest list of top 10 digital currency trading platforms Mar 17, 2025 pm 05:57 PM

Top 10 digital currency trading platforms: 1. OKX, 2. Binance, 3. Gate.io, 4. Huobi Global, 5. Kraken, 6. Coinbase, 7. KuCoin, 8. Bitfinex, 9. Crypto.com, 10. Gemini, these exchanges have their own characteristics, and users can choose the platform that suits them based on factors such as security, fees, currency selection, user interface and customer support.

Top 10 trading platforms for digital currency apps, regular currency speculation platform app recommendations Top 10 trading platforms for digital currency apps, regular currency speculation platform app recommendations Mar 07, 2025 pm 06:51 PM

This article recommends ten digital currency trading apps: 1. OKX; 2. Binance; 3. Gate.io; 4. Huobi Global; 5. Kraken; 6. Coinbase; 7. KuCoin; 8. Crypto.com; 9. Bitfinex; 10. Poloniex. When choosing a platform, you need to consider factors such as security, liquidity, transaction fees, currency selection, user interface, customer service support and regulatory compliance, and carefully evaluate risks and never blindly follow the trend.

The world's top ten virtual currency trading platform app genuine download and installation tutorial The world's top ten virtual currency trading platform app genuine download and installation tutorial Mar 12, 2025 pm 05:33 PM

This article provides Android and Apple mobile APP download methods for mainstream digital currency trading platforms such as Binance, OKX, Gate.io, Huobi Global, Coinbase, KuCoin, Kraken and Bitfinex. Whether it is an Android user or an Apple user, you can easily find the official APP download link for the corresponding platform and complete the installation according to the steps. The article provides detailed guidance on searching and downloading on their respective official websites or app stores, and provides instructions on the special steps for installing APK files on Android, so that users can download and use them quickly and easily.

What are the reliable digital currency platforms? Top 10 formal digital currency trading platforms 2025 What are the reliable digital currency platforms? Top 10 formal digital currency trading platforms 2025 Mar 17, 2025 pm 05:45 PM

Reliable digital currency platforms include: 1. OKX, 2. Binance, 3. Gate.io, 4. Huobi Global, 5. Kraken, 6. Coinbase, 7. KuCoin, 8. Bitfinex, 9. Crypto.com, 10. Gemini. These exchanges have their own characteristics. Users can choose the platform that suits them based on factors such as security, fees, currency selection, user interface and customer support.

Top 10 digital currency app trading platforms top10 virtual currency app 2025 rankings Top 10 digital currency app trading platforms top10 virtual currency app 2025 rankings Mar 13, 2025 pm 07:00 PM

The rankings of the top ten virtual currency trading platforms are: 1. OKX; 2. Binance; 3. Gate.io; 4. Huobi Global; 5. Kraken; 6. Coinbase; 7. KuCoin; 8. Crypto.com; 9. Bitfinex; 10. Gemini. The ranking is based on comprehensive considerations such as platform liquidity, currency selection, security, user experience, handling fees and compliance, but is for reference only. Investment should be cautious and at your own risk.

See all articles