oracle数据库升级11.2.0.3升级到11.2.0.4

时间:2022-04-08 08:44:32
#######################################
## 升级准备期 ##
#######################################

1. 介质准备,在所有服务器上,准备如下介质
mkdir -p /u02/soft
unzip /u02/soft/p13390677_112040_Linux-x86-64_1of7 -d /u02/soft
unzip /u02/soft/p13390677_112040_Linux-x86-64_2of7 -d /u02/soft
unzip /u02/soft/p18139609_112040_Linux-x86-64.zip -d /u02/soft

-- 安装完成DB软件后,立即更新OPatch
unzip /u02/soft/p18139609_112040_Linux-x86-64.zip -d /u02/soft



1. 安装11.2.0.4 DB软件,安装DB PSU 11.2.0.4.2,编辑新的profile文件
-- 中转机器:安装软件
. ~/bash_profile_11204
HOSTNAME=histdb
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0.4/db/lib:/usr/lib
ORACLE_SID=billhist
PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/home/oracle/bin:/u01/app/oracle/product/11.2.0.4/db/bin:/u01/app/11.2.0/grid/bin
GRID_HOME=/u01/app/11.2.0.4/grid
ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db


2. 安装11.2.0.4GRID软件,安装PSU 11.2.0.4.2,编辑新的profile文件
-- 注意先不进行css配置,GI的PSU先不安装
. ~/bash_profile_asm_11204
ORACLE_HOME=/u01/app/11.2.0.4
ORACLE_SID=+ASM

3. 拷贝11.2.0.3的listener.ora、tnsnames.ora到新的GRID HOME环境中的相关目录,并修改listener.ora中ORACLE_HOME路径
拷贝11.2.0.3 spfile、orapw、文件ASM 至新的GRID HOME DB 至新的DB HOME
拷贝主库crontab 脚本至standby
/opt/monitor/rman/rmandw_level0_bak.sh
/opt/monitor/rman/rmandw_level1_bak.sh
/opt/monitor/rman/rmandw_level2_bak.sh
/home/oracle/sh/check_disk.sh
/home/oracle/sh/get_ORA_errors.sh
/opt/monitor/sql/backup_listenerlog.sh
/home/oracle/sh/gather_stats.sh
/home/oracle/sh/get_vmstat.sh
/home/oracle/sh/check_trace_dw.sh
/opt/monitor/sql/switchlog.sh
/opt/monitor/sql/gather_stats.sh
/opt/monitor/sql/gather_stats_empty.sh
/opt/monitor/sql/create_awrrpt.sh
/home/oracle/autoextend_ts/autoextend_ts.sh
/home/oracle/dailycheck/dailycheck_diskspace.sh
/home/oracle/dailycheck/dailycheck_alertlog.sh
/home/oracle/dailycheck/dailycheck_backup.sh
/home/oracle/dailycheck/dailycheck_scp.sh
/u01/report/sql/dwdailydatacheck.sh
/u01/report/sql/dwdailydatacheck.sh
/u01/report/sql/data_check.sh
/u01/report/sql/data_check.sh
/opt/monitor/sql/asm_dh_backup_total.sh
/home/oracle/scripts/clear_archi.sh
/root/sh/ntpd-deploy.sh
-- DB所需配置文件:spfilebillhist.ora, orapwbillhist, listener.ora, tnsnames.ora, sqlnet.ora
-- ASM所需配置文件:spfile+ASM.ora orapw+ASM, listener.ora, tnsnames.ora, sqlnet.ora
-- 所有服务器,预先准备好 bash_profile_11204, bash_profile_asm_11204 等环境变量文件
-- 所有服务器,预先准备好 utlu112i.sql 等升级脚本



4. 根据spfile生成pfile文件
create pfile from spfile;


5. 参数修改:
background_dump_dest



6. 根据修改后的pfile创建新的spfile
CREATE spfile from pfile;




##########################################
## 升级窗口期前10小时内 ##
##########################################

1. 搜集统计信息,缩短升级时间,11.2.0.3环境执行
EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;


2. 清空回收站,11.2.0.3执行
PURGE DBA_RECYCLEBIN;


3. 检查数据字典逻辑结构是否有损坏,11.2.0.3执行
-- 执行时间较长,但中途终止不会影响升级及后续运行
Set verify off space 0 line 120 heading off feedback off pages 1000
Spool analyze.sql
SELECT 'Analyze cluster "'||cluster_name||'" validate structure cascade;'
FROM dba_clusters
WHERE owner='SYS'
UNION ALL
SELECT 'Analyze table "'||table_name||'" validate structure cascade;'
FROM dba_tables
WHERE owner='SYS'
AND partitioned='NO'
AND (iot_type='IOT' OR iot_type is NULL)
UNION ALL
SELECT 'Analyze table "'||table_name||'" validate structure cascade into invalid_rows;'
FROM dba_tables
WHERE owner='SYS'
AND partitioned='YES';
spool off
exit

vi analyze.sql

drop table INVALID_ROWS;
@?/rdbms/admin/utlvalid.sql
@analyze.sql
select count(*) from INVALID_ROWS;


#########################################
## 升级窗口期前40分钟 ##
#########################################

1. 运行升级检查脚本dbupgdiag.sql
sqlplus '/ as sysdba'
@/NEW_HOME_ORACLE/rdbms/admin/dbupgdiag.sql


2. 运行预升级脚本utlu112i.sql,主库执行
sqlplus '/ as sysdba'
@NEW_HOME_ORACLE/rdbms/admin/utlu112i.sql


3. 检查自定义触发器设置,如果有返回记录,那么需要在升级期间禁用
SELECT OWNER, TRIGGER_NAME, TRIGGER_TYPE, TABLE_NAME, STATUS
FROM DBA_TRIGGERS
WHERE TRIGGERING_EVENT='DDL'
AND OWNER NOT IN ('SYS', 'SYSTEM');


4. 检查数据库中是否有SQL Profile信息,应该返回:no rows selected
SELECT SIGNATURE, CATEGORY, COUNT(*)
FROM DBA_SQL_PROFILES
GROUP BY SIGNATURE, CATEGORY
HAVING COUNT(*) > 1;

-- 检查数据库中的 outline 信息
COL NAME FOR A26
COL OWNER FOR A8
COL CATEGORY FOR A8
SELECT NAME, OWNER, CATEGORY, USED, SQL_TEXT FROM DBA_OUTLINES;

-- 升级后迁移outline的命令(升级过程中不执行):
-- SELECT NAME, OWNER, CATEGORY, USED, MIGRATED, SQL_TEXT FROM DBA_OUTLINES;
-- SET LINES 132 PAGES 1111 LONG 99999 SERVERVOUTPUT ON SIZE UNLIMITED
-- DECLARE
-- L_MIG_OUT CLOB;
-- BEGIN
-- L_MIG_OUT := DBMS_SPM.MIGRATE_STORED_OUTLINE('all');
-- DBMS_OUTPUT.PUT_LINE(L_MIG_OUT);
-- END;
-- /


5. 检查数据库中当前的DB Link信息,保存DB Link的创建脚本,主备库分别执行
set lines 1111 pages 0 trim on trims on
spo create_dblink.sql
SELECT 'CREATE '||DECODE(U.NAME,'PUBLIC','public ')||'DATABASE LINK '||CHR(10)
||DECODE(U.NAME,'PUBLIC',Null, 'SYS','',U.NAME||'.')|| L.NAME||chr(10)
||'CONNECT TO ' || L.USERID || ' IDENTIFIED BY "'||L.PASSWORD||'" USING
'''||L.HOST||''''||chr(10)||';' TEXT
FROM SYS.LINK$ L, SYS.USER$ U
WHERE L.OWNER# = U.USER#;
SPO OFF


6. 检查当前数据库的国家字符集设置
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER = 'NLS_NCHAR_CHARACTERSET';


7. 检查当前数据文件状态和备份状态,主备库分别执行
-- 如果有RECOVER状态的文件,需要先进行恢复,正常应该返回:no rows selected
SELECT * FROM V$RECOVER_FILE;
SELECT * FROM V$BACKUP WHERE STATUS != 'NOT ACTIVE';


8. 记录当前数据库中各项文件的位置,主备库分别执行
SET LINES 1111 PAGES 0 TRIM ON TRIMS ON
COL NAME FOR A1000
SPO dbfile_name_info.txt
SELECT 'Datafile' TYPE, NAME FROM V$DBFILE
UNION ALL
SELECT 'Tempfile' TYPE, NAME FROM V$TEMPFILE
UNION ALL
SELECT 'Logfile' TYPE, MEMBER FROM V$LOGFILE
UNION ALL
SELECT 'Control' TYPE, NAME FROM V$CONTROLFILE;
SPO OFF


9.检查当前数据库的备库信息
SELECT SUBSTR(value,INSTR(value,'=',INSTR(UPPER(value),'SERVICE'))+1)
FROM v$parameter
WHERE name LIKE 'log_archive_dest%' AND UPPER(value) LIKE 'SERVICE%';
show parameter log_arch

10.检查SYS和SYSTEM用户信息,主备库分别执行
SELECT username, default_tablespace FROM dba_users WHERE username in ('SYS','SYSTEM');


-- 如果SYS和SYSTEM用户默认表空间不是SYSTEM,将其修改为SYSTEM
-- ALTER user SYS default tablespace SYSTEM;
-- ALTER user SYSTEM default tablespace SYSTEM;


11.检查审计结果表AUD$和FGA_LOG$,,主备库分别执行
-- 正常应该返回:AUD$位于SYSTEM表空间,属于SYS用户,两张审计表都没有记录
SELECT OWNER,TABLESPACE_NAME FROM DBA_TABLES WHERE TABLE_NAME='AUD$';
SELECT COUNT(*) FROM AUD$;
SELECT COUNT(*) FROM FGA_LOG$;

-- 如果审计表中有记录,可使用如下方式清除审计表中的记录:
-- CREATE TABLE AUD_BAK20141209 AS SELECT * FROM AUD$;
-- CREATE TABLE FGA_LOG_BAK20141209 AS SELECT * FROM FGA_LOG$;
-- TRUNCATE TABLE AUD$;
-- TRUNCATE TABLE FGA_LOG$;


12.检查数据库中是否存在外部认证的用户,正常返回:no rows selected
SELECT NAME FROM SYS.USER$ WHERE EXT_USERNAME IS NOT NULL AND PASSWORD = 'GLOBAL';


13.检查是否有正在运行的Job,停止后续Job的运行
-- 停用Job
SHOW PARAMETER JOB_QUEUE_PROCESSES --记录原始Job进程数 20
--ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SELECT /*+ RULE */ * FROM DBA_JOBS_RUNNING;

-- 停用所有的crontab,关闭监控
crontab -l
crontab -e
--注释掉预计在时间窗口内的
###backup dw
#0 2 1,7,14,21,28 * * /opt/monitor/rman/rmandw_level0_bak.sh >> /opt/monitor/log/rmandw_level0_bak.log
#0 2 2,3,5,6,8,9,10,12,13,15,16,17,19,20,22,23,24,26,27,29,30,31 * * /opt/monitor/rman/rmandw_level1_bak.sh >>/opt/monitor/log/rmandw_level1_bak.log
#0 2 4,11,18,25 * * /opt/monitor/rman/rmandw_level2_bak.sh >> /opt/monitor/log/rmandw_level2_bak.log
#*/10 * * * * /home/oracle/sh/check_disk.sh
#*/10 * * * * /home/oracle/sh/get_ORA_errors.sh >> /home/oracle/sh/get_ORA_errors.log
1 0 1 * * /opt/monitor/sql/backup_listenerlog.sh >> /opt/monitor/log/backup_listenerlog.log
0 9 * * 5 /home/oracle/sh/gather_stats.sh
*/10 * * * * /home/oracle/sh/get_vmstat.sh >> /home/oracle/log/vmstat.log
0 * * * * /home/oracle/sh/check_trace_dw.sh >> /home/oracle/log/check_trace_dw.log
0,30 * * * * /opt/monitor/sql/switchlog.sh >> /opt/monitor/log/switchlog.log
05 13 * * 5 /opt/monitor/sql/gather_stats.sh >> /opt/monitor/log/gather_stats.log
30 17 * * 2 /opt/monitor/sql/gather_stats_empty.sh >> /opt/monitor/log/gather_stats_empty.log
30 9 * * * /opt/monitor/sql/create_awrrpt.sh
##########AUTOEXTEND TABLESPACE CLIENT SHELL by jason 2011-08-11
#13 4 * * * /home/oracle/autoextend_ts/autoextend_ts.sh >> /home/oracle/autoextend_ts/autoextend_ts.log 2>&1

##################################################################################
## dailycheck --larry
##################################################################################
00 08 * * * sh /home/oracle/dailycheck/dailycheck_diskspace.sh
00 08 * * * sh /home/oracle/dailycheck/dailycheck_alertlog.sh
00 08 * * * sh /home/oracle/dailycheck/dailycheck_backup.sh
01 08 * * * sh /home/oracle/dailycheck/dailycheck_scp.sh


#################################################################################
## dm add
20 12 * * * sh /u01/report/sql/dwdailydatacheck.sh
##36 15 * * * sh /u01/report/sql/dwdailydatacheck.sh
##12 17 3 * * sh /u01/report/sql/data_check.sh
28 10 * * * sh /u01/report/sql/etl_report.sh
##12 12 * * * sh /u01/report/sql/data_check.sh

########################
#ASM disk header backup#
########################
0 3 * * * /opt/monitor/sql/asm_dh_backup_total.sh


######################
#clean archive log
######################
15 * * * * sh /home/oracle/scripts/clear_archi.sh



14.检查是否存在未完成的分布式事务,主备库分别执行
SELECT local_tran_id, state, db_user FROM DBA_2PC_PENDING;

-- 如果存在,使用如下方式清除:
-- SELECT local_tran_id FROM dba_2pc_pending;
-- EXECUTE dbms_transaction.purge_lost_db_entry('');
-- COMMIT;


15.保存当前连接到数据库的会话的Machine信息
set lines 132 pages 1111 trim on trims on
spo machine_before_upgrade.txt
select inst_id, machine, count(*) from gv$session where username!='SYS' group by inst_id, machine;
spo off




16.检查是否有用户使用了邮件发送相关的网络包
SET LINES 132 PAGES 1111
COL OWNER FOR A11
COL NAME FOR A33
COL REFERENCED_OWNER FOR A11
COL REFERENCED_NAME FOR A33
SELECT OWNER, NAME, REFERENCED_OWNER, REFERENCED_NAME, REFERENCED_TYPE FROM DBA_DEPENDENCIES
WHERE REFERENCED_NAME IN ('UTL_SMTP', 'UTL_TCP');

OWNER NAME REFERENCED_ REFERENCED_NAME REFERENCED_TYPE
----------- --------------------------------- ----------- --------------------------------- ------------------
SYS UTL_SMTP SYS UTL_SMTP PACKAGE
PUBLIC UTL_SMTP SYS UTL_SMTP PACKAGE
SYS DBMS_AQELM SYS UTL_SMTP PACKAGE
SYS DBMS_ISCHED SYS UTL_SMTP PACKAGE
PUBLIC UTL_TCP SYS UTL_TCP PACKAGE
SYS UTL_SMTP SYS UTL_TCP PACKAGE
SYS MAIL_TOOLS SYS UTL_TCP PACKAGE
SYS MAIL_TOOLS SYS UTL_TCP PACKAGE
SYS UTL_TCP SYS UTL_TCP PACKAGE
SYS UTL_SMTP SYS UTL_TCP PACKAGE
SYS SCHEDULER$_JOB_EVENT_HANDLER SYS UTL_TCP PACKAGE
DW PRC_SENDEMAIL SYS UTL_TCP PACKAGE
SYS DBMS_AQELM SYS UTL_TCP PACKAGE
SYS DBMS_ISCHED SYS UTL_TCP PACKAGE
DMDEV PRC_SENDEMAIL PUBLIC UTL_SMTP SYNONYM
DW PRC_SENDEMAIL PUBLIC UTL_SMTP SYNONYM
DW001 MAIL_TOOLS PUBLIC UTL_TCP SYNONYM
DW001 MAIL_TOOLS PUBLIC UTL_TCP SYNONYM
DW MAIL_TOOLS_STREAM1 PUBLIC UTL_TCP SYNONYM
DMDEV PRC_SENDEMAIL PUBLIC UTL_TCP SYNONYM
DW MAIL_TOOLS_STREAM1 PUBLIC UTL_TCP SYNONYM
DW PRC_SENDEMAIL PUBLIC UTL_TCP SYNONYM
DW PRC_SENDEMAIL DW UTL_SMTP NON-EXISTENT
DW MAIL_TOOLS_STREAM1 DW UTL_TCP NON-EXISTENT
DW MAIL_TOOLS_STREAM1 DW UTL_TCP NON-EXISTENT
DW PRC_SENDEMAIL DW UTL_TCP NON-EXISTENT
DMDEV PRC_SENDEMAIL DMDEV UTL_SMTP NON-EXISTENT
DMDEV PRC_SENDEMAIL DMDEV UTL_TCP NON-EXISTENT
DW001 MAIL_TOOLS DW001 UTL_TCP NON-EXISTENT
DW001 MAIL_TOOLS DW001 UTL_TCP NON-EXISTENT



###########################################
## 升级窗口期 ##
###########################################

1.开启screen
screen -S upgrade_dw


3. 停止监听
oracle 用户 lsnrctl stop



3. 停止所有连接数据库的应用,确认主备库没有连接
SELECT USERNAME, MACHINE, COUNT(*)
FROM V$SESSION
WHERE USERNAME IS NOT NULL
GROUP BY USERNAME, MACHINE
ORDER BY 3;


4. Kill掉任然连接到数据库的会话
SELECT 'kill -9 '||SPID FROM V$PROCESS
WHERE ADDR IN (SELECT PADDR FROM V$SESSION WHERE USERNAME != 'SYS');


5.关闭数据库
oracle 用户
alter system checkpoint;
shutdown immediate;


6.GRID 升级
关闭原来11.2.0.3 GIRD
root 用户执行GRID 升级脚本
/u01/app/11.2.0.4/grid/perl/bin/perl -I/u01/app/11.2.0.4/grid/perl/lib -I/u01/app/11.2.0.4/grid/crs/install /u01/app/11.2.0.4/grid/crs/install/roothas.pl
srvctl upgrade asm



7.安装Grid PSU 11.2.0.4.2

-- 安装Grid PSU 11.2.0.4.2,Root执行
export ORACLE_HOME=/u01/app/11.2.0.4/grid
$ORACLE_HOME/OPatch/ocm/bin/emocmrsp
$ORACLE_HOME/OPatch/opatch auto /u02/p18139609_112040_Linux-x86-64 /u02/ocm.rsp

8.DB升级:确认ASM是否正常启动,启动DB到升级模式
-- 启动11g的ASM实例
. ~/bash_profile_asm_11204 -- 若当前Session已经是11.2.0.4 ASM环境,可不执行这条命令

参数文件已经提前拷贝至新的11.2.0.4 目录
sqlplus '/ as sysasm'
startup

-- 启动数据库到Upgrade模式
. ~/bash_profile_11204 -- 若当前Session已经是11g环境,可不执行这条命令
sqlplus '/ as sysdba'
startup upgrade
alter system set JOB_QUEUE_PROCESSES=0 scope=memory;
alter system set large_pool_size=256m scope=memory;
alter system set java_pool_size=256m scope=memory;


9.DB升级:
-- 运行升级脚本,耗时40分钟左右。升级完成后会自动关闭数据库
. ~/bash_profile_11204 -- 若当前Session已经是11g环境,可不执行这条命令
sqlplus / as sysdba
spool upgrade_11204.log
@?/rdbms/admin/catupgrd.sql
@?/rdbms/admin/utlrp.sql
@?/rdbms/admin/catbundle.sql psu apply
10.检查AUTOTASK状态

15:45:42 sys@warehous> select CLIENT_NAME,STATUS from DBA_AUTOTASK_CLIENT;

CLIENT_NAME STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection ENABLED
auto space advisor ENABLED
sql tuning advisor DISABLED

如状态不是disable 需要执行以下操作

-- 关闭auto sql tuning
BEGIN
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => NULL);
END;
/


11.DB升级:检查升级前后的对象状态
SELECT COMP_NAME, VERSION, STATUS FROM DBA_REGISTRY;

select action,comments from registry$history;
spool alter_obj_inval.log
select 'set echo on feedback on' from dual;
select 'spool alter_obj_inval.lst' from dual;
select
decode( OBJECT_TYPE, 'PACKAGE BODY',
'alter package ' || OWNER||'.'||OBJECT_NAME || ' compile body;',
'alter ' || OBJECT_TYPE || ' ' || OWNER||'.'||OBJECT_NAME || ' compile;' )
from
dba_objects
where
STATUS = 'INVALID' and OBJECT_TYPE in
( 'PACKAGE BODY', 'PACKAGE', 'FUNCTION', 'PROCEDURE', 'TRIGGER', 'VIEW' )
order by OWNER, OBJECT_TYPE, OBJECT_NAME;
select 'spool off' from dual;
spool off

12.dataguard 升级:
确定主库已经可以正常使用
打开归档传输
alter system set log_archive_dest_state_4=enable;
切换至11.2.0.4 HOME,打开DATA GUARD 应用
升级完成



###########################################
## 升级完成 ##
###########################################

1. 开启crontab,打开jmc监控
###backup dw
#0 2 1,7,14,21,28 * * /opt/monitor/rman/rmandw_level0_bak.sh >> /opt/monitor/log/rmandw_level0_bak.log
#0 2 2,3,5,6,8,9,10,12,13,15,16,17,19,20,22,23,24,26,27,29,30,31 * * /opt/monitor/rman/rmandw_level1_bak.sh >>/opt/monitor/log/rmandw_level1_bak.log
#0 2 4,11,18,25 * * /opt/monitor/rman/rmandw_level2_bak.sh >> /opt/monitor/log/rmandw_level2_bak.log
#*/10 * * * * /home/oracle/sh/check_disk.sh
#*/10 * * * * /home/oracle/sh/get_ORA_errors.sh >> /home/oracle/sh/get_ORA_errors.log
1 0 1 * * /opt/monitor/sql/backup_listenerlog.sh >> /opt/monitor/log/backup_listenerlog.log
0 9 * * 5 /home/oracle/sh/gather_stats.sh
*/10 * * * * /home/oracle/sh/get_vmstat.sh >> /home/oracle/log/vmstat.log
0 * * * * /home/oracle/sh/check_trace_dw.sh >> /home/oracle/log/check_trace_dw.log
0,30 * * * * /opt/monitor/sql/switchlog.sh >> /opt/monitor/log/switchlog.log
05 13 * * 5 /opt/monitor/sql/gather_stats.sh >> /opt/monitor/log/gather_stats.log
30 17 * * 2 /opt/monitor/sql/gather_stats_empty.sh >> /opt/monitor/log/gather_stats_empty.log
30 9 * * * /opt/monitor/sql/create_awrrpt.sh
##########AUTOEXTEND TABLESPACE CLIENT SHELL by jason 2011-08-11
#13 4 * * * /home/oracle/autoextend_ts/autoextend_ts.sh >> /home/oracle/autoextend_ts/autoextend_ts.log 2>&1

##################################################################################
## dailycheck --larry
##################################################################################
00 08 * * * sh /home/oracle/dailycheck/dailycheck_diskspace.sh
00 08 * * * sh /home/oracle/dailycheck/dailycheck_alertlog.sh
00 08 * * * sh /home/oracle/dailycheck/dailycheck_backup.sh
01 08 * * * sh /home/oracle/dailycheck/dailycheck_scp.sh


#################################################################################
## dm add
20 12 * * * sh /u01/report/sql/dwdailydatacheck.sh
##36 15 * * * sh /u01/report/sql/dwdailydatacheck.sh
##12 17 3 * * sh /u01/report/sql/data_check.sh
28 10 * * * sh /u01/report/sql/etl_report.sh
##12 12 * * * sh /u01/report/sql/data_check.sh

########################
#ASM disk header backup#
########################
0 3 * * * /opt/monitor/sql/asm_dh_backup_total.sh


######################
#clean archive log
######################
15 * * * * sh /home/oracle/scripts/clear_archi.sh


###########################################
## 回退方法 ##
###########################################

1.确保升级之前停机归档传输
alter system set log_archive_dest_state_4=defer;
2.如果在归档时间窗口不能完成升级,需要直接打开standby 使用
standby:
Alter DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
Alter DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
SHUTDOWN IMMEDIATE;
STARTUP
3.拷贝生产环境脚本至standby 主机
scp /u01/report.tar 192.168.1.203:/u01/
scp /opt/monitor.tar.20141208.gz 192.168.1.203:/opt/
scp /home/oracle/dailycheck.tar.20141208.gz 192.168.1.203:/home/oracle
scp /home/oracle/sh.tar.20141208 192.168.1.203:/home/oracle