① nbu 6.5 如何备份oracle
应该有个agent会需要装到跑有oracle的服务器上,启动该服务器上的agent,nbu就会与agent建立通讯,然后就是设定策略、排程之类的。
读一读随软件附带的manual吧。。
② nbu怎样恢复oracle数据库
1、安装操作系统
2、安装数据库系统
3、安装nbu软件及配置
--安装客户端
上传SYMCnbclient_Linux-RedHat2.6.18_7.5.0.2.tar编辑本机hosts
vi /etc/hosts
添加:192.168.99.252 hdnbu1
解压:
[root@scmtest u01]# tar -xvf SYMCnbclient_Linux-RedHat2.6.18_7.5.0.2.tar[root@scmtest u01]# cd SYMCnbclient_Linux-RedHat2.6.18_7.5.0.2[root@scmtest SYMCnbclient_Linux-RedHat2.6.18_7.5.0.2]# ./install过程当中要输入备份服务端:hdnbu1
然后再用oracle用户执行:
[root@scmtest bin]# su - oracle
[oracle@scmtest ~]$ cd /usr/openv/netbackup/bin[oracle@scmtest bin]$ ./oracle_link
Thu Feb 21 14:03:02 CST 2013
All Oracle instances should be shutdown before running this script.
Please log into the Unix system as the Oracle owner for running this scriptDo you want to continue? (y/n) [n] y
LIBOBK path: /usr/openv/netbackup/bin
ORACLE_HOME: /software/oracle/proct/10.2.0/db1Oracle version: 10.2.0.5.0
Platform type: x86_64
Linking LIBOBK:
ln -s /usr/openv/netbackup/bin/libobk.so64 /software/oracle/proct/10.2.0/db1/lib/libobk.soDone
Please check the trace file located in /tmp/make_trace.23602to make sure the linking process was successful.
4、编辑初始参数文件
这时候,需要进行修改,比如原来用的什么盘,现在用什么盘等编辑后如下:
*._addm_auto_enable=FALSE
*._b_tree_bitmap_plans=FALSE
*._db_block_numa=1
*._enable_NUMA_optimization=FALSE
*._optimizer_cartesian_enabled=FALSE
*._optimizer_skip_scan_enabled=FALSE
*.archive_lag_target=1800
*.audit_file_dest='/software/oracle/admin/ncerp/amp'
*.background_mp_dest='/software/oracle/admin/ncerp/bmp'
*.compatible='10.2.0.5.0'
*.control_files='/u01/ncerp/control/control01.ctl','/u01/ncerp/control/control02.ctl'
*.core_mp_dest='/software/oracle/admin/ncerp/cmp'
*.db_block_size=8192
*.db_cache_size=4294967296
*.db_create_file_dest='/u01/ncerp/flash_recover'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='ncerp'
*.java_pool_size=33554432
*.job_queue_processes=10
*.large_pool_size=33554432
*.log_archive_dest_1='location=/u01/ncerp/arch'
*.log_archive_format='%s_%t_%r.log'
*.max_mp_file_size='1024'
*.open_cursors=1000
*.optimizer_dynamic_sampling=4
*.optimizer_index_cost_adj=40
*.parallel_max_servers=5
*.pga_aggregate_target=2147483648
*.processes=800
*.recyclebin='OFF'
*.shared_pool_size=838860800
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
5、根据参数文件,建相应的目录
[oracle@scmtest ~]$ mkdir -p /u01/ncerp/control/[oracle@scmtest u01]$ mkdir -p /app/oracle/admin/ncerp/cmp[oracle@scmtest u01]$ mkdir -p /app/oracle/admin/ncerp/bmp[oracle@scmtest u01]$ mkdir -p /app/oracle/admin/ncerp/amp[oracle@scmtest u01]$ mkdir -p /app/oracle/admin/ncerp/pfile[oracle@scmtest u01]$ mkdir -p /u01/ncerp/flash_recover[oracle@scmtest u01]$ mkdir -p /u01/ncerp/arch[oracle@scmtest ncerp]$ mkdir oradata
注意:这些要与参数文件对应,要不然无法启动!
6、恢复控制文件
export ORACLE_SID=ncerp
[oracle@scmtest u01]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Proction on Thu Feb 21 14:17:10 2013Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)RMAN> startup nomount pfile='/u01/ncpfile.ora';Oracle instance started
Total System Global Area 5217714176 bytesFixed Size 2103536 bytesVariable Size 905971472 bytesDatabase Buffers 4294967296 bytesRedo Buffers 14671872 bytes从nbu的服务器上查询要恢复的控制文件
hdnbu1:/tmp # bplist -C RD162 -t 4 -R -b -l / | more-rw-rw---- oracle dba 10747904 Mar 28 11:26 /c-3383507379-20130328-0b-rw-rw---- oracle dba 11010048 Mar 28 11:25 /c-2177845250-20130328-0d-rw-rw---- oracle dba 10747904 Mar 28 11:25 /cntrl_9202_1_811250475-rw-rw---- oracle dba 10747904 Mar 28 11:25 /cntrl_7788_1_811250456-rw-rw---- oracle dba 10747904 Mar 28 11:25 /c-3383507379-20130328-0a-rw-rw---- oracle dba 11010048 Mar 28 11:24 /c-2177845250-20130328-0c-rw-rw---- oracle dba 114032640 Mar 28 11:17 /al_7786_1_811249961-rw-rw---- oracle dba 123207680 Mar 28 11:17 /al_7785_1_811249961-rw-rw---- oracle dba 3670016 Mar 28 11:17 /al_9200_1_811249960-rw-rw---- oracle dba 3932160 Mar 28 11:17 /al_9199_1_811249959-rw-rw---- oracle dba 11010048 Mar 28 09:25 /c-2177845250-20130328-0b-rw-rw---- oracle dba 10747904 Mar 28 09:25 /c-3383507379-20130328-09-rw-rw---- oracle dba 10747904 Mar 28 09:25 /cntrl_9197_1_811243259-rw-rw---- oracle dba 10747904 Mar 28 09:25 /cntrl_7783_1_811243253RMAN> run
2> {
3> allocate channel c1 type 'sbt_tape';
4> send 'NB_ORA_CLIENT=RD162';
5> restore controlfile from '/cntrl_24145_1_828414748';6> release channel c1;
7> }
using target database control file instead of recovery catalogallocated channel: c1
channel c1: sid=874 devtype=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 7.5 (2012050902)sent command to channel: c1
Starting restore at 2013-03-28 12:41:30
channel c1: restoring control file
channel c1: restore complete, elapsed time: 00:05:16output filename=/u02/ncerp/control/control01.ctloutput filename=/u02/ncerp/control/control02.ctlFinished restore at 2013-03-28 12:46:47
released channel: c1
7、还原数据库文件
在这里要查一下数据库是否已经mount
SQL> select status from v$instance;
STATUS
------------
MOUNTED
RMAN> run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
send 'NB_ORA_CLIENT=RD162';
set newname for datafile '/backup/ncerp/oradata/system01.dbf' to '/u02/ncerp/oradata/system01.dbf' ;set newname for datafile '/backup/ncerp/oradata/system02.dbf' to '/u02/ncerp/oradata/system02.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_index03_1.dbf' to '/u02/ncerp/oradata/nnc_index03_1.dbf';set newname for datafile '/backup/ncerp/oradata/undotbs1.dbf' to '/u02/ncerp/oradata/undotbs1.dbf' ;set newname for datafile '/backup/ncerp/oradata/sysaux01.dbf' to '/u02/ncerp/oradata/sysaux01.dbf' ;set newname for datafile '/backup/ncerp/oradata/users01.dbf' to '/u02/ncerp/oradata/users01.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data01_1.dbf' to '/u02/ncerp/oradata/nnc_data01_1.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data01_2.dbf' to '/u02/ncerp/oradata/nnc_data01_2.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data01_3.dbf' to '/u02/ncerp/oradata/nnc_data01_3.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data01_4.dbf' to '/u02/ncerp/oradata/nnc_data01_4.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data02_1.dbf' to '/u02/ncerp/oradata/nnc_data02_1.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data02_2.dbf' to '/u02/ncerp/oradata/nnc_data02_2.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_1.dbf' to '/u02/ncerp/oradata/nnc_data03_1.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_2.dbf' to '/u02/ncerp/oradata/nnc_data03_2.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_3.dbf' to '/u02/ncerp/oradata/nnc_data03_3.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_4.dbf' to '/u02/ncerp/oradata/nnc_data03_4.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_index02_1.dbf' to '/u02/ncerp/oradata/nnc_index02_1.dbf';set newname for datafile '/backup/ncerp/oradata/nnc_index01_1.dbf' to '/u02/ncerp/oradata/nnc_index01_1.dbf';set newname for datafile '/backup/ncerp/oradata/nnc_index01_2.dbf' to '/u02/ncerp/oradata/nnc_index01_2.dbf';set newname for datafile '/backup/ncerp/oradata/nnc_index01_3.dbf' to '/u02/ncerp/oradata/nnc_index01_3.dbf';set newname for datafile '/backup/ncerp/oradata/nnc_index01_4.dbf' to '/u02/ncerp/oradata/nnc_index01_4.dbf';set newname for datafile '/backup/ncerp/oradata/iufo01.dbf' to '/u02/ncerp/oradata/iufo01.dbf' ;set newname for datafile '/backup/ncerp/oradata/iufo02.dbf' to '/u02/ncerp/oradata/iufo02.dbf' ;set newname for datafile '/backup/ncerp/oradata/nnc_data03_5.dbf' to '/u02/ncerp/oradata/nnc_data03_5.dbf' ;Restore database;
Switch datafile all;
}
vi res_test.sh 内容如下:
export ORACLE_SID=ncerp
rman target / < run {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
send 'NB_ORA_CLIENT=RD162';
做一次恢复测试看看
说明需要3556这个归档日志
所以恢复时,从这个日志进行恢复!
也可以采用后台运行方式
9、数据库恢复
SQL>
cancel
说明,如果上面日志可能有点大的时候,我们需要调整,比如说删除日志组等,然后还重新添加日志到新位置10、打开数据库
SQL> alter database open resetlogs;
Database altered.
11、创建临时表空间
③ 如何使用NBU热备份Oracle系统
按照备份的工具,可以分为EXP/IMP备份和RMAN。一般来说,Exp/Imp是oracle的一个好的转储工具,特别是在小型数据库的转储,表空间的迁移,表的抽取,检测逻辑和物理冲突等中有很强的功能。但是目前主要最广泛的Oracle备份恢复工具是rman 。RMAN是Oracle提供的一个数据库备份和恢复工具,利用rman可以方便进行数据库的冷备份和热备份。此外,有一些个人用户,会使用OS拷贝,但是它的缺点是占用空间大,而且拷贝文件的内容一般与系统环境有很大关系,转移到其他机器不容易恢复,不是企业用户的选择。
注意,笔者假设用于已经阅读过前作《用NBU备份oracle系统-冷备份》,故在讲述中会忽略一些基本的配置过程,重点在于将冷备份和热备份的区别。所以如果对细节不是很清楚的用户,可以翻阅前作。