溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

怎么用rman備份數(shù)據(jù)庫(kù)

發(fā)布時(shí)間:2021-08-16 19:48:53 來(lái)源:億速云 閱讀:152 作者:chen 欄目:關(guān)系型數(shù)據(jù)庫(kù)

這篇文章主要講解了“怎么用rman備份數(shù)據(jù)庫(kù)”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“怎么用rman備份數(shù)據(jù)庫(kù)”吧!

在數(shù)據(jù)庫(kù)mount或者open階段,我們可以使用backup database備份整個(gè)數(shù)據(jù)庫(kù)。
也可以使用configure exclude命令在配置中默認(rèn)在全備時(shí)排除某個(gè)表空間不備份,也可以在backup時(shí)指定 noexclude不排除某個(gè)表空間。

備份數(shù)據(jù)的步驟:
1.使用RMAN連接目標(biāo)庫(kù)
2.確認(rèn)數(shù)據(jù)庫(kù)是mount或者open階段
3.使用backup database命令備份數(shù)據(jù)庫(kù)。在備份之前應(yīng)該確認(rèn)configuration中的默認(rèn)值,然后根據(jù)實(shí)際情況添加參數(shù),如果channel,format,plus archivelog等等。

默認(rèn)值中備份了spfile和controlfile,示例分配兩個(gè)channel備份全庫(kù)
[oracle@lzl ~]$ vi /home/oracle/full_backup.sql
[oracle@lzl ~]$ cat /home/oracle/full_backup.sql 
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup database format '/home/oracle/rman_full_%T_%u';
release channel c1;
release channel c2;
}


 RMAN> @/home/oracle/full_backup.sql
RMAN> run{
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> backup database format '/home/oracle/rman_full_%T_%u';
5> release channel c1;
6> release channel c2;
7> }
released channel: ORA_DISK_1。   —release了默認(rèn)值中的channel
allocated channel: c1
channel c1: SID=1 device type=DISK
allocated channel: c2
channel c2: SID=43 device type=DISK。 —每個(gè)channel擁有獨(dú)立的sid


Starting backup at 2017-07-25 16:48:13
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/test/system01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/test/users01.dbf
channel c1: starting piece 1 at 2017-07-25 16:48:13
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/test/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/test/undotbs01.dbf
channel c2: starting piece 1 at 2017-07-25 16:48:13。  —兩個(gè)channel分別備份了兩個(gè)數(shù)據(jù)文件。
channel c1: finished piece 1 at 2017-07-25 16:48:28
piece handle=/home/oracle/rman_full_20170725_0asa8fad tag=TAG20170725T164813 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:15
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
channel c2: finished piece 1 at 2017-07-25 16:48:28
piece handle=/home/oracle/rman_full_20170725_0bsa8fad tag=TAG20170725T164813 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:15
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
including current SPFILE in backup set。
channel c2: starting piece 1 at 2017-07-25 16:48:28
including current control file in backup set。
channel c1: starting piece 1 at 2017-07-25 16:48:29
channel c2: finished piece 1 at 2017-07-25 16:48:29
piece handle=/home/oracle/rman_full_20170725_0dsa8fas tag=TAG20170725T164813 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
channel c1: finished piece 1 at 2017-07-25 16:48:30
piece handle=/home/oracle/rman_full_20170725_0csa8fas tag=TAG20170725T164813 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 2017-07-25 16:48:30。  —每個(gè)backup piece都是同一個(gè)tag


released channel: c1


released channel: c2。   —釋放channel


RMAN> **end-of-file**


[oracle@lzl ~]$ ls -lrth rman_full_*
-rw-r----- 1 oracle oinstall 490M Jul 25 16:48 rman_full_20170725_0bsa8fad
-rw-r----- 1 oracle oinstall 998M Jul 25 16:48 rman_full_20170725_0asa8fad
-rw-r----- 1 oracle oinstall  96K Jul 25 16:48 rman_full_20170725_0dsa8fas
-rw-r----- 1 oracle oinstall 9.4M Jul 25 16:48 rman_full_20170725_0csa8fas
[oracle@lzl ~]$ strings rman_full_20170725_0dsa8fas |more
}|{z
TEST
TAG20170725T164813
TEST
test.__db_cache_size=729808896
test.__java_pool_size=4194304

strings的開頭幾行可以查看目標(biāo)庫(kù)和tag,如果時(shí)spfile可以清楚的看到參數(shù)設(shè)置

感謝各位的閱讀,以上就是“怎么用rman備份數(shù)據(jù)庫(kù)”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)怎么用rman備份數(shù)據(jù)庫(kù)這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI