RMAN备份恢复环境

生产备份:
注意事项:备份时间要选择在无发生新业务时段,另外手工备份是备份到本地磁盘上,备份时间大约一个半小时左右,备份时要与磁带机的自动备份时间分开。否则有可能备份错误。另外备份过程中不要中断网络。

1. oracle  用户身份,使用  ssh 工具链接到数据库第二台主机。(如果有  vnc 客户端可以使用 vnc 链接,进行后台备份,登录方法如下截图)

主机  IP 16.1.14.22
用户名:  oracle
密码:  oracle

2. 删除原来的备份
登录系统后按照如下命令删除原有备份:
cd /ebsdb/bak
rm -rf *

3. 登录后登录到 rman 工具,执行脚本。
登录方法,使用如下命令登录:
rman target /        (注意每段字符中间有空格)

3. 登录后会有 ”>”,  为命令提示符,在命令提示符后面复制如下内容,回车后执行备份:
run{
         configure device type disk parallelism 10 backup type to compressed backupset;
         configure controlfile autobackup off;
         crosscheck backup;
         delete noprompt expired backup;
         crosscheck archivelog all;
         delete noprompt expired archivelog all;
         backup incremental level 0 database format '/ebsdb/bak/data_%T_%U.bak';
         SQL 'alter system archive log current';
         backup archivelog all format '/ebsdb/bak/arch_%T_%U.bak';
         backup spfile format '/ebsdb/bak/spfile_%T_%U.bak';
         backup current controlfile format '/ebsdb/bak/con_%T_%U.bak';
         }

测试恢复:
关闭应用:
使用root 用户登录测试系统
Ip  10.1.14.200
用户名:  root
密码:  root
ebstest[/]#su - appl
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993  The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.

Confidential computer software. Valid license from HP required for
possession, use or copying.  Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.

You have mail.
ebstest-appl[/home/appl]$cd $ADMIN_SCRIPTS_HOME
ebstest-appl[/ebsapp/inst/apps/PROD_ebstest/admin/scripts ]$adstpall.sh apps/apps
ebstest-appl[/ebsapp/inst/apps/PROD_ebstest/admin/scripts]$ ps -ef |grep FND*
    appl 10023  9513  0 12:52:06 pts/1     0:00 grep FND*

关闭数据库:
ebstest[/]# su - oracle
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993  The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.

Confidential computer software. Valid license from HP required for
possession, use or copying.  Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.

ebstest-oracle[/home/oracle] $cd $ORACLE_HOME/appsutil/scripts/PROD_ebstest
ebstest-oracle[/ebsdb/test/oracle/product/11.2.0/dbhome_1/appsutil/scripts/PROD_ebstest] $./addbctl.sh stop immediate;

You are running addbctl.sh version 120.1


Shutting down database PROD ...


SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 16 12:54:44 2013

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

Connected.
Database closed.
Database dismounted.
ORACLE instance shut down.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

addbctl.sh: exiting with status 0

移除数据文件:
ebstest-oracle[/] $cd $ORACLE_BASE/oradata/PROD
ebstest-oracle[/ebsdb/test/oracle/oradata/PROD] $rm -rf *
ebstest-oracle[/ebsdb/test/oracle/oradata/PROD]$ cd ../../temp/
ebstest-oracle[/ebsdb/test/oracle/temp] $rm -rf *
删除归档日志
查询归档日志位置
Sqlplus / as sysdba
Show parameter log_archive_desc_1
到查询出来的位置将归档日志全部删除

修改备份集权限
ebstest[/] #cd /ebsdb
ebstest[/ebsdb]#chown -R oracle:oinstall backup

恢复
ebstest[/ebsdb]#su - oracle
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993  The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.

Confidential computer software. Valid license from HP required for
possession, use or copying.  Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.

