操作系统:centos7.6
oracle版本:11.2.0.4
一、源数据库操作
1.源库备份情况:查看nbu备份文件
/usr/openv/netbackup/bin/bplist -C bomdb -S NBU-server -t 4 -R -l /
2.创建pfile文件并传递到目标库
create pfile='/home/oracle/initbom.ora' from spfile; scp -r initbom.ora xxxx:/u01/app/oracle/product/11.2.0/db_1/dbs/
二、目标数据库操作 1.创建相关目录
--FRA目录 mkdir -p /u01/app/oracle/fast_recovery_area/bom --DATAFILE mkdir -p /u01/app/oracle/oradata/bom --adump mkdir -p /u01/app/oracle/admin/bom/adump --arch mkdir -p /u01/app/oracle/arch --配置权限 chown -R oracle.oinstall /u01/app/oracle
2.参数文件修改
bom.__db_cache_size=889192448 bom.__java_pool_size=16777216 bom.__large_pool_size=33554432 bom.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment bom.__pga_aggregate_target=838860800 bom.__sga_target=2516582400 bom.__shared_io_pool_size=335544320 bom.__shared_pool_size=1174405120 bom.__streams_pool_size=33554432 *.aq_tm_processes=0 *.audit_file_dest='/u01/app/oracle/admin/bom/adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='/u01/app/oracle/oradata/bom/control01.ctl','/u01/app/oracle/fast_recovery_area/bom/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='bom' *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area' *.db_recovery_file_dest_size=4385144832 *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=bomXDB)' *.job_queue_processes=0 *.log_archive_dest_1='location=/u01/app/oracle/arch' *.open_cursors=300 *.pga_aggregate_target=836763648 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.sga_target=2510290944 *.undo_tablespace='UNDOTBS1'
3.创建目标库的口令文件
$ORACLE_HOME/dbs orapwd file=orapwbom password=oracle entries=10
4.使用修改后的参数文件启动到nomount
sqlplus / as sysdba startup nomount;
5.生成spfile文件,关闭数据库,然后重新启动到nomount
create spfile from pfile; shutdown immediate; startup nomount;
6.启动rman,恢复控制文件
run{ allocate channel c1 type 'sbt_tape'; send 'nb_ora_serv=NBU-Server,nb_ora_client=bomdb'; 备份库主机名 restore controlfile from '/ctrl_dBOM_ugl38a6b1_s33301_p1_t1183127905'; release channel c1; }
7.启动到mount
alter database mount;
8.恢复数据库
run{ allocate channel ch1 type 'sbt_tape'; allocate channel ch2 type 'sbt_tape'; send 'nb_ora_serv=NBU-Server,nb_ora_client=bomdb'; set newname for datafile 1 to '/u01/app/oracle/oradata/bom/system01.dbf'; set newname for datafile 2 to '/u01/app/oracle/oradata/bom/sysaux01.dbf'; set newname for datafile 3 to '/u01/app/oracle/oradata/bom/undotbs01.dbf'; set newname for datafile 4 to '/u01/app/oracle/oradata/bom/users01.dbf'; set newname for datafile 1 to '/u01/app/oracle/oradata/bom/temp01.dbf'; restore database; switch datafile all; #将控制文件中记录的数据文件位置更新为使用set newname命令指定的新位置 switch tempfile all; recover database; release channel ch1; release channel ch1; } RMAN-03002: failure of recover command at 10/23/2024 17:07:57 RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 18736 and starting SCN of 54835808 ---报错原因:RMAN备份不会备份当前的redo logfile文件,异机恢复时找不到redo logfile,所以报错rman-06054 可以基于sequence的恢复,恢复到当前18736号之前的,不包含18736号 list backup of archivelog from sequence 18736; recover database until sequence 18736;
9.修改日志文件 如果两边redo路径一致可以不操作
select group#,member from v$logfile order by group#; select 'alter database rename file ''' || member ||'''' || ' to '''|| substr(member,0,instr(member,'/',-1) -1)|| substr(member,instr(member,'/',-1)) ||''';' from v$logfile; alter database rename file '/u01/app/oracle/oradata/bom/redo03.log' to '/u01/app/oracle/oradata/bom/redo03.log'; alter database rename file '/u01/app/oracle/oradata/bom/redo02.log' to '/u01/app/oracle/oradata/bom/redo02.log'; alter database rename file '/u01/app/oracle/oradata/bom/redo01.log' to '/u01/app/oracle/oradata/bom/redo01.log';
10.启动数据库
alter database open resetlogs; ORA-00392: log 1 of thread 1 is being cleared, operation not allowed ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/bom/redo01.log' 处理:日志状态为clearling select group#,sequence#,bytes,members,status from v$log; ALTER DATABASE CLEAR LOGFILE GROUP 1; ALTER DATABASE CLEAR LOGFILE GROUP 2; ALTER DATABASE CLEAR LOGFILE GROUP 3;
11.查看temp表空间,并重建temp表空间(可不做)
SQL> select name from v$tempfile; /u01/app/oracle/oradata/bom/temp01.dbf SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY'; TEMP SQL> create temporary tablespace TEMP1; OMF管理 SQL> create temporary tablespace TEMP1 tempfile '/u01/app/oracle/oradata/orcl/temp01.dbf' size 50M; SQL> alter database default temporary tablespace TEMP1; SQL> drop tablespace TEMP including contents and datafiles;
12.查看监听状态并配置,编辑tnsname.ora文件。
[oracle@orcl ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin [oracle@rac1 admin]$ vi tnsnames.ora bom = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracletest)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bom) ) ) 登录测试 sqlplus sys/oracle@oracletest:1521/bom as sysdba
13.检查控制文件和数据文件头记录的scn是否一致
select checkpoint_change# from v$datafile; select checkpoint_change# from v$datafile_header;
14.将新数据库添加到oratab中
vi /etc/oratab bom:/u01/app/oracle/product/11.2.0/dbhome_1:N错误处理: 1.执行控制文件恢复报错ORA-01034
RMAN-03002: failure of allocate command at 10/23/2024 15:09:51 RMAN-06403: could not obtain a fully authorized session ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux-x86_64 Error: 2: No such file or directory 原因:数据库实例没有生效 解决:source /home/oracle/.bash_profile
2.执行控制文件恢复报错RMAN-06172
RMAN-03002: failure of restore command at 05/11/2020 22:10:12 RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece 解决方法:nb_ora_client参数后应该填备份服务器名而非还原服务器名
3.执行控制文件恢复报错 skgfrtrv: sbtrestore returned error
RMAN-03002: failure of restore command at 10/23/2024 15:25:39 ORA-19870: error while restoring backup piece ctrl_dBOM_ugl38a6b1_s33301_p1_t1183127905 ORA-19507: failed to retrieve sequential file, handle="ctrl_dBOM_ugl38a6b1_s33301_p1_t1183127905", parms="" ORA-27029: skgfrtrv: sbtrestore returned error ORA-19511: Error received from media manager layer, error text: Failed to process backup file <ctrl_dBOM_ugl38a6b1_s33301_p1_t1183127905> 原因:在nbu服务器和要恢复的服务器上检查路径是否存在No.Restrictions,如不存在手动建 解决:nbu服务端:C:\Program Files\Veritas\NetBackup\db\altnames No.Restrictions 恢复机器:/usr/openv/netbackup/db/altnames touch No.Restrictions
标签:log,异机,app,nbu,oradata,bom,oracle,oracle11g,u01 From: https://www.cnblogs.com/sherq1989/p/18498941