3
环境准备
数据库恢复的前环境准备工作包括:
3.1测试机安装主机操作系统:
测试机为IBM小机,安装aix 6.1版本操作系统,创建vg,lv等。
特别注意需要按照生产库创建同样的redo lv:
mklv -y 'lv_vg01_1_rd11' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg02_1_rd12' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg03_1_rd21' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg04_1_rd22' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg05_1_rd31' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg01_1_rd32' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg02_1_rd41' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg03_1_rd42' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg04_1_rd51' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg05_1_rd52' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg01_1_rd61' -t 'raw' -S '256k'
-u 4 ltedb02_vg1 4
mklv -y 'lv_vg02_1_rd62' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg03_1_rd71' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg04_1_rd72' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg05_1_rd81' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
mklv -y 'lv_vg01_1_rd82' -t 'raw' -S '256k'
-u 4
ltedb02_vg1 4
3.2虚拟带库到测试主机的mapping配置
3.2.1 在交换机上把主机和VLS12200的port划在同一个zone内;
3.2.2 登录vls12200 command view管理界面, IP:192.168.0.100 用户名:administrator 密码:admin;
3.2.3 lun mapping;
3.2.4 device view;
3.2.5 choice a library 选择相应的虚拟带库;
3.2.6 把带库的所有tape
driver和机械臂选中;
3.2.7 choice host选择主机的wwn号;
3.2.8 点击map按钮.
最终结果检查:
# lsdev -C |grep rmt
rmt0 Available 04-00-01 Other FC SCSI Tape Drive
rmt1 Available 04-00-01 Other FC SCSI Tape Drive
rmt2 Available 04-00-01 Other FC SCSI Tape Drive
rmt3 Available 04-00-01 Other FC SCSI Tape Drive
rmt4 Available 05-00-01 Other FC SCSI Tape Drive
rmt5
Available 05-00-01 Other FC SCSI Tape Drive
rmt6 Available 05-00-01 Other FC SCSI Tape Drive
rmt7 Available 05-00-01 Other FC SCSI Tape Drive
3.3 测试机NBU Media Server安装
在ltedb2上部署Media Server7.1软件
nbuserver2:/soft/NetBackup_7.1_LinuxS_x86_64 # ./install
Symantec Installation Script
Copyright 1993 -
2011 Symantec Corporation, All Rights Reserved.
Installing NetBackup Server Software
Do you wish to
continue? [y,n] (y)
The NetBackup and
Media Manager software is built for use on LINUX_SUSE_X86 hardware.
Do you want to
install NetBackup and Media Manager files? [y,n] (y)
NetBackup and Media
Manager are normally installed in /usr/openv.
Is it OK to install
in /usr/openv? [y,n] (y)
Reading NetBackup
files from /soft/NetBackup_7.1_LinuxS_x86_64/linuxS_x86/anb
usr/openv/db/
usr/openv/db/scripts/
usr/openv/db/scripts/bmr.sql
usr/openv/db/scripts/BMRDB.6.0.0.0.sql
usr/openv/db/scripts/BMRDB.downgrade.6.0.2.0.sql
usr/openv/db/scripts/BMRDB.6.0.2.0.sql
usr/openv/db/scripts/BMRDB.downgrade.6.0.3.0.sql
………………………………………………………
………………………………………………………
+ Extracting PDDE
server package (/usr/openv/pddeserver.tar.gz)...
+ Extracting PDDE
agent package (/usr/openv/netbackup/client/Linux/SuSE2.6.16/pddeagent.tar.gz)...
Unpacking SYMCpddea
package.
Checking for
pre-existing SYMCpddea package.
Installing
SYMCpddea package.
Creating
/etc/pdregistry.cfg.
Copying
pdregistry.cfg file to /usr/openv/pdde/pdconfigure/cfg/userconfigs/pdregistry.cfg.
Starting setup for
PDDE script
Done setup for PDDE
script
Checking to see if
the PDDE configuration needs upgrading
pdregistry.cfg
exists.
No existing PDDE
configuration detected.
PDDE install
finished successfully.
Running insserv
command to enable /etc/init.d/netbackup init script.
Installation of
Java LiveUpdate agent succeeded. Refer
to file
/tmp/JLU-Log/JavaLiveUpdate-Install.log
on nbuserver2
for installation
details.
Checking LiveUpdate
registration for the following products: NB
This may take a few
minutes.
Product NB is
installed and will be registered.
Updating LiveUpdate
registration now...this may take some time.
A NetBackup Server
or Enterprise Server license key is needed
for installation to
continue.
Enter license key:
xxxx-xxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-X
xxxx-xxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-X
NetBackup Enterprise Server Base
product with the following features enabled:
Enterprise Vault Agent
Open File Backup
Remote Client Support
Robotic Library Sharing Support
Remote Media Server Support
Microsoft RSM Robotic Libraries
ADIC DAS/SDLC Robotic Libraries
IBM ATL Robotic Libraries
Fujitsu LMF Robotic Libraries
StorageTek ACS Robotic Libraries
Inline Tape Copy
DataStore
has been registered.
All additional keys
should be added at this time.
Do you want to add
additional license keys now? [y,n] (y)
License Key Utility
-------------------
A) Add a License Key
D) Delete a License Key
F) List Active License Keys
L) List Registered License Keys
H) Help
q) Quit License Key Utility
Enter a letter: a
Enter license key:
xxxx-xxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-X
NetBackup
Enterprise Server is the active NetBackup.
xxxx-xxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-X:
NetBackup features enabled:
Library Based Tape Drives
has been registered.
License Key Utility
-------------------
A) Add a License Key
D) Delete a License Key
F) List Active License Keys
L) List Registered License Keys
H) Help
q) Quit License Key Utility
Enter a letter: a
Enter license key:
xxxx-xxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-X
NetBackup
Enterprise Server is the active NetBackup.
KRXF-8Y8D-TBIC-ZP6P-PPPP-PPC6-RNPP-8CP3-PNCP-C:
NetBackup features enabled:
Enterprise Vault Agent
Bare Metal Restore
Encryption
Open File Backup
Encryption (Legacy DES 56-bit)
Encryption (Legacy DES 40-bit)
Additional clients
has been registered.
License Key Utility
-------------------
A) Add a License Key
D) Delete a License Key
F) List Active License Keys
L) List Registered License Keys
H) Help
q) Quit License Key Utility
Enter a letter: q
Installing
NetBackup Enterprise Server version: 7.1
If this machine
will be using a different network interface than the
default
(nbuserver2), the name of the preferred interface should be used
as the configured
server name. If this machine will be
part of a cluster, the virtual name should be used as the configured server name.
Would you like to
use "nbuserver2" as the configured
NetBackup server
name of this machine? [y,n] (y)
Is nbuserver2 the
master server? [y,n] (y) n
What is the fully
qualified name of the master server? nbuserver1
Checking network
connections.
bp.conf:
IP_ADDRESS_FAMILY = AF_INET: default value, no update needed
Sending SIGHUP to
xinetd process.
Reload INET
services (xinetd)...failed
Enter the
Enterprise Media Manager server (default: nbuserver1):
Converting STREAMS
files. This may take a few minutes.
STREAMS files
conversion is complete.
Successfully
updated the session cache parameters.
Starting the
NetBackup network daemon.
Starting the
NetBackup client daemon.
Starting the
NetBackup SAN Client Fibre Transport daemon.
Creating
/usr/openv/tmp/sqlany
Installed SQL
Anywhere Version 11.0.1.2475
Installation
completed successfully
Starting the
NetBackup Event Manager.
Starting the
NetBackup Deduplication Manager.
Starting the
NetBackup Deduplication Engine.
Starting the
NetBackup compatibility daemon.
Starting the Media
Manager device daemon processes.
Starting the
NetBackup Remote Monitoring Management System.
Starting the
NetBackup Key Management daemon.
Starting the
NetBackup Service Layer.
Starting the
NetBackup Service Monitor.
Starting the
NetBackup Bare Metal Restore Boot Server daemon.
NetBackup server
installation complete.
File
/usr/openv/tmp/install_trace.9504 contains a trace of this install.
That file can be
deleted after you are sure the install was successful.
3.4 测试机NBU Media Server到生产Master
Server之间的相互连通
172.16.9.5 ltedb2
#192.168.101.254 ltedb2
#192.168.102.254 ltedb2
10.10.30.15 sfmbak
10.10.50.37 essdb2
172.16.9.5
ltedb2
ltedb2$[/usr/openv/netbackup/bin]bpclntcmd -pn
expecting response from server sfmbak
ltedb2 ltedb2 172.16.9.5 35616
3.5 测试机NBU Media Server配置(当时操作没有记录,以之前安装的过程提供参考)
打开NBU GUI界面,选择配置Configure Storage Devices配置向导。
选择nbuserver1服务器
在nbuserver1,扫描到两个磁带机和机械手,和磁带库分配设备一致。
确定识别出设备型号
选择两个磁带机作为配置
配置STU,重启LTID进程。
确定配置生成存储单元(STU)
点击finish确定配置完成退出
3.6 测试机oracle数据库软件安装和参数配置
3.6.1 安装10gr2
oracle数据库软件10201版本,不建库,然后升级到10205版本;
同时做如下配置:
3.6.2 orapwd
file=/oracle/product/10.2/db_1/dbs/orapwessdb password=oracle
3.6.3 配置监听:
libnk510.imp libnrad10.exp libnrad10.imp
listener.ora samples shrept.lst tnsnames.ora
ltedb2$[/oracle/product/10.2/db_1/network/admin]cat listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ltedb2)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.9.5)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/product/10.2/db_1)
(PROGRAM = extproc)
)
)
ltedb2$[/oracle/product/10.2/db_1/network/admin]
3.6.4 配置tnsname:
ltedb2$[/oracle/product/10.2/db_1/network/admin]cat tnsnames.ora
ESSDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ltedb2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = essdb)
(INSTANCE_NAME = essdb1)
)
)
LISTENERS_ESSDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ltedb2)(PORT = 1521))
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
3.6.5 创建目录:
mkdir -p
/oracle/admin/essdb/adump
mkdir -p
/oracle/admin/essdb/bdump
mkdir -p
/oracle/admin/essdb/cdump
mkdir -p
/oracle/admin/essdb/dpdump
mkdir -p
/oracle/admin/essdb/udump
mkdir -p
/oracle/oradata/essdb
mkdir -p
/oracle/flash_recovery_area
chown -R oracle:oinstall
/oracle/admin/essdb
/oracle/oradata/essdb /oracle/flash_recovery_area
3.6.6 修改归档目录:
修改参考测试机的归档目录情况。
# umount /arch2
# mkdir arch
# mount /dev/lv_arch_01 /arch
注意:
这个地方nbu工程师搞错了,刚好搞相反啊!晕死!
3.6.7 设置ORACLE_SID环境变量
在.profile文件中增加了如下一行:
export ORACLE_SID=essdb1
3.6.8 编辑初始化参数文件并将实例启动到nomout状态下
从生产库取得初始化参数文件,并进行了编辑作为恢复数据库时所使用的参数文件:
#### 去掉这些参数
essdb1.__db_cache_size=136415543296
essdb2.__db_cache_size=136616869888
essdb1.__java_pool_size=16777216
essdb2.__java_pool_size=16777216
essdb1.__large_pool_size=16777216
essdb2.__large_pool_size=16777216
essdb1.__shared_pool_size=10905190400
essdb2.__shared_pool_size=10737418240
essdb1.__streams_pool_size=33554432
essdb2.__streams_pool_size=0
*._gc_affinity_limit=250
*._gc_affinity_minimum=10485760
*._smu_debug_mode=33554432
essdb1.log_archive_dest_2='service=essdb2'
essdb2.log_archive_dest_2='service=essdb1'
essdb2.log_archive_dest_1='location=/arch2'
*.shared_pool_reserved_size=4G
#### 缩小SGA,加快数据库实例的启停
*.sga_max_size=12G
*.sga_target=0
*.shared_pool_size=4G
*.db_cache_size=4G
*.streams_pool_size=512M
*.java_pool_size=512M
*.large_pool_size=512M
#### 其它修改的参数
essdb1.log_archive_dest_1='location=/arch'
*.cluster_database=false
#### 不变的参数
*.aq_tm_processes=9
*.audit_file_dest='/oracle/admin/essdb/adump'
*.background_dump_dest='/oracle/admin/essdb/bdump'
*.core_dump_dest='/oracle/admin/essdb/cdump'
*.user_dump_dest='/oracle/admin/essdb/udump'
*.cluster_database_instances=2
*.compatible='10.2.0.5.0'
*.control_files='/dev/rlv_vg01_ctl01','/dev/rlv_vg02_ctl02'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_files=1000
*.db_name='essdb'
*.dispatchers='(PROTOCOL=TCP)
(SERVICE=essdbXDB)'
*.event='10943 trace name context level
2097152'
essdb2.instance_number=2
essdb1.instance_number=1
*.job_queue_processes=60
*.log_archive_dest_2=''
*.log_archive_dest_state_2='DEFER'
*.log_buffer=50389248
*.open_cursors=4096
*.open_links=150
*.open_links_per_instance=150
*.parallel_max_servers=48
*.pga_aggregate_target=29493297152
*.processes=6000
*.remote_listener=''
*.remote_login_passwordfile='exclusive'
*.resource_limit=TRUE
*.session_max_open_files=400
*.sessions=6605
essdb2.thread=2
essdb1.thread=1
*.undo_management='AUTO'
essdb1.undo_tablespace='UNDOTBS1'
essdb2.undo_tablespace='UNDOTBS2'
初始化参数文件编辑完成后,将数据库启动到nomount状态下。
startup nomount;
3.6.8 检查全部数据文件的LV在测试环境中已经创建
生产库一共有397个数据文件,经检查这些文件对应的LV在测试环境中都已经创建,并且名称与生产库上的完全一致。
3.7 测试机NBU Media Server到Oracle的库连接
ltedb2$[/usr/openv/netbackup/bin]pwd
/usr/openv/netbackup/bin/oracle_link
3.8 配置bpconfig文件:
"bp.conf"
11 lines, 261 characters
# cat bp.conf
SERVER = sfmbak
SERVER = ltedb2
CLIENT_NAME = ltedb2
CLIENT_NAME=essdb2
MEDIA_SERVER = essdb2
MEDIA_SERVER = ltedb2
CONNECT_OPTIONS = localhost 1 0 2
USE_VXSS = PROHIBITED
VXSS_SERVICE_TYPE =
INTEGRITYANDCONFIDENTIALITY
EMMSERVER = sfmbak
HOST_CACHE_TTL = 3600
#
# ls
-l |grep kill
-r-x------ 1 root
bin 22310 Feb 04
2011 bp.kill_all
-r-xr-xr-x 1 root
bin 48763 Feb 04
2011 bpclusterkill
# ./bp.kill_all
重启服务如上。
4
恢复过程
4.1 以Oralce用户登录到恢复主机
指定需要恢复的实例名,确认ORACLE_HOME及ORACLE_SID与实际的安装环境一致。
export ORACLE_SID=essdb1
ltedb2$[/oracle]env
| grep ORACLE_HOME
ORACLE_HOME=/oracle/product/10.2/db_1
ltedb2$[/oracle] env | grep ORACLE_SID
ORACLE_SID=essdb1
4.2 查找最新的control file的备份
4.3 恢复控制文件
4.4 切换数据库到mount状态,检查归档目录
Total
System Global Area 1.2885E+10 bytes
Fixed Size 2118360 bytes
Variable Size 8522829096 bytes
Database Buffers 4294967296 bytes
Redo Buffers 64987136 bytes
SQL>
alter database mount;
Database altered.
关键要检查归档目录参数,把5日的归档scp到库内参数设定的归档目录下面:
log_archive_dest_1 string location=/arch
4.5 恢复数据文件
写shell服务器端跑:
开始数据文件的restore:
苦苦等待历时1左右个小时!!!restore终于完成。
4.6 RECOVER数据库
如上图所示全库恢复开始。
苦苦等待报错如下:
然后继续进行当日(12月5日)的归档scp从生产库:
再重新基于auto逐一恢复归档日志:
重新执行until恢复:
run
{
ALLOCATE CHANNEL CH00 TYPE 'SBT_TAPE';
SEND
'NB_ORA_CLIENT=essdb2,NB_ORA_SERV=sfmbak';
RECOVER DATABASE until time "to_date(
'2013-12-06 00:00', 'YYYY-MM-DD HH24:MI' )";;
RELEASE CHANNEL CH00;
}
4.7 打开数据库
首次打开库时报tracing相关的错误(recover和open库过程坎坷,报错较多处理过程反复冗繁,部分错误没能处理直接进行了第二次重新恢复,限于篇幅我这里处理过程不一一说明),设定参数:
ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
重新open库:
alter database
open resetlogs;
4.8 确认数据库状态
ltedb2$[/oracle]hostname
ltedb2
ltedb2$[/oracle]echo $ORACLE_SID
essdb1
ltedb2$[/oracle]sqlplus '/ as sysdba'
SQL*Plus: Release 10.2.0.5.0 - Production
on Mon Dec 9 09:37:03 2013
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition
Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining
and Real Application Testing options
SQL>
select status from v$instance;
STATUS
------------
OPEN
SQL>
SQL> show parameter name
NAME TYPE VALUE
------------------------------------
----------- ------------------------------
db_file_name_convert string
db_name string essdb
db_unique_name string essdb
global_names boolean FALSE
instance_name string essdb1
lock_name_space string
log_file_name_convert string
service_names string essdb
SQL>
5 恢复总结和结果
此次恢复因为没有测试环境,所以重新借用资源,然后重新安装主机,划存储,创建lv,主机到虚拟带库存储的mapping,安装nbu media server,get liencese,nbu相关配置,安装数据库软件并升级,参数调整,到restore,再到recover,以及recover中的各种异常错误处理等等,所以此次恢复演练有牵扯环节多,沟通面广,工作量较大等特点。
此次恢复邀请业务室同事对恢复成功的测试库进行数据核对,现应用业务室核对结果如下:
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13750068/viewspace-1062797/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13750068/viewspace-1062797/