ebstest-oracle[/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 16 13:06:51 2013

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 3.2068E+10 bytes
Fixed Size                  2198424 bytes
Variable Size            1.8656E+10 bytes
Database Buffers         1.3355E+10 bytes
Redo Buffers               55312384 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ebstest-oracle[/home/oracle]$rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Dec 16 13:08:03 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD (not mounted)

RMAN> restore controlfile from '/ebsdb/backup/  con_20150302_umq0qieu_1_1.bak ';
注:到备份文件中找到“  con  ”字样的文件,将文件名复制到上面的地方。

Starting restore at 16-DEC-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=98 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/ebsdb/test/oracle/oradata/PROD/control01.ctl
output file name=/ebsdb/test/oracle/fast_recovery_area/PROD/control02.ctl
Finished restore at 16-DEC-13

RMAN> exit

Recovery Manager complete.
ebstest-oracle[/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 16 13:10:59 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter database mount;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ebstest-oracle[/home/oracle]$rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Dec 16 13:11:26 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD (DBID=214461100, not open)

RMAN> crosscheck backup;
RMAN>delete noprompt expired backup;
RMAN>crosscheck archivelog all;
RMAN>delete noprompt expired archivelog all;
RMAN> catalog start with '/ebsdb/backup';

searching for all files that match the pattern /ebsdb/backup

List of Files Unknown to the Database
=====================================
File Name: /ebsdb/backup/arch_20131214_lcorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_ldorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_leorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_lforf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_lgorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_lhorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_liorf22c_1_1.bak
File Name: /ebsdb/backup/con_20131214_lkorf22m_1_1.bak
File Name: /ebsdb/backup/data_20131214_kporevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_kqorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_krorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_ksorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_ktorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_kuorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_kvorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_l0orevhv_1_1.bak
File Name: /ebsdb/backup/data_20131214_l1orevso_1_1.bak
File Name: /ebsdb/backup/data_20131214_l2orf01a_1_1.bak
File Name: /ebsdb/backup/data_20131214_l3orf07d_1_1.bak
File Name: /ebsdb/backup/data_20131214_l4orf08r_1_1.bak
File Name: /ebsdb/backup/data_20131214_l5orf0pj_1_1.bak
File Name: /ebsdb/backup/data_20131214_l6orf0qc_1_1.bak
File Name: /ebsdb/backup/data_20131214_l7orf0qc_1_1.bak
File Name: /ebsdb/backup/data_20131214_l8orf0qk_1_1.bak
File Name: /ebsdb/backup/data_20131214_l9orf0s1_1_1.bak
File Name: /ebsdb/backup/data_20131214_laorf133_1_1.bak
File Name: /ebsdb/backup/data_20131214_lborf139_1_1.bak
File Name: /ebsdb/backup/spfile_20131214_ljorf22k_1_1.bak

Do you really want to catalog the above files (enter YES or NO) ? YES
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /ebsdb/backup/arch_20131214_lcorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_ldorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_leorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_lforf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_lgorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_lhorf22c_1_1.bak
File Name: /ebsdb/backup/arch_20131214_liorf22c_1_1.bak
File Name: /ebsdb/backup/con_20131214_lkorf22m_1_1.bak
File Name: /ebsdb/backup/data_20131214_kporevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_kqorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_krorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_ksorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_ktorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_kuorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_kvorevhu_1_1.bak
File Name: /ebsdb/backup/data_20131214_l0orevhv_1_1.bak
File Name: /ebsdb/backup/data_20131214_l1orevso_1_1.bak
File Name: /ebsdb/backup/data_20131214_l2orf01a_1_1.bak
File Name: /ebsdb/backup/data_20131214_l3orf07d_1_1.bak
File Name: /ebsdb/backup/data_20131214_l4orf08r_1_1.bak
File Name: /ebsdb/backup/data_20131214_l5orf0pj_1_1.bak
File Name: /ebsdb/backup/data_20131214_l6orf0qc_1_1.bak
File Name: /ebsdb/backup/data_20131214_l7orf0qc_1_1.bak
File Name: /ebsdb/backup/data_20131214_l8orf0qk_1_1.bak
File Name: /ebsdb/backup/data_20131214_l9orf0s1_1_1.bak
File Name: /ebsdb/backup/data_20131214_laorf133_1_1.bak
File Name: /ebsdb/backup/data_20131214_lborf139_1_1.bak
File Name: /ebsdb/backup/spfile_20131214_ljorf22k_1_1.bak

RMAN> run{
set newname for datafile 1 to '/ebsdb/test/oracle/oradata/PROD/system01.dbf';
set newname for datafile 2 to '/ebsdb/test/oracle/oradata/PROD/system02.dbf';
set newname for datafile 3 to '/ebsdb/test/oracle/oradata/PROD/system03.dbf';
set newname for datafile 4 to '/ebsdb/test/oracle/oradata/PROD/system04.dbf';
set newname for datafile 5 to '/ebsdb/test/oracle/oradata/PROD/system05.dbf';
set newname for datafile 6 to '/ebsdb/test/oracle/oradata/PROD/system06.dbf';
set newname for datafile 7 to '/ebsdb/test/oracle/oradata/PROD/system07.dbf';
set newname for datafile 8 to '/ebsdb/test/oracle/oradata/PROD/system08.dbf';
set newname for datafile 9 to '/ebsdb/test/oracle/oradata/PROD/system09.dbf';
set newname for datafile 10  to '/ebsdb/test/oracle/oradata/PROD/system10.dbf';
set newname for datafile 11  to '/ebsdb/test/oracle/oradata/PROD/system11.dbf';
set newname for datafile 12  to '/ebsdb/test/oracle/oradata/PROD/apps_undots101.dbf';
set newname for datafile 13  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_archive01.dbf';
set newname for datafile 14  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_interface01.dbf';
set newname for datafile 15  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_media01.dbf';
set newname for datafile 16  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_nologging.dbf';
set newname for datafile 17  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_queues01.dbf';
set newname for datafile 18  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_queues02.dbf';
set newname for datafile 19  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_seed01.dbf';
set newname for datafile 20  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_seed02.dbf';
set newname for datafile 21  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_summary01.dbf';
set newname for datafile 22  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data01.dbf';
set newname for datafile 23  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data02.dbf';
set newname for datafile 24  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data03.dbf';
set newname for datafile 25  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_idx01.dbf';
set newname for datafile 26  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_idx02.dbf';
set newname for datafile 27  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_idx03.dbf';
set newname for datafile 28  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_idx04.dbf';
set newname for datafile 29  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_idx05.dbf';
set newname for datafile 30  to '/ebsdb/test/oracle/oradata/PROD/ctxd01.dbf';
set newname for datafile 31  to '/ebsdb/test/oracle/oradata/PROD/odm.dbf';
set newname for datafile 32  to '/ebsdb/test/oracle/oradata/PROD/olap.dbf';
set newname for datafile 33  to '/ebsdb/test/oracle/oradata/PROD/owapub.dbf';            
set newname for datafile 34  to '/ebsdb/test/oracle/oradata/PROD/portal.dbf';
set newname for datafile 35  to '/ebsdb/test/oracle/oradata/PROD/sysaux.dbf';
set newname for datafile 36  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tools.dbf';
set newname for datafile 37  to '/ebsdb/test/oracle/oradata/PROD/interim.dbf';
set newname for datafile 38  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data04.dbf';
set newname for datafile 39  to '/ebsdb/test/oracle/oradata/PROD/apps_undots102.dbf';
set newname for datafile 40  to '/ebsdb/test/oracle/oradata/PROD/cuxd01.dbf';
set newname for datafile 41  to '/ebsdb/test/oracle/oradata/PROD/cuxi01.dbf';
set newname for datafile 42  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux001.dbf';
set newname for datafile 43  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux101.dbf';
set newname for datafile 44  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux201.dbf';
set newname for datafile 45  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux301.dbf';
set newname for datafile 46  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux401.dbf';
set newname for datafile 47  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux501.dbf';
set newname for datafile 48  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux601.dbf';
set newname for datafile 49  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux701.dbf';
set newname for datafile 50  to '/ebsdb/test/oracle/oradata/PROD/apps_undots103.dbf';
set newname for datafile 51  to '/ebsdb/test/oracle/oradata/PROD/undotbs2.dbf';
set newname for datafile 52  to '/ebsdb/test/oracle/oradata/PROD/apps_undots201.dbf';
set newname for datafile 53  to '/ebsdb/test/oracle/oradata/PROD/apps_undots202.dbf';
set newname for datafile 54  to '/ebsdb/test/oracle/oradata/PROD/apps_undots203.dbf';
set newname for datafile 55  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_interface02.dbf';
set newname for datafile 56  to '/ebsdb/test/oracle/oradata/PROD/cuxd02.dbf';            
set newname for datafile 57  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_summary02.dbf'; 
set newname for datafile 58  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_media02.dbf';   
set newname for datafile 59  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data05.dbf'; 
set newname for datafile 60  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_idx06.dbf';  
set newname for datafile 61  to '/ebsdb/test/oracle/oradata/PROD/cuxi02.dbf';            
set newname for datafile 62  to '/ebsdb/test/oracle/oradata/PROD/cuxd03.dbf';            
set newname for datafile 63  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data06.dbf'; 
set newname for datafile 64  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_idx07.dbf';  
set newname for datafile 65  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux502.dbf';   
set newname for datafile 66  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data07.dbf'; 
set newname for datafile 67  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data08.dbf'; 
set newname for datafile 68  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data09.dbf'; 
set newname for datafile 69  to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data10.dbf'; 
set newname for datafile 70  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux602.dbf';   
set newname for datafile 71  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux002.dbf';   
set newname for datafile 72  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux702.dbf';   
set newname for datafile 73  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux402.dbf';   
set newname for datafile 74  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux102.dbf';   
set newname for datafile 75  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux202.dbf';   
set newname for datafile 76  to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux302.dbf';   
set newname for datafile 77  to '/ebsdb/test/oracle/oradata/PROD/cuxd04.dbf';            
set newname for datafile 78  to '/ebsdb/test/oracle/oradata/PROD/cuxd05.dbf';            
set newname for datafile 79 to '/ebsdb/test/oracle/oradata/PROD/cuxd06.dbf';                
set newname for datafile 80 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux603.dbf';       
set newname for datafile 81 to '/ebsdb/test/oracle/oradata/PROD/apps_ts_archive02.dbf';     
set newname for datafile 82 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux003.dbf';       
set newname for datafile 83 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux103.dbf';
set newname for datafile 84 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux203.dbf';       
set newname for datafile 85 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux303.dbf';       
set newname for datafile 86 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux403.dbf';       
set newname for datafile 87 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux503.dbf';       
set newname for datafile 88 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux703.dbf';       
set newname for datafile 89 to '/ebsdb/test/oracle/oradata/PROD/cuxd07.dbf';                
set newname for datafile 90 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux004.dbf';
set newname for datafile 91 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux104.dbf';
set newname for datafile 92 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux204.dbf';
set newname for datafile 93 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux304.dbf';
set newname for datafile 94 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux404.dbf';
set newname for datafile 95 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux504.dbf ';
set newname for datafile 96 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux604.dbf ';
set newname for datafile 97 to '/ebsdb/test/oracle/oradata/PROD/apps_pts_cux704.dbf ';
set newname for datafile 98 to '/ebsdb/test/oracle/oradata/PROD/apps_ts_archive03.dbf ';
set newname for datafile 99 to '/ebsdb/test/oracle/oradata/PROD/apps_ts_media03.dbf ';
set newname for datafile 100 to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data11.dbf ';
set newname for datafile 101 to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_idx08.dbf ';
set newname for datafile 102 to '/ebsdb/test/oracle/oradata/PROD/cuxd08.dbf ';
set newname for datafile 103 to '/ebsdb/test/oracle/oradata/PROD/ctxd02.dbf ';
set newname for datafile 104 to '/ebsdb/test/oracle/oradata/PROD/apps_ts_tx_data12.dbf ';
set newname for datafile 105 to '/ebsdb/test/oracle/oradata/PROD/ apps_ts_tx_data13.dbf ';
set newname for datafile 106 to '/ebsdb/test/oracle/oradata/PROD/ apps_ts_tx_idx09.dbf ';
set newname for datafile 107 to '/ebsdb/test/oracle/oradata/PROD/ cuxd09.dbf ';
set newname for datafile 108 to '/ebsdb/test/oracle/oradata/PROD/ apps_ts_tx_data14.dbf ';
set newname for datafile 109 to '/ebsdb/test/oracle/oradata/PROD/ apps_ts_tx_idx10.dbf ';
set newname for datafile 110 to '/ebsdb/test/oracle/oradata/PROD/ cuxd10.dbf ';
set newname for tempfile 1   to '/ebsdb/test/oracle/temp/temp1.dbf';
set newname for tempfile 2   to '/ebsdb/test/oracle/temp/temp2.dbf';
set newname for tempfile 3   to '/ebsdb/test/oracle/temp/temp3.dbf';
set newname for tempfile 4   to '/ebsdb/test/oracle/temp/temp4.dbf';
RESTORE DATABASE;
switch datafile all;
switch tempfile all;
}
注:将所有生产上的数据文件名称全部更改为新名称,如果有重名按照序号往下排。生产机器上具体查询命令如下:
使用  oracle  用户:
sqlplus / as sysdba
set linesize 500
set pagesize 500
select file#,name,bytes/1024/1024 from v$datafile;

RMAN> recover database;
……
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 12/16/2013 14:24:20
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 2921 and starting SCN of  3123290376

RMAN> run {set until scn= 5681064229;}

executing command: SET until clause
RMAN> exit


Recovery Manager complete.
ebstest-oracle[/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 16 14:26:52 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 3.2068E+10 bytes
Fixed Size                  2198424 bytes
Variable Size            1.8656E+10 bytes
Database Buffers         1.3355E+10 bytes
Redo Buffers               55312384 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;

Database altered.
修改数据库参数
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 3.2068E+10 bytes
Fixed Size                  2198424 bytes
Variable Size            1.8656E+10 bytes
Database Buffers         1.3355E+10 bytes
Redo Buffers               55312384 bytes
SQL> alter database mount;

Database altered.

SQL> alter database noarchivelog;

Database altered.

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Current log sequence           1
SQL> alter database open;

Database altered.
重建  temp
ebstest-oracle[/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 16 14:34:49 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name,bytes/1024/1024,status from v$tempfile;

NAME
--------------------------------------------------------------------------------
BYTES/1024/1024 STATUS
--------------- -------
/ebsdb/test/oracle/temp/temp1.dbf
           1100 ONLINE

/ebsdb/test/oracle/temp/temp2.dbf
           1100 ONLINE

/ebsdb/test/oracle/temp/temp3.dbf
           1100 ONLINE

/ebsdb/test/oracle/temp/temp4.dbf
           1024 ONLINE
删除临时文件:
SQL> alter database tempfile '/ebsdb/test/oracle/temp/temp1.dbf' offline;

Database altered.

SQL> alter database tempfile '/ebsdb/test/oracle/temp/temp2.dbf' offline;

Database altered.

SQL> alter database tempfile '/ebsdb/test/oracle/temp/temp3.dbf' offline;

Database altered.

SQL> alter database tempfile '/ebsdb/test/oracle/temp/temp1.dbf' drop including datafiles;

Database altered.

SQL> alter database tempfile '/ebsdb/test/oracle/temp/temp2.dbf' drop including datafiles;

Database altered.

SQL> alter database tempfile '/ebsdb/test/oracle/temp/temp3.dbf' drop including datafiles;

Database altered.
重建临时文件
SQL> alter tablespace temp1 add tempfile '/ebsdb/test/oracle/temp/temp1.dbf' size 1024M;

Tablespace altered.

SQL> alter tablespace temp1 add tempfile '/ebsdb/test/oracle/temp/temp2.dbf' size 1024M;

Tablespace altered.

SQL>  alter tablespace temp2 add tempfile '/ebsdb/test/oracle/temp/temp3.dbf' size 1024M;

Tablespace altered.
删除重建  temp4 
SQL> alter database tempfile '/ebsdb/test/oracle/temp/temp4.dbf' offline;

Database altered.

SQL> alter database tempfile '/ebsdb/test/oracle/temp/temp4.dbf' drop including datafiles;

Database altered.

SQL> alter tablespace temp2 add tempfile '/ebsdb/test/oracle/temp/temp4.dbf' size 1024M;

Tablespace altered.
 
清理节点信息
ebstest-oracle[/]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 16 14:45:31 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> conn apps/apps
Connected.
SQL> exec fnd_conc_clone.setup_clean

PL/SQL procedure successfully completed.
DB autocfg
ebstest-oracle[/ebsdb/test/oracle/product/11.2.0/dbhome_1/appsutil/scripts/PROD_ebstest]$./adautocfg.sh   
Enter the APPS user password:
The log file for this session is located at: /ebsdb/test/oracle/product/11.2.0/dbhome_1/appsutil/log/PROD_ebstest/12161448/adconfig.log

AutoConfig is configuring the Database environment...

AutoConfig will consider the custom templates if present.
        Using ORACLE_HOME location : /ebsdb/test/oracle/product/11.2.0/dbhome_1
        Classpath                   : :/ebsdb/test/oracle/product/11.2.0/dbhome_1/jdbc/lib/ojdbc5.jar:/ebsdb/test/oracle/product/11.2.0/dbhome_1/appsutil/java/xmlparserv2.jar:/ebsdb/test/oracle/product/11.2.0/dbhome_1/appsutil/java:/ebsdb/test/oracle/product/11.2.0/dbhome_1/jlib/netcfg.jar:/ebsdb/test/oracle/product/11.2.0/dbhome_1/jlib/ldapjclnt11.jar

        Using Context file          : /ebsdb/test/oracle/product/11.2.0/dbhome_1/appsutil/PROD_ebstest.xml

Context Value Management will now update the Context file

        Updating Context file...COMPLETED

        Attempting upload of Context file and templates to database...COMPLETED

Updating rdbms version in Context file to db112
Updating rdbms type in Context file to 64 bits
Configuring templates from ORACLE_HOME ...

AutoConfig completed successfully.
APP autocfg
ebstest[/]#su - appl
(c)Copyright 1983-2006 Hewlett-Packard Development Company, L.P.
(c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 Novell, Inc.
(c)Copyright 1986-2000 Sun Microsystems, Inc.
(c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology
(c)Copyright 1989-1993  The Open Software Foundation, Inc.
(c)Copyright 1990 Motorola, Inc.
(c)Copyright 1990, 1991, 1992 Cornell University
(c)Copyright 1989-1991 The University of Maryland
(c)Copyright 1988 Carnegie Mellon University
(c)Copyright 1991-2006 Mentat Inc.
(c)Copyright 1996 Morning Star Technologies, Inc.
(c)Copyright 1996 Progressive Systems, Inc.

Confidential computer software. Valid license from HP required for
possession, use or copying.  Consistent with FAR 12.211 and 12.212,
Commercial Computer Software, Computer Software Documentation, and
Technical Data for Commercial Items are licensed to the U.S. Government
under vendor's standard commercial license.

You have mail.
ebstest-appl[/home/appl]$cd $ADMIN_SCRIPTS_HOME
ebstest-appl[/ebsapp/inst/apps/PROD_ebstest/admin/scripts]$ls
adalnctl.sh         adformsctl.sh       adstpall.sh         msc
adapcctl.sh         adformsrvctl.sh     adstrtal.sh         mwactl.sh
adautocfg.sh        adoacorectl.sh      gsmstart.sh         mwactlwrpr.sh
adcmctl.sh          adoafmctl.sh        ieo                 sqlnet.log
adexecsql.pl        adopmnctl.sh        java.sh
adforms-c4wsctl.sh  adpreclone.pl       jtffmctl.sh
ebstest-appl[/ebsapp/inst/apps/PROD_ebstest/admin/scripts]$adautocfg.sh    
Enter the APPS user password:

The log file for this session is located at: /ebsapp/inst/apps/PROD_ebstest/admin/log/12161450/adconfig.log

AutoConfig is configuring the Applications environment...

AutoConfig will consider the custom templates if present.
        Using CONFIG_HOME location     : /ebsapp/inst/apps/PROD_ebstest
        Classpath                   : /ebsapp/apps/apps_st/comn/java/lib/appsborg2.zip:/ebsapp/apps/apps_st/comn/java/classes

        Using Context file          : /ebsapp/inst/apps/PROD_ebstest/appl/admin/PROD_ebstest.xml

Context Value Management will now update the Context file

        Updating Context file...COMPLETED

        Attempting upload of Context file and templates to database...COMPLETED

Configuring templates from all of the product tops...
        Configuring AD_TOP........COMPLETED
        Configuring FND_TOP.......COMPLETED
        Configuring ICX_TOP.......COMPLETED
        Configuring MSC_TOP.......COMPLETED
        Configuring IEO_TOP.......COMPLETED
        Configuring BIS_TOP.......COMPLETED
        Configuring AMS_TOP.......COMPLETED
        Configuring CCT_TOP.......COMPLETED
        Configuring WSH_TOP.......COMPLETED
        Configuring CLN_TOP.......COMPLETED
        Configuring OKE_TOP.......COMPLETED
        Configuring OKL_TOP.......COMPLETED
        Configuring OKS_TOP.......COMPLETED
        Configuring CSF_TOP.......COMPLETED
        Configuring IGS_TOP.......COMPLETED
        Configuring IBY_TOP.......COMPLETED
        Configuring JTF_TOP.......COMPLETED
        Configuring MWA_TOP.......COMPLETED
        Configuring CN_TOP........COMPLETED
        Configuring CSI_TOP.......COMPLETED
        Configuring WIP_TOP.......COMPLETED
        Configuring CSE_TOP.......COMPLETED
        Configuring EAM_TOP.......COMPLETED
        Configuring FTE_TOP.......COMPLETED
        Configuring ONT_TOP.......COMPLETED
        Configuring AR_TOP........COMPLETED
        Configuring AHL_TOP.......COMPLETED
        Configuring OZF_TOP.......COMPLETED
        Configuring IES_TOP.......COMPLETED
        Configuring CSD_TOP.......COMPLETED
        Configuring IGC_TOP.......COMPLETED

AutoConfig completed successfully.
  

猜你喜欢

转载自blog.csdn.net/suixufeng/article/details/51262215