11GR2 DATAGUARD环境下的DATABASE升级(11.2.0.2升级到11.2.0.3)(1)
http://luoping.blog.51cto.com/534596/988073
11GR2 DATAGUARD环境下的DATABASE升级(11.2.0.2升级到11.2.0.3)(2)
http://luoping.blog.51cto.com/534596/988108
11GR2 DATAGUARD环境下的DATABASE升级(11.2.0.2升级到11.2.0.3)(3)
http://luoping.blog.51cto.com/534596/988024
- 9.3 在升级前执行dbupgdiag脚本。
- 这个脚本可以检查很多的东西,如无效对象,用户,组件等。
- SQL> @/home/oracle/rs/sql/dbupgdiag.sql
- Enter location for Spooled output:
- Enter value for 1: /tmp/
- 这里我不CP输出内容,等升级成功后我们还得再执行一次这个脚本,那里会贴出输出内容。
- 9.4 在升级前执行utlu112i.sql
- 在升级一直执行一下这个脚本。在11G中安装数据库时默认就会有utlu11*.sql脚本,在以前的版本中
- 是没有这些脚本,要自己到metalink去下载的。如果是从10G到11G这种升级时,我们需要在10G的
- ORACLE_HOME执行一次这个脚本。
- SQL> @?/rdbms/admin/utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 09-11-2012 05:41:57
Script Version: 11.2.0.3.0 Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name: HTZ
--> version: 11.2.0.2.0
--> compatible: 11.2.0.0.0
--> blocksize: 8192
--> platform: Linux x86 64-bit
--> timezone file: V14
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 710 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 485 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
.
**********************************************************************
Flashback: ON
**********************************************************************
FlashbackInfo:
--> name: /u01/app/oracle/fast_recovery_area
--> limit: 4032 MB
--> used: 63 MB
--> size: 4032 MB
--> reclaim: 23.4375 MB
--> files: 8
WARNING: --> Flashback Recovery Area Set. Please ensure adequate disk space in recover
y areas before performing an upgrade.
.
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit database.
**********************************************************************
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
WARNING: --> "memory_target" needs to be increased to at least 436 MB
.
--> If Target Oracle is 64-Bit, refer here for Update Parameters:
WARNING: --> "memory_target" needs to be increased to at least 620 MB
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No obsolete parameters found. No changes are required
.
**********************************************************************
Components: [The following database components will be upgraded or installed]
**********************************************************************
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle Application Express [upgrade] VALID
... APEX will only be upgraded if the version of APEX in
... the target Oracle home is higher than the current one.
--> Oracle OLAP API [upgrade] VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Database contains INVALID objects prior to upgrade.
.... The list of invalid SYS/SYSTEM objects was written to
.... registry$sys_inv_objs.
.... The list of non-SYS/SYSTEM objects was written to
.... registry$nonsys_inv_objs.
.... Use utluiobj.sql after the upgrade to identify any new invalid
.... objects due to the upgrade.
.... USER PUBLIC has 8 INVALID objects.
.... USER CTXSYS has 1 INVALID objects.
.... USER SYS has 11 INVALID objects.
WARNING: --> Sync standby database prior to upgrade.
WARNING: --> Your recycle bin is turned on and currently contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior to upgrading
.... and your recycle bin is turned on, you may need to execute the command:
PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin is empty.
WARNING: --> Database contains schemas with objects dependent on DBMS_LDAP package.
.... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
.... USER APEX_030200 has dependent objects.
.
**********************************************************************
Recommendations
**********************************************************************
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;
**********************************************************************
Oracle recommends removing all hidden parameters prior to upgrading.
To view existing hidden parameters execute the following command
while connected AS SYSDBA:
SELECT name,description from SYS.V$PARAMETER WHERE name
LIKE '\_%' ESCAPE '\'
Changes will need to be made in the init.ora or spfile.
**********************************************************************
Oracle recommends reviewing any defined events prior to upgrading.
To view existing non-default events execute the following commands
while connected AS SYSDBA:
Events:
SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2
WHERE UPPER(name) ='EVENT' AND isdefault='FALSE'
Trace Events:
SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2
WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'
Changes will need to be made in the init.ora or spfile.
********************************************************************** - 9.5 执行catupgrd.sql升级脚本
- 执行完后会正常的关闭数据库
- SQL> spool /tmp/upgrade1.log
- SQL> @?/rdbms/admin/catupgrd.sql;
- ......................
- SQL> REM bug 12337546 - Exit current sqlplus session at end of catupgrd.sql.
- SQL> REM This forces user to start a new sqlplus session in order
- SQL> REM to connect to the upgraded db.
- 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
- #检查/tmp/upgrade1.log文件的内容,查看是否有报错。如果有错误,我们
- #可以再次执行catupgrd.sql这个脚本,执行再多次都可以。如果还不成功,
- #我们可以通过DBUA这个来执行,我有一次就是执行catupgrd.sql执行了3次
- #还是有部分组件升级失败,但是又没有报错,最后通过dbua来升级成功
- 9.6 正常启动数据库
- [oracle@11g ~]$ sqlplus / as sysdba
- SQL*Plus: Release 11.2.0.3.0 Production on Tue Sep 11 07:09:11 2012
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- Connected to an idle instance.
- SQL> startup
- ORACLE instance started.
- Total System Global Area 730714112 bytes
- Fixed Size 2231952 bytes
- Variable Size 721420656 bytes
- Database Buffers 4194304 bytes
- Redo Buffers 2867200 bytes
- Database mounted.
- Database opened.
- #查看数据库的状态
- SQL> select open_mode,log_mode,switchover_status,database_role,flashback_on from v$database;
- SQL>
- SQL> set lines 100
- SQL> select open_mode,log_mode,switchover_status,database_role,flashback_on from v$database;
- OPEN_MODE LOG_MODE SWITCHOVER_STATUS DATABASE_ROLE FLASHBACK_ON
- -------------------- ------------ -------------------- ---------------- ------------------
- READ WRITE ARCHIVELOG NOT ALLOWED PRIMARY YES
- 9.7 查看组件是否升级成功
- SQL> @?/rdbms/admin/utlu112s.sql
- .
- Oracle Database 11.2 Post-Upgrade Status Tool 09-11-2012 07:12:17
- .
- Component Current Version Elapsed Time
- Name Status Number HH:MM:SS
- .
- Oracle Server
- . VALID 11.2.0.3.0 00:16:26
- JServer JAVA Virtual Machine
- . VALID 11.2.0.3.0 00:03:01
- Oracle Workspace Manager
- . VALID 11.2.0.3.0 00:00:49
- OLAP Analytic Workspace
- . VALID 11.2.0.3.0 00:01:26
- OLAP Catalog
- . VALID 11.2.0.3.0 00:00:59
- Oracle OLAP API
- . VALID 11.2.0.3.0 00:01:01
- Oracle Enterprise Manager
- . VALID 11.2.0.3.0 00:03:50
- Oracle XDK
- . VALID 11.2.0.3.0 00:00:00
- Oracle Text
- . VALID 11.2.0.3.0 00:01:13
- Oracle XML Database
- . VALID 11.2.0.3.0 00:04:30
- Oracle Database Java Packages
- . VALID 11.2.0.3.0 00:00:34
- Oracle Multimedia
- . VALID 11.2.0.3.0 00:10:49
- Spatial
- . VALID 11.2.0.3.0 00:03:44
- Oracle Expression Filter
- . VALID 11.2.0.3.0 00:00:14
- Oracle Rules Manager
- . VALID 11.2.0.3.0 00:00:13
- Oracle Application Express
- . VALID 3.2.1.00.12
- Gathering Statistics
- . 00:02:39
- Total Upgrade Time: 00:51:40
- PL/SQL procedure successfully completed.
- 全部升级成功。这里也可以查看每个部件升级时所用的时间。我这里一共用了1个小时。
- 9.8 查看升级后的无效对象
- 由于我这里的无效对象太多,就不全部贴出了
- SQL> @?/rdbms/admin/utluiobj.sql
- .
- Oracle Database 11.1 Post-Upgrade Invalid Objects Tool 09-11-2012 07:13:39
- .
- This tool lists post-upgrade invalid objects that were not invalid
- prior to upgrade (it ignores pre-existing pre-upgrade invalid objects).
- .
- Owner Object Name Object Type
- .
- SYS ALL$OLAP2_AWS VIEW
- SYS ALL_ALL_TABLES VIEW
- SYS ALL_APPLY VIEW
- SYS ALL_APPLY_CHANGE_HANDLERS VIEW
- SYS ALL_APPLY_CONFLICT_COLUMNS VIEW
- SYS ALL_APPLY_DML_CONF_COLUMNS VIEW
- SYS ALL_APPLY_DML_CONF_HANDLERS VIEW
- SYS ALL_APPLY_DML_HANDLERS VIEW
- SYS ALL_APPLY_ENQUEUE VIEW
- SYS ALL_APPLY_ERROR VIEW
- SYS ALL_APPLY_ERROR_MESSAGES VIEW
- SYS ALL_APPLY_EXECUTE VIEW
- SYS ALL_APPLY_HANDLE_COLLISIONS VIEW
- [oracle@11g tmp]$ wc -l utluiobj.log
- 6124 utluiobj.log
- 9.9 执行catuppst.sql脚本
- SQL> @$ORACLE_HOME/rdbms/admin/catuppst.sql;
- TIMESTAMP
- ----------------------------------------------------------------------------------------------------
- COMP_TIMESTAMP POSTUP_BGN 2012-09-11 07:15:55
- PL/SQL procedure successfully completed.
- ...........................................
- 9.10 编译无效对象
- SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql;
- TIMESTAMP
- ------------------------------------------------------------------------------------------------------------------------------------------------------
- COMP_TIMESTAMP UTLRP_BGN 2012-09-11 07:29:36
- 1 row selected.
- DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
- DOC> objects in the database. Recompilation time is proportional to the
- DOC> number of invalid objects in the database, so this command may take
- DOC> a long time to execute on a database with a large number of invalid
- DOC> objects.
- DOC>
- DOC> Use the following queries to track recompilation progress:
- DOC>
- DOC> 1. Query returning the number of invalid objects remaining. This
- DOC> number should decrease with time.
- DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
- DOC>
- DOC> 2. Query returning the number of objects compiled so far. This number
- DOC> should increase with time.
- DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
- DOC>
- DOC> This script automatically chooses serial or parallel recompilation
- DOC> based on the number of CPUs available (parameter cpu_count) multiplied
- DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
- DOC> On RAC, this number is added across all RAC nodes.
- DOC>
- DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
- DOC> recompilation. Jobs are created without instance affinity so that they
- DOC> can migrate across RAC nodes. Use the following queries to verify
- DOC> whether UTL_RECOMP jobs are being created and run correctly:
- DOC>
- DOC> 1. Query showing jobs created by UTL_RECOMP
- DOC> SELECT job_name FROM dba_scheduler_jobs
- DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
- DOC>
- DOC> 2. Query showing UTL_RECOMP jobs that are running
- DOC> SELECT job_name FROM dba_scheduler_running_jobs
- DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
- DOC>#
- PL/SQL procedure successfully completed.
- TIMESTAMP
- ------------------------------------------------------------------------------------------------------------------------------------------------------
- COMP_TIMESTAMP UTLRP_END 2012-09-11 07:37:26
- 1 row selected.
- DOC> The following query reports the number of objects that have compiled
- DOC> with errors (objects that compile with errors have status set to 3 in
- DOC> obj$). If the number is higher than expected, please examine the error
- DOC> messages reported with each object (using SHOW ERRORS) to see if they
- DOC> point to system misconfiguration or resource constraints that must be
- DOC> fixed before attempting to recompile these objects.
- DOC>#
- OBJECTS WITH ERRORS
- -------------------
- 0
- 1 row selected.
- DOC> The following query reports the number of errors caught during
- DOC> recompilation. If this number is non-zero, please query the error
- DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
- DOC> are due to misconfiguration or resource constraints that must be
- DOC> fixed before objects can compile successfully.
- DOC>#
- ERRORS DURING RECOMPILATION
- ---------------------------
- 0
- 1 row selected.
- Function created.
- PL/SQL procedure successfully completed.
- Function dropped.
- PL/SQL procedure successfully completed.
到这里主库的升级就完成了。
修改log_archive_dest_state_2参数为enable
- SQL> alter system set log_archive_dest_state_2=enable;
- System altered.
- 从备库的alert日志中我们可以看到下面的输出
- Mon Sep 10 10:00:53 2012
- Using STANDBY_ARCHIVE_DEST parameter default value as /u01/app/oracle/arch/htz/
- ALTER SYSTEM SET log_archive_dest_state_2='RESET' SCOPE=BOTH;
- Mon Sep 10 10:04:12 2012
- Using STANDBY_ARCHIVE_DEST parameter default value as /u01/app/oracle/arch/htz/
- ALTER SYSTEM SET log_archive_dest_state_2='RESET' SCOPE=BOTH;
- ALTER SYSTEM SET log_archive_dest_2='service="htz"','LGWR SYNC AFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="htz" net_timeout=30','valid_for=(all_logfiles,primary_role)' SCOPE=BOTH;
- Using STANDBY_ARCHIVE_DEST parameter default value as /u01/app/oracle/arch/htz/
- ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=BOTH;
- ALTER SYSTEM ARCHIVE LOG
- Mon Sep 10 10:09:24 2012
- Primary database is in MAXIMUM AVAILABILITY mode
- Changing standby controlfile to RESYNCHRONIZATION level
- Standby controlfile consistent with primary
- RFS[4]: Assigned to RFS process 3958
- RFS[4]: Selected log 4 for thread 1 sequence 85 dbid 1848107928 branch 793318533
- Mon Sep 10 10:09:27 2012
- RFS[5]: Assigned to RFS process 3962
- RFS[5]: Selected log 5 for thread 1 sequence 84 dbid 1848107928 branch 793318533
- Mon Sep 10 10:09:30 2012
- Archived Log entry 96 added for thread 1 sequence 84 ID 0x6e2ccafb dest 1:
- RFS[5]: Opened log for thread 1 sequence 34 dbid 1848107928 branch 793318533
- Archived Log entry 97 added for thread 1 sequence 34 rlc 793318533 ID 0x6e2ccafb dest 2:
- Mon Sep 10 10:09:31 2012
- RFS[6]: Assigned to RFS process 3966
- RFS[6]: Opened log for thread 1 sequence 33 dbid 1848107928 branch 793318533
- Archived Log entry 98 added for thread 1 sequence 33 rlc 793318533 ID 0x6e2ccafb dest 2:
- Mon Sep 10 10:09:32 2012
- RFS[7]: Assigned to RFS process 3970
- RFS[7]: Opened log for thread 1 sequence 35 dbid 1848107928 branch 793318533
- RFS[6]: Opened log for thread 1 sequence 37 dbid 1848107928 branch 793318533
- RFS[5]: Opened log for thread 1 sequence 36 dbid 1848107928 branch 793318533
- Archived Log entry 99 added for thread 1 sequence 35 rlc 793318533 ID 0x6e2ccafb dest 2:
- Archived Log entry 100 added for thread 1 sequence 37 rlc 793318533 ID 0x6e2ccafb dest 2:
- RFS[7]: Opened log for thread 1 sequence 38 dbid 1848107928 branch 793318533
- Mon Sep 10 10:09:39 2012
- Archived Log entry 101 added for thread 1 sequence 36 rlc 793318533 ID 0x6e2ccafb dest 2:
- Archived Log entry 102 added for thread 1 sequence 38 rlc 793318533 ID 0x6e2ccafb dest 2:
- RFS[6]: Opened log for thread 1 sequence 39 dbid 1848107928 branch 793318533
- RFS[7]: Opened log for thread 1 sequence 41 dbid 1848107928 branch 793318533
- RFS[5]: Opened log for thread 1 sequence 40 dbid 1848107928 branch 793318533
- Mon Sep 10 10:09:46 2012
- Archived Log entry 103 added for thread 1 sequence 41 rlc 793318533 ID 0x6e2ccafb dest 2:
- Mon Sep 10 10:09:46 2012
- Archived Log entry 104 added for thread 1 sequence 39 rlc 793318533 ID 0x6e2ccafb dest 2:
本文转自7343696 51CTO博客,原文链接:http://blog.51cto.com/luoping/988108,如需转载请自行联系原作者