Friday, August 24, 2012
Oracle Discoverer report usage stats
How to find the Oracle Discoverer reports usage stats:
/* Query a specific user's report run history */
SELECT A.QS_CREATED_DATE,
B.user_name,
QS_DOC_NAME,
QS_DOC_DETAILS
FROM appseul_tr.EUL4_qpp_stats a, fnd_user b
WHERE QS_CREATED_DATE > TO_DATE ('07 10 28 05 2012', 'hh mi DD MM YYYY')
AND SUBSTR (a.QS_CREATED_BY, 2, LENGTH (a.QS_CREATED_BY)) = B.USER_ID
AND user_name = '&USER_NAME'
ORDER BY a.QS_CREATED_DATE DESC
/* How many times a discovere report is run and how much does it take */
SELECT a.qs_doc_owner Owner,
a.qs_doc_name Workbook,
a.qs_doc_details Worksheet,
trunc(AVG (a.QS_ACT_ELAP_TIME) ) duration,
COUNT (*) run_count, trunc(avg(QS_ACT_CPU_TIME)) CPUTime
FROM APPSEUL.eul4_qpp_stats a, APPSEUL.eul4_documents b
WHERE a.qs_created_date between '01-JUN-2012' and '30-JUN-2012'
AND a.qs_doc_name = b.doc_name
GROUP BY a.qs_doc_owner, a.qs_doc_name, a.qs_doc_details
ORDER BY duration DESC;
Tuesday, June 26, 2012
Upgrade 11.2.0.2 RAC Database to 11.2.0.3 manually
How to upgrade 11.2.0.2 ORACLE RAC Database to 11.2.0.3 manually
System detail:
2 server with Red hat Enterprise Linux 5.5
Oracle RAC database + ASM is installed 11.2.0.2 with no PSU applied. (11.2.0.2.0)
GoldenGate is used with this system to another 11.2.0.3 RAC database
I upgrade the 2 node Oracle RAC system from 11.2.0.2 to 11.2.0.3 in 4 main steps:
1. Apply patch 11.2.0.2.6 PSU to both GI (Grid Infrastructure) and database.
2. Upgrade GI to 11.2.0.3 and apply 11.2.0.3.2 PSU with software only mode.
3. Upgrade database to 11.2.0.3.
4. Apply 11.2.0.3.2 PSU to db only.
1. Apply patch 11.2.0.2.6 PSU to both GI (Grid Infrastructure) and database.
Actually applying PSU to 11.2.0.2 is not a prerequisite for 11.2.0.3 upgrade. However there are many bugs related to upgrade process and I want to play it safe.
The patch 13696242 includes both GI and database PSU.
If you use GoldenGate in this system, first of all, you have to disable ddl_trigger and stop the GoldenGate services
[oraem@mrctst1 gg]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.FRALOG.dg
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.LISTENER.lsnr
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.VOTING.dg
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.asm
ONLINE ONLINE mrctst1 Started
ONLINE ONLINE mrctst2
ora.gsd
OFFLINE OFFLINE mrctst1
OFFLINE OFFLINE mrctst2
ora.net1.network
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.ons
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.registry.acfs
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ggateapp
1 ONLINE ONLINE mrctst1
mvggatevip
1 ONLINE ONLINE mrctst1
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE mrctst2
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE mrctst1
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE mrctst1
ora.cvu
1 ONLINE ONLINE mrctst1
ora.mrctst.db
1 ONLINE ONLINE mrctst1 Open
2 ONLINE ONLINE mrctst2 Open
ora.mrctst1.vip
1 ONLINE ONLINE mrctst1
ora.mrctst2.vip
1 ONLINE ONLINE mrctst2
ora.oc4j
1 ONLINE ONLINE mrctst1
ora.scan1.vip
1 ONLINE ONLINE mrctst2
ora.scan2.vip
1 ONLINE ONLINE mrctst1
ora.scan3.vip
1 ONLINE ONLINE mrctst1
sql> @ddl_disable
This is also necessary for applying patches to Oracle database. It may cause fail to apply patch.
$ emctl stop agent or dbconsole
Opatch version must be 11.2.0.1.5 or later.
Unzip p13696242_112020_Linux-x86-64.zip on both nodes.
./opatch lsinventory -detail -oh $GI_HOME
./opatch lsinventory -detail -oh $DB_HOME
# /u01/app/11.2.0/grid11203/rootupgrade.sh
And GI upgarde is finished with PSU installed (11.2.0.3.2), continue to next section db upgarde...
3. Upgrade database to 11.2.0.3 manually .
** It is not recommended to use dbua while upgrading a business critical database. So I upgrade the database manually
$ mkdir NEW_DB_HOME
This is not an optional section for manual db upgrade, it is a must.
Download latest version of this script and run: Note 884522.1
SQL> SPOOL upgrade_info.log
SQL> @$11g_ORACLE_HOME/rdbms/admin/utlu112i.sql
SQL> SPOOL OFF
sample run:
Miscellaneous Warnings
**********************************************************************
WARNING: --> The "cluster_database" parameter is currently "TRUE"
.... and must be set to "FALSE" prior to running a manual upgrade.
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 XXXX has 2 INVALID objects.
.... USER XX has 2 INVALID objects.
.... USER XXX has 26 INVALID objects.
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 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.
Analyze every item and fix the warnings.
SQL> SELECT * FROM v$recover_file;
no rows selected
SQL> SELECT * FROM v$backup WHERE status != 'NOT ACTIVE';
no rows selected
SQL> SELECT * FROM dba_2pc_pending;
no rows selected
SQL> PURGE dba_recyclebin;
DBA Recyclebin purged.
SQL> create pfile='/u01/app/oracle/product/11.2.0/pfilerac_orj.ora' from spfile;
set cluster database parameter to false and change the paths to new DB_HOME directories.
Copy password file and tnsnames.ora and other needed parameter files to new ORACLE_HOME on both nodes.
SQL> startup upgrade pfile='/u01/app/oracle/product/11.2.0/pfilerac.ora';
SQL> SPOOL upgrade2.log
SQL> @?/rdbms/admin/catupgrd.sql
.....
SQL> SPOOL OFF
It took 40 minutes to upgrade my 600 Gb database.
System detail:
2 server with Red hat Enterprise Linux 5.5
Oracle RAC database + ASM is installed 11.2.0.2 with no PSU applied. (11.2.0.2.0)
GoldenGate is used with this system to another 11.2.0.3 RAC database
I upgrade the 2 node Oracle RAC system from 11.2.0.2 to 11.2.0.3 in 4 main steps:
1. Apply patch 11.2.0.2.6 PSU to both GI (Grid Infrastructure) and database.
2. Upgrade GI to 11.2.0.3 and apply 11.2.0.3.2 PSU with software only mode.
3. Upgrade database to 11.2.0.3.
4. Apply 11.2.0.3.2 PSU to db only.
1. Apply patch 11.2.0.2.6 PSU to both GI (Grid Infrastructure) and database.
Actually applying PSU to 11.2.0.2 is not a prerequisite for 11.2.0.3 upgrade. However there are many bugs related to upgrade process and I want to play it safe.
The patch 13696242 includes both GI and database PSU.
If you use GoldenGate in this system, first of all, you have to disable ddl_trigger and stop the GoldenGate services
- List all services:
[oraem@mrctst1 gg]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.FRALOG.dg
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.LISTENER.lsnr
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.VOTING.dg
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.asm
ONLINE ONLINE mrctst1 Started
ONLINE ONLINE mrctst2
ora.gsd
OFFLINE OFFLINE mrctst1
OFFLINE OFFLINE mrctst2
ora.net1.network
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.ons
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
ora.registry.acfs
ONLINE ONLINE mrctst1
ONLINE ONLINE mrctst2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ggateapp
1 ONLINE ONLINE mrctst1
mvggatevip
1 ONLINE ONLINE mrctst1
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE mrctst2
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE mrctst1
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE mrctst1
ora.cvu
1 ONLINE ONLINE mrctst1
ora.mrctst.db
1 ONLINE ONLINE mrctst1 Open
2 ONLINE ONLINE mrctst2 Open
ora.mrctst1.vip
1 ONLINE ONLINE mrctst1
ora.mrctst2.vip
1 ONLINE ONLINE mrctst2
ora.oc4j
1 ONLINE ONLINE mrctst1
ora.scan1.vip
1 ONLINE ONLINE mrctst2
ora.scan2.vip
1 ONLINE ONLINE mrctst1
ora.scan3.vip
1 ONLINE ONLINE mrctst1
- Stop GoldenGate services
crsctl stop res ggateapp |
crsctl stop res mvggatevip
$ sqlplus / as sysdba |
sql> @ddl_disable
- Stop Grid agent or dbconsole:
This is also necessary for applying patches to Oracle database. It may cause fail to apply patch.
$ emctl stop agent or dbconsole
- Unzip latest opatch to both GI and Db homes:
Opatch version must be 11.2.0.1.5 or later.
- Unzip PSU zip file:
Unzip p13696242_112020_Linux-x86-64.zip on both nodes.
- Validation of oracle Inventory:
./opatch lsinventory -detail -oh $GI_HOME
./opatch lsinventory -detail -oh $DB_HOME
- Check for any conflict:
- After installing 11.2.0.3.2 PSU run rootupgrade.sh for each node as runInstaller wants.
# /u01/app/11.2.0/grid11203/rootupgrade.sh
- Click continue on runInstaller and finish it.
- Check for GI version
$ crsctl query crs activeversion |
And GI upgarde is finished with PSU installed (11.2.0.3.2), continue to next section db upgarde...
3. Upgrade database to 11.2.0.3 manually .
** It is not recommended to use dbua while upgrading a business critical database. So I upgrade the database manually
- create new DB_HOME directories:
$ mkdir NEW_DB_HOME
- Launch runInstaller and install database as "software only":
- Use pre-upgrade information tool:
This is not an optional section for manual db upgrade, it is a must.
Download latest version of this script and run: Note 884522.1
SQL> SPOOL upgrade_info.log
SQL> @$11g_ORACLE_HOME/rdbms/admin/utlu112i.sql
SQL> SPOOL OFF
sample run:
Miscellaneous Warnings
**********************************************************************
WARNING: --> The "cluster_database" parameter is currently "TRUE"
.... and must be set to "FALSE" prior to running a manual upgrade.
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 XXXX has 2 INVALID objects.
.... USER XX has 2 INVALID objects.
.... USER XXX has 26 INVALID objects.
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 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.
Analyze every item and fix the warnings.
- Apply the following scripts:
SQL> SELECT * FROM v$recover_file;
no rows selected
SQL> SELECT * FROM v$backup WHERE status != 'NOT ACTIVE';
no rows selected
SQL> SELECT * FROM dba_2pc_pending;
no rows selected
SQL> PURGE dba_recyclebin;
DBA Recyclebin purged.
- Prepare the new home:
- create pfile from spfile and remove cluster parameters:
SQL> create pfile='/u01/app/oracle/product/11.2.0/pfilerac_orj.ora' from spfile;
set cluster database parameter to false and change the paths to new DB_HOME directories.
- Copy parameter files from old_db_home to new_db_home
Copy password file and tnsnames.ora and other needed parameter files to new ORACLE_HOME on both nodes.
- stop databases runing from old home:
srvctl stop database -d ractest |
- Check the environment ORACLE_HOME for pointing to new DB_HOME.
- startup the database with upgrade mode from new home:
SQL> startup upgrade pfile='/u01/app/oracle/product/11.2.0/pfilerac.ora';
- run catalog upgrade script: (Before start, check the archive log location for enough free space)
SQL> SPOOL upgrade2.log
SQL> @?/rdbms/admin/catupgrd.sql
.....
SQL> SPOOL OFF
It took 40 minutes to upgrade my 600 Gb database.
- After upgrade create spfile with original pfile;
- Run post-upgrade status tool:
SQL> @utlu112s.sql |
|
Subscribe to:
Posts (Atom)