一套ORACLE11G DG环境打补丁
############## apply patch前备份工作 ###############
lsnrctl stop
sqlplus / as sysdba;
shutdown immediate;
startup;
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup AS COMPRESSED BACKUPSET format 'E:\rmanback\gzxnh_full_%T_%d_%s_%p_%u.dbf' database plus archivelog;
sql "ALTER SYSTEM switch logfile";
sql "ALTER SYSTEM switch logfile";
sql "ALTER SYSTEM switch logfile";
backup current controlfile format 'E:\rmanback\controlfile_%T_%U_%t.crl';
release channel c1;
release channel c2;
}
############### apply patth前备库复制工作检查 ############
主库:
lsnrctl stop
sqlplus / as sysdba;
shutdown immediate;
startup;
create table test0407(id number(4));
备库:
查看备库是否有数据应用,到没有变化再关闭数据库
sqlplus / as sysdba;
desc test0407;
select process,status,thread#,sequence#,block#,blocks from v$managed_standby;
lsnrctl stop
sqlplus / as sysdba;
alter database recover managed standby database cancel;
shutdown immediate;
###############主库apply patch ####################
1、数据库补丁检查
%ORACLE_HOME%/OPatch/opatch lsinventory
2、关闭数据库和监听
lsnrctl stop
sqlplus / as sysdba;
shutdown immediate;
3、apply patch
set ORACLE_HOME=
cd 13423278
opatch apply
4、验证patch
%ORACLE_HOME%/OPatch/opatch lsinventory
5、启动数据库和监听
lsnrctl start
sqlplus / as sysdba;
startup;
6、Loading Modified .sql Files into the Database
> cd %ORACLE_HOME%\Bundle\Patch16
> sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> spool catcpu0407.log
SQL> @catcpu.sql
SQL> QUIT
7、检查日志
$ORACLE_HOME/cfgtoollogs/catbundle
catbundle_WINBUNDLE__APPLY_.log
catbundle_WINBUNDLE__GENERATE_.log
8、编译无效对象
> cd %ORACLE_HOME%\rdbms\admin
> sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
To check for invalid objects, execute the following statement:
SQL> SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID';
###############备库apply patch ####################
1、数据库补丁检查
%ORACLE_HOME%/OPatch/opatch lsinventory
2、关闭数据库和监听
lsnrctl stop
sqlplus / as sysdba;
shutdown immediate;
3、apply patch
set ORACLE_HOME=
cd 13423278
opatch apply
4、检查patch
%ORACLE_HOME%/OPatch/opatch lsinventory
############启动备库,观察DG是否正常############
lsnrctl start
startup nomount;
alter database mount standby database;
alter database open read only;
alter database recover managed standby database using current logfile disconnect from session;
select process,status,thread#,sequence#,block#,blocks from v$managed_standby;
##########测试DG复制是否正常#######
主库
sqlplus / as sysdba;
insert into test0407 values(2222)
commit;
备库
sqlplus / as sysdba;
select * from test0407;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27571661/viewspace-2085212/,如需转载,请注明出处,否则将追究法律责任。