SQL Script to find the top 50 tables by size

Here is a SQL to identify the top 50 tables. When I say table, it could be a table, partitioned table or materialized view. Takes into consideration the indexes defined on the table and lob segments in the table, thus gives a complete picture of the table size. When you truncate the table, this much … Read more

Script to Grant Privileges and Create Synonyms

Extending the previous post Granting privileges on all or multiple objects to user/role , here is another script. Often we have a requirement to create read only accounts for a schema. Typically these accounts are named _QUERY. The script when executed will prompt for the user name of the read only account, and the schema name where … Read more

Granting privileges on all or multiple objects to user/role

Granting privileges on all or multiple objects to user/role Question:I need to grant SELECT, UPDATE privilege on all tables owned by schema XXVMX to users MSUBBU, SMARTIN. Is there a command in Oracle to grant a privilege on all objects in schema to user? Answer:No such privilege in Oracle. You will have to write a … Read more

Script to Refresh Materialized Views

The following script can be used to refresh materialized views that are capable of FAST (incremental) refresh automatically. Can be used on EBS database as well if you un-comment the commented (REM) lines. The refresh criteria used is any fast refresh-able materialized view that has not been refreshed in the past 24 hours, but was refreshed in … Read more

Query – Tablespace Max Size

I sometimes see concerned emails from developers that they are running out of space in tablespace and the DBA need to do something immediately. The DBA will start wondering we have monitoring in place, then how come it did not catch an out of space situation, but a user/developer did… For you developer/user, if you … Read more

Rename Diskgroup in ASM

Rename ASM Diskgroup [11gR2] In 11gR2 it is possible to rename an ASM diskgroup. This is especially useful when performing database copy using OS level LUN mirroring technologies. The renamedg command is used to rename diskgroups. It has the following options: $ renamedg -help Parsing parameters.. phase                           Phase to execute,                                 (phase=ONE|TWO|BOTH), default BOTH dgname                          … Read more

Oracle11gR1 – To Read…

 Database Replay – OTN  Documentation  Interval and Reference Partitions – Paper   Documentation  SQL Query Result Cache – OTN   Documentation SQL Performance Analyzer – OTN Documentation  SQL Plan Baseline – OTN  Documentation Automatic SQL Tuning Enhancements – Documentation Snapshot Standby – Documentation Active Data Guard (Real-time query) – Documentation OLTP Table Compression – OTN-OOW   Documentation AutoTask Infrastructure … Read more

Passwords are Case Sensitive in Oracle11g

The passwords in Oracle11g are case sensitive. All new users created in the 11g database have case sensitive password by default. For databases upgraded from earlier releases, the passwords are not case sensitive for existing accounts. They become case sensitive when you change password. A new column PASSWORD_VERSIONS is added to DBA_USERS view. A value … Read more