rman備份設定

tonykorn97發表於2007-09-03

透過oracle enterprise manager備份資料庫

第一種方法,透過本地硬碟備份



1,建立備份資料夾
[root@tonykorn97 oracle]# mkdir backup
[root@tonykorn97 oracle]# chmod 755 backup
[root@tonykorn97 oracle]# chown -R oracle:dba backup
[root@tonykorn97 oracle]# ls -al
total 40
drwxr-xr-x 6 oracle oinstall 4096 Sep 2 22:34 .
drwxr-xr-x 25 root root 4096 Sep 1 14:43 ..
drwxr-xr-x 3 oracle oinstall 4096 Sep 1 14:22 app
drwxr-xr-x 2 oracle dba 4096 Sep 2 22:34 backup
drwx------ 2 oracle oinstall 16384 Sep 1 14:20 lost+found
drwxr-xr-x 3 oracle oinstall 4096 Sep 1 15:54 oradata
[root@tonykorn97 oracle]# pwd
/oracle
[root@tonykorn97 oracle]#

2,登入企業管理器
選擇:
維護--備份設定--並行度出填入想要的並行度--在磁碟備份位置填入剛才建立的資料夾的位置--磁碟備份型別選擇"壓縮備份集"--在主機身份證明處填寫使用者名稱和口令,並點選另存為首選身份證明--點選測試備份設定測試是否可以。

3,按照上面設定,會彈出“磁碟備份測試成功!”

4,點選確定儲存設定。

第二種方法,透過安裝networker客戶端備份到遠端備份伺服器上。
1,在備份伺服器上增加一個客戶端
在 /etc/hosts檔案中增加一條記錄,新增加的客戶端ip和主機名。
增加 networker一個客戶端

同理,在客戶端上也增加一條伺服器的ip和主機名。

2,客戶端安裝networker 軟體
[root@tonykorn97 ~]# rpm -ivh lgtoclnt-7.3.1-1.i686.rpm
Preparing... ########################################### [100%]
1:lgtoclnt ########################################### [100%]
[root@tonykorn97 ~]# rpm -ivh lgtonmo-4.1-1.i686.rpm
Preparing... ########################################### [100%]
1:lgtonmo ########################################### [100%]
[root@tonykorn97 ~]#

3,link the networker module for oracle library file
1> login as teh ORACLE_HOME owner:
[root@tonykorn97 ~]# su - oracle
2> shutdown all oracle instances that use this ORACLE_HOME
[oracle@tonykorn97 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 3 00:18:57 2007

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

3>連結檔案
[oracle@tonykorn97 ~]$ cd $ORACLE_HOME/lib
[oracle@tonykorn97 lib]$ ln -s /usr/lib/libnwora.so libobk.so
[oracle@tonykorn97 lib]$ ls -al libobk.so
lrwxrwxrwx 1 oracle oinstall 20 Sep 3 00:28 libobk.so -> /usr/lib/libnwora.so
[oracle@tonykorn97 lib]$


4>,enable the software
/etc/init.d/networker start
啟動資料庫


4,Using the OEM Backup Management Tools
維護---備份/恢復設定---備份設定
裝置
磁帶設定
選擇壓縮備份集
介質管理設定
介質管理供應商庫引數:
STB_LIBRARY=/oracle/app/oracle/product/10.2.0/Database/lib/libobk.so,ENV=(NSR_SERVER=cwwb,NSR_DATA_VOLUME_POOL=Oracle Backup)
主機身份證明
oracle
oracle密碼
測試磁帶備份


5,測試報錯:
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Sep 3 00:32:51 2007

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

RMAN>
connected to target database: SZRRLCW (DBID=3346998235)
using target database control file instead of recovery catalog

RMAN>
echo set on


RMAN> run {
2> allocate channel oem_sbt_backup type 'sbt_tape' format '%U' parms 'STB_LIBRARY=/oracle/app/oracle/product/10.2.0/Database/lib/libobk.so,ENV=(NSR_SERVER=cwwb,NSR_DATA_VOLUME_POOL=Oracle Backup)';
3> backup as COMPRESSED BACKUPSET current controlfile tag '09032007123248';
4> restore controlfile validate from tag '09032007123248';
5> release channel oem_sbt_backup;
6> }
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on oem_sbt_backup channel at 09/03/2007 00:33:02
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27209: syntax error in device PARMS - unknown keyword or missing =


RMAN> allocate channel for maintenance type 'sbt_tape' parms 'STB_LIBRARY=/oracle/app/oracle/product/10.2.0/Database/lib/libobk.so,ENV=(NSR_SERVER=cwwb,NSR_DATA_VOLUME_POOL=Oracle Backup)';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on ORA_MAINT_SBT_TAPE_1 channel at 09/03/2007 00:33:02
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27209: syntax error in device PARMS - unknown keyword or missing =


RMAN> delete noprompt backuppiece tag '09032007123248';
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=133 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=132 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=131 devtype=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: sid=130 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 09/03/2007 00:33:08
RMAN-06168: no backup pieces with this tag found: 09032007123248


RMAN> exit;

Recovery Manager complete.


6,應該是介質管理供應商庫引數設定有誤,重新設定為如下:
ENV=(NSR_SERVER=cwwb,NSR_DATA_VOLUME_POOL=Oracle Backup)

報如下錯誤:
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Sep 3 02:49:43 2007

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

RMAN>
connected to target database: SZRRLCW (DBID=3346998235)
using target database control file instead of recovery catalog

RMAN>
echo set on


RMAN> run {
2> allocate channel oem_sbt_backup type 'sbt_tape' format '%U' parms 'ENV=(NSR_SERVER=cwwb,NSR_DATA_VOLUME_POOL=Oracle Backup)';
3> backup as BACKUPSET current controlfile tag '09032007024936';
4> restore controlfile validate from tag '09032007024936';
5> release channel oem_sbt_backup;
6> }
allocated channel: oem_sbt_backup
channel oem_sbt_backup: sid=131 devtype=SBT_TAPE
channel oem_sbt_backup: NMO v4.1.0.0

Starting backup at 03-SEP-07
channel oem_sbt_backup: starting full datafile backupset
channel oem_sbt_backup: specifying datafile(s) in backupset
including current control file in backupset
channel oem_sbt_backup: starting piece 1 at 03-SEP-07
channel oem_sbt_backup: finished piece 1 at 03-SEP-07
piece handle=0hiqvq6g_1_1 tag=09032007024936 comment=API Version 2.0,MMS Version 4.1.0.0
channel oem_sbt_backup: backup set complete, elapsed time: 00:00:04
Finished backup at 03-SEP-07

Starting restore at 03-SEP-07

channel oem_sbt_backup: starting validation of datafile backupset
channel oem_sbt_backup: reading from backup piece 0hiqvq6g_1_1
channel oem_sbt_backup: restored backup piece 1
piece handle=0hiqvq6g_1_1 tag=09032007024936
channel oem_sbt_backup: validation complete, elapsed time: 00:00:55
Finished restore at 03-SEP-07

released channel: oem_sbt_backup


RMAN> allocate channel for maintenance type 'sbt_tape' parms 'ENV=(NSR_SERVER=cwwb,NSR_DATA_VOLUME_POOL=Oracle Backup)';
allocated channel: ORA_MAINT_SBT_TAPE_1
channel ORA_MAINT_SBT_TAPE_1: sid=131 devtype=SBT_TAPE
channel ORA_MAINT_SBT_TAPE_1: NMO v4.1.0.0


RMAN> delete noprompt backuppiece tag '09032007024936';

List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
6 6 1 1 AVAILABLE SBT_TAPE 0hiqvq6g_1_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of delete command on ORA_MAINT_SBT_TAPE_1 channel at 09/03/2007 02:51:04
ORA-19509: failed to delete sequential file, handle="0hiqvq6g_1_1", parms=""
ORA-27027: sbtremove2 returned error
ORA-19511: Error received from media manager layer, error text:
nwora_remove: nwora_nsrmm_remove: nsrmm process failed with error - nsrmm: RAP
error: Permission denied, user 'oracle' on 'tonykorn97' does not have 'Operate NetWor
ker' privilege to perform this operation.

RMAN> exit;

Recovery Manager complete.


7,這個應該是networker中沒有許可權造成的。
在networker伺服器端增加一個管理員許可權為客戶端的oracle名字。重新測試ok

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-245752/,如需轉載,請註明出處,否則將追究法律責任。

相關文章