通过nbu恢复oracle数据库(恢复实例)

  1. 关闭开启的实例数据库(未关监听)

shutdown immediate

2、传NBU客户端

通过nbu恢复oracle数据库(恢复实例)_第1张图片

 

3、安装NBU客户端

通过nbu恢复oracle数据库(恢复实例)_第2张图片

通过nbu恢复oracle数据库(恢复实例)_第3张图片

 

/usr/openv/netbackup/bin   ./oracle_link  建立连接

新客户端必须启动这个命令,不然无法进行还原,需要在oracle用户下跑命令

4、查询备份信息

通过nbu恢复oracle数据库(恢复实例)_第4张图片

 

 

 

 

 

 

 

 

 

 

5、设置备份可强制恢复

通过nbu恢复oracle数据库(恢复实例)_第5张图片

 

6、检查Oracle安装软件

通过nbu恢复oracle数据库(恢复实例)_第6张图片

 

7、检查NBU客户端进程

通过nbu恢复oracle数据库(恢复实例)_第7张图片

 

 

 

 

 

 

 

 

 

 

 

8、检查备份集

cd /usr/openv/netbackup/bin

./bplist -C cmccdb1_beifen -t 4 -R -b -l /|more

通过nbu恢复oracle数据库(恢复实例)_第8张图片

 

9、创建参数文件

/u01/app/oracle/database/10R1/dbs   oracle环境变量

touch initbacdb.ora

chmod 777 initbacdb.ora

 

bacdb.__db_cache_size=1711276032

bacdb.__java_pool_size=46976204

bacdb.__large_pool_size=13421772

bacdb.__oracle_base='/opt/oracle/app/oracle'#ORACLE_BASE set from environment

bacdb.__pga_aggregate_target=677799526

bacdb.__sga_target=4019976806     ----服务器内存80%

bacdb.__shared_io_pool_size=0

bacdb.__shared_pool_size=228170137

bacdb.__streams_pool_size=6710886

*.audit_file_dest='/opt/oracle/app/oracle/admin/bacdb/adump'

*.audit_trail='db'

*.compatible='11.2.0.4.0'

*.control_files='/opt/oracle/oradata/bacdb/controlfile/control01.ctl','/opt/oracle/oradata/bacdb/controlfile/control02.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='bacdb'

*.diagnostic_dest='/opt/oracle/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=bacdbXDB)'

bacdb.instance_number=1

*.log_archive_dest_1='location=/opt/oracle/oradata/bacdb/arch'

*.open_cursors=2000

*.pga_aggregate_target=677799526

*.processes=1000

*.remote_login_passwordfile='exclusive'

#*.sessions=4405

*.sga_target=4019976806

bacdb.thread=1

bacdb.undo_tablespace='UNDOTBS1'

 

 

10、创建文件目录

mkdir -p /opt/oracle/app/oracle/admin/bacdb/adump

mkdir -p /opt/oracle/oradata/bacdb/controlfile

mkdir -p /opt/oracle/oradata/bacdb/arch

mkdir -p /opt/oracle/oradata/bacdb/datafile

mkdir -p /opt/oracle/oradata/bacdb/tempfile

mkdir -p /opt/oracle/oradata/bacdb/onlinelog

 

 

 

 

11、根据参数文件启动至nomount

export ORACLE_SID=bacdb

sqlplus / as sysdba

startup nomount pfile='/opt/oracle/app/oracle/product/11.2.0/db_1/dbs/initbacdb.ora';

 

通过nbu恢复oracle数据库(恢复实例)_第9张图片

 

 

 

12、根据参数文件创建spfile文件

create spfile from pfile;

通过nbu恢复oracle数据库(恢复实例)_第10张图片

 

13、重启至nomount状态

startup force nomount;

通过nbu恢复oracle数据库(恢复实例)_第11张图片

 

14、创建sys密码文件

orapwd file=$ORACLE_HOME/dbs/orapwbacdb password=ERab3OC_4s entries=5 force=y

 

通过nbu恢复oracle数据库(恢复实例)_第12张图片

 

 

15、恢复控制文件

export ORACLE_SID=bacdb

rman target /

通过nbu恢复oracle数据库(恢复实例)_第13张图片

 

run{

allocate channel ch0 type 'sbt_tape';

send 'NB_ORA_CLIENT= bac-db-01_beifen';

send 'nb_ora_serv=NFJD-WHGLZY-NBU-1';

restore controlfile from '/cntrl_7110_1_932480583';

release channel ch0;

}

 

通过nbu恢复oracle数据库(恢复实例)_第14张图片

 

 

 

 

 

 

 

 

 

 

16、启动至mount状态

alter database mount;

通过nbu恢复oracle数据库(恢复实例)_第15张图片

 

17、查询需要恢复的表空间

select NAME,TS# from v$tablespace;

通过nbu恢复oracle数据库(恢复实例)_第16张图片

因为我们这里只做部分表空间恢复,只需要恢复SYSTEM,SYSAUX,UNDOTBS1,TEMP,UNDOTBS2,USERS,DATA_SMSGW表空间,所以要分别找出这些表空间都包括那些数据文件:

 

 

18、查询需要恢复的表空间对应的数据文件

select file#,name from v$datafile where TS# in ('0','1','2','3','4','5','6')

通过nbu恢复oracle数据库(恢复实例)_第17张图片

 

19、恢复数据文件

restore数据文件(执行脚本)

$ nohup /opt/oracle/oradata/restore/restore.sh > restore.sh.out 2>&1 &

 

 

rman target / nocatalog <

run {

allocate channel ch00 type 'SBT_TAPE';

allocate channel ch01 type 'SBT_TAPE';

allocate channel ch02 type 'SBT_TAPE';

allocate channel ch03 type 'SBT_TAPE';

send 'NB_ORA_CLIENT=bac-db-01_beifen';

send 'NB_ORA_SERV=NFJD-WHGLZY-NBU-1';

set newname for datafile 1 to '/opt/oracle/oradata/bacdb/datafile/system.262.863641207';

set newname for datafile 2 to '/opt/oracle/oradata/bacdb/datafile/sysaux.261.863641231';

set newname for datafile 3 to '/opt/oracle/oradata/bacdb/datafile/undotbs1.260.863641255';

set newname for datafile 4 to '/opt/oracle/oradata/bacdb/datafile/undotbs2.270.863641297';

set newname for datafile 5 to '/opt/oracle/oradata/bacdb/datafile/users.269.863641331';

set newname for datafile 6 to '/opt/oracle/oradata/bacdb/datafile/data_smsgw.276.863781045';

set newname for datafile 31 to '/opt/oracle/oradata/bacdb/datafile/data_smsgw.301.884961611';

set newname for datafile 55 to '/opt/oracle/oradata/bacdb/datafile/system.329.922185251';

set newname for datafile 60 to '/opt/oracle/oradata/bacdb/datafile/undotbs1.334.925769101';

set newname for datafile 61 to '/opt/oracle/oradata/bacdb/datafile/undotbs2.335.925769185';

set newname for datafile 62 to '/opt/oracle/oradata/bacdb/datafile/system.336.926934061';

restore database skip tablespace TBS_ACS,TBS_UCMQ,TBS_BTS,WH_TS,TBS_MMCC,TBS_IAPMMWLAN,TBS_MMPG,TBS_SIMS20;   

switch datafile all; 

release channel ch00;

release channel ch01;

release channel ch02;

release channel ch03;

}

EOF

 

 

通过nbu恢复oracle数据库(恢复实例)_第18张图片

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

20、修改线日志文件路径

select group#,member from v$logfile order by group#;

通过nbu恢复oracle数据库(恢复实例)_第19张图片

 

alter database rename file '+DATA/bacdb/onlinelog/group_1.256.863641201'  to '/opt/oracle/oradata/bacdb/onlinelog/group_1.256.863641201';

alter database rename file '+DATA/bacdb/onlinelog/group_2.266.863641203'  to '/opt/oracle/oradata/bacdb/onlinelog/group_2.266.863641203';

alter database rename file '+DATA/bacdb/onlinelog/group_3.258.863643321'  to '/opt/oracle/oradata/bacdb/onlinelog/group_3.258.863643321';

alter database rename file '+DATA/bacdb/onlinelog/group_4.257.863643323'  to '/opt/oracle/oradata/bacdb/onlinelog/group_4.257.863643323';

alter database rename file '+DATA/bacdb/onlinelog/group_5.274.863641203'  to '/opt/oracle/oradata/bacdb/onlinelog/group_5.274.863641203';

alter database rename file '+DATA/bacdb/onlinelog/group_6.273.863641205'  to '/opt/oracle/oradata/bacdb/onlinelog/group_6.273.863641205';

alter database rename file '+DATA/bacdb/onlinelog/group_7.272.863641205'  to '/opt/oracle/oradata/bacdb/onlinelog/group_7.272.863641205';

alter database rename file '+DATA/bacdb/onlinelog/group_8.271.863641207'  to '/opt/oracle/oradata/bacdb/onlinelog/group_8.271.863641207';

alter database rename file '+DATA/bacdb/onlinelog/group_9.268.863643325'  to '/opt/oracle/oradata/bacdb/onlinelog/group_9.268.863643325';

alter database rename file '+DATA/bacdb/onlinelog/group_10.267.863643325' to '/opt/oracle/oradata/bacdb/onlinelog/group_10.267.863643325';

alter database rename file '+DATA/bacdb/onlinelog/group_11.265.863643327' to '/opt/oracle/oradata/bacdb/onlinelog/group_11.265.863643327';

alter database rename file '+DATA/bacdb/onlinelog/group_12.264.863643327' to '/opt/oracle/oradata/bacdb/onlinelog/group_12.264.863643327';

 

通过nbu恢复oracle数据库(恢复实例)_第20张图片

 

 

21、recover数据库

 

run {

allocate channel ch00 type 'SBT_TAPE';

allocate channel ch01 type 'SBT_TAPE';

allocate channel ch02 type 'SBT_TAPE';

allocate channel ch03 type 'SBT_TAPE';

send 'NB_ORA_CLIENT=bac-db-01_beifen';

send 'NB_ORA_SERV=NFJD-WHGLZY-NBU-1';

recover database skip forever tablespace TBS_ACS,TBS_UCMQ,TBS_BTS,WH_TS,TBS_MMCC,TBS_IAPMMWLAN,TBS_MMPG,TBS_SIMS20;

release channel ch00;

release channel ch01;

release channel ch02;

release channel ch03;

}

通过nbu恢复oracle数据库(恢复实例)_第21张图片

 

 

22、打开数据库

alter database open resetlogs;

通过nbu恢复oracle数据库(恢复实例)_第22张图片

 

select open_mode from v$database;

通过nbu恢复oracle数据库(恢复实例)_第23张图片

 

23、创建临时表空间

SQL> create temporary tablespace temp1 tempfile '/opt/products/oradata/temp1.dbf' size 500m;

 

Tablespace created.

SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY';

 

TABLESPACE_NAME

------------------------------

TEMP

USSD2_TEMP

TEMP1

 

SQL> alter database default temporary tablespace temp1;

 

Database altered.

 

SQL> drop tablespace TEMP including contents and datafiles;

 

Tablespace dropped.

 

SQL> drop tablespace USSD2_TEMP including contents and datafiles;

 

Tablespace dropped.

 

 

注:Oracle的恢复需要注意。操作系统版本原库与目标库需要相同,Oracle软件版本也需要相同(需精确到:11.2.0.4)。

 

你可能感兴趣的:(系统运维)