Friday, June 24, 2011

CATPROC - Packages and Types Invalid in Dba_registry


When i looked in to the DBA_REGISTRY, I found that the Oracle Database Packages and Types Column in the Table is in INVALID  state.

I had this problem after my database has been upgraded from Oracle 10gR2 to 11gR2.

SQL> select substr(comp_name,1,30) comp_name, substr(comp_id,1,10)
      comp_id,substr(version,1,12) version,status from dba_registry;
  2
COMP_NAME                      COMP_ID    VERSION      STATUS
------------------------------ ---------- ------------ -----------
Oracle XML Database            XDB        11.2.0.2.0   VALID
Oracle Expression Filter       EXF        11.2.0.2.0   VALID
Oracle Rule Manager            RUL        11.2.0.2.0   VALID
Oracle Workspace Manager       OWM        11.2.0.2.0   VALID
Oracle Database Catalog Views  CATALOG    11.2.0.2.0   VALID
Oracle Database Packages and T CATPROC    11.2.0.2.0   INVALID
JServer JAVA Virtual Machine   JAVAVM     11.2.0.2.0   VALID
Oracle XDK                     XML        11.2.0.2.0   VALID
Oracle Database Java Packages  CATJAVA    11.2.0.2.0   VALID

9 rows selected.


Causes:
The probable causes for dba_registry components became invalid could be any of the following.

·                     Applied a patch and after the patch application because of some dependent object status change registry can become invalid
·                     Installed a new component and the new component installation got failed then registry components could become invalid
·                     catalog.sql or catproc.sql was not successfully ran after database creation. Any of them would have failed somewhere or any of the dependent object got invalid afterward

You can try the below steps to validate if you don’t have any invalid object in the database
SQL> select count(*) from dba_objects where status=’INVALID’;
COUNT(*)
———-
0
SQL> exec DBMS_REGISTRY_SYS.VALIDATE_CATPROC;
If you have any invalid objects in the database then follow the below steps
SQL> SQL> select count(*) from dba_objects where status='INVALID';

  COUNT(*)
----------
       449

1 row selected.

'Packages and Types' can usually be validated by running catalog and catproc scripts:
$sqlplus "/as sysdba"
SQL> startup restrict
SQL > @?/rdbms/admin/catalog.sql
SQL > @?/rdbms/admin/catproc.sql
SQL > @?/rdbms/admin/utlrp.sql


SQL> select substr(comp_name,1,30) comp_name, substr(comp_id,1,10)
      comp_id,substr(version,1,12) version,status from dba_registry;
  2
COMP_NAME                                COMP_ID    VERSION      STATUS
---------------------------------------- ---------- ------------ -----------
Oracle XML Database                      XDB        11.2.0.2.0   VALID
Oracle Expression Filter                 EXF        11.2.0.2.0   VALID
Oracle Rule Manager                      RUL        11.2.0.2.0   VALID
Oracle Workspace Manager                 OWM        11.2.0.2.0   VALID
Oracle Database Catalog Views            CATALOG    11.2.0.2.0   VALID
Oracle Database Packages and T           CATPROC    11.2.0.2.0   VALID
JServer JAVA Virtual Machine             JAVAVM     11.2.0.2.0   VALID
Oracle XDK                               XML        11.2.0.2.0   VALID
Oracle Database Java Packages            CATJAVA    11.2.0.2.0   VALID

9 rows selected.

Shutdown your database in the normal mode and startup with the normal mode.

Hope the above document help you in solving the issue.

Monday, June 13, 2011

RMAN: Need recovery catalog for creating scripts in RMAN



When i try to create scripts in RMAN with out  Recovery catalog, RMAN is not allowing to create with it.
you need recovery catalog to create scripts in it.

$rman target / nocatalog

Recovery Manager: Release 11.2.0.2.0 - Production on Mon Jun 13 14:00:46 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: OMNIX (DBID=3688465868)
using target database control file instead of recovery catalog

RMAN> create script b1{
2> allocate channel c1 DEVICE TYPE sbt;
3> BACKUP DATAFILE 10;
4> }

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of create script command at 06/13/2011 14:01:09
RMAN-06002: command not allowed when not connected to a recovery catalog

RMAN>


Now i am creating Recovery catalog with in the same user

CREATE A CATALOG FOR THE RMAN.

Step : 1  Create a DB by any name preferred as ‘catalog’
Step : 2   Create a Tablespace by name ´rman’ and allocate 500 MB space
Step : 3   Create a user name called rman and grant connect, resource and recovery_catalog_owner.
Step : 4  Put the Tnsnames of the target DB in the catalog server and put the catalog tnsnames in the Target server
Step : 5 In the catalog DB
$ Rman target sys/oracle catalog rman/rman @catalog
RMAN> create catalog, ( Only once )
RMAN> register database;
Step 6: When you connect to the catalog DB
$ Rman target sys/oracle  catalog rman/rman@catalog

 

Create a new database for RMAN – Recovery catalog database

Note: You can create a small database with minimal sizes of tablespaces and others, and you can name the database as CATDB for naming convention and to avoid the confusion between your production and rman databases.

Create a new tablespace in the new database (CATDB)



CREATE TABLESPACE rman
DATAFILE '/u02/app/oradata/rman/rman01.dbf' size 100m;

Create the Recovery Catalog Owner in the new database (OMNIX)

CREATE USER rman IDENTIFIED BY rman
DEFAULT TABLESPACE rman
QUOTA UNLIMITED ON rman;

Grant the necessary privileges to the schema owner

SQL> GRANT connect, resource, recovery_catalog_owner TO rman;

Here the role "RECOVERY_CATALOG_OWNER" provides the user with all privileges required to maintain and query the recovery catalog

Creating the Recovery Catalog

Connect to the database which will contain the catalog as the catalog owner. For example:
$ rman catalog rman/passwd@omnix
Recovery Manager: Release 11.2.0.2.0 - Production on Mon Jun 13 14:00:46 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to recovery catalog database
RMAN>

Run the CREATE CATALOG command to create the catalog

RMAN> CREATE CATALOG;

recovery catalog created

Registering a Database in the Recovery Catalog

Connect to the target database and recovery catalog database.

$ ORACLE_SID=OMNIX; export ORACLE_SID

$ rman target / catalog rman/rman



Recovery Manager: Release 11.2.0.2.0 - Production on Mon Jun 13 14:06:46 2011


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


connected to target database: OMNIX (DBID=3688465868)
connected to recovery catalog database


RMAN> REGISTER DATABASE;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

Make sure that the registration was successful by running REPORT SCHEMA:



RMAN> create script b{
2> allocate channel c1 DEVICE TYPE sbt;
3> BACKUP DATAFILE 10;
4> }

created script b

Please find the list of RECOVERY CATALOG views

Recovery Catalog ViewCorresponding V$ ViewCatalog View Describes ...
V$ARCHIVED_LOG
Archived and unarchived redo logs
V$BACKUP_DATAFILE
Control files in backup sets
V$BACKUP_CORRUPTION
Corrupt block ranges in datafile backups
V$BACKUP_DATAFILE
Datafiles in backup sets
V$BACKUP_FILES
RMAN backups and copies known to the repository.
V$BACKUP_PIECE
Backup pieces
V$BACKUP_REDOLOG
Archived redo logs in backup sets
V$BACKUP_SET
Backup sets for all incarnations of the database
V$BACKUP_SPFILE
Server parameter files in backups

Deprecated in favor of RC_RESYNC
V$DATAFILE_COPY
Control file copies on disk
V$COPY_CORRUPTION
Corrupt block ranges in datafile copies
V$DATABASE
Databases registered in the recovery catalog
V$DATABASE_BLOCK_CORRUPTION
Database blocks marked as corrupted in the most recent RMAN backup or copy
V$DATABASE_INCARNATION
Database incarnations registered in the recovery catalog
V$DATAFILE
Datafiles registered in the recovery catalog
V$DATAFILE_COPY
Datafile copies on disk
V$LOG_HISTORY
Online redo log history indicating when log switches occurred
V$OFFLINE_RANGE
Offline ranges for datafiles
V$PROXY_ARCHIVEDLOG
Archived log backups taken with the proxy copy functionality
V$PROXY_DATAFILE
Control file backups taken with the proxy copy functionality
V$PROXY_DATAFILE
Datafile backups that were taken using the proxy copy functionality
V$LOG and V$LOGFILE
Online redo logs for all incarnations of the database since the last catalog resynchronization
V$THREAD
All redo threads for all incarnations of the database since the last catalog resynchronization
n/a
Recovery catalog resynchronizations
V$RMAN_CONFIGURATION
RMAN configuration settings
V$RMAN_STATUS
Historical status information about RMAN operations.
n/a
Names of scripts stored in the recovery catalog
n/a
Contents of the scripts stored in the recovery catalog
V$TABLESPACE
All tablespaces registered in the recovery catalog, all dropped tablespaces, and tablespaces that belong to old incarnations

Thursday, June 9, 2011

ORA-01274----> RENAME THE UNKNOW FILE IN THE STANDBY DATABASE


RENAME THE UNKNOW FILE IN THE STANDBY DATABASE WHEN YOU PUT THE STANDBY_FILE_MANAGEMENT IN MANUAL MODE

ALERT LOG:-
File #45 added to control file as 'UNNAMED045' because
the parameter STANDBY_FILE_MANAGEMENT is set to MANUAL
The file should be manually created to continue.
Errors with log /oracle/BHUVAN/archive/10G_BHUVAN_660003944_1_257734.arc
MRP0: Background Media Recovery terminated with error 1274
Sat Sep 25 07:22:47 2010
Errors in file /oracle/BHUVAN/home/admin/BHUVAN/bdump/BHUVAN_mrp0_24491.trc:
ORA-01274: cannot add datafile '/oracle/BHUVAN/user02.dbf' - file could not be created
Some recovered datafiles maybe left media fuzzy
Media recovery may continue but open resetlogs may fail
Sat Sep 25 07:22:50 2010
Errors in file /oracle/BHUVAN/home/admin/BHUVAN/bdump/BHUVAN_mrp0_24491.trc:
ORA-01274: cannot add datafile '/oracle/BHUVAN/user02.dbf' - file could not be created
Sat Sep 25 07:22:50 2010
MRP0: Background Media Recovery process shutdown (BHUVAN)


----File #45 added to control file as 'UNNAMED045' because

select FNNAM,FNONM from x$kccfn where FNFNO=45;
/oracle/BHUVAN/home/product/10.2.0.4/dbs/UNNAMED045
/oracle/BHUVAN/user02.dbf


alter database create datafile '/oracle/BHUVAN/home/product/10.2.0.4/dbs/UNNAMED04554' as '/oracle/BHUVAN/user02.dbf';

alter database datafile 45 online;

if you are going make  standby_file_management as "AUTO in the init parameter. oracle will use the db_file_name_convert option to put the files in the respective directory in the standby database.

AUDITING: System Privilege



To Audit a System Privilege


A system privilege is the right to perform a particular action or to perform an action on any schema objects of a particular type. For example, the privileges to create tablespaces and to delete the rows of any table in a database are system privileges. There are over 100 distinct system privileges. Each system privilege allows a user to perform a particular database operation or class of database operations. Remember that
system privileges are very powerful. Only grant them when necessary to roles and trusted users of the database.


To Audit a system privilege
SQL> audit create user, alter user, drop user by system,bhuvan;

Audit succeeded.
Note: When you doesn't specify the username, it will take it as SYSTEM schema name.

SQL> conn bhuvan
Enter password:
Connected.
SQL> drop user a cascade;

User dropped.

SQL> alter user b identified by b;

User altered.

SQL> conn / as sysdba
Connected.


-- To Find the current system privileges being audited across the system and by user

SQL> col user_name format a7
SQL> col privilege format a25
SQL> col PROXY_NAME format a5

SQL> select * from sys.dba_priv_audit_opts;
USER_NA PROXY PRIVILEGE                 SUCCESS    FAILURE
------- ----- ------------------------- ---------- ----------
BHUVAN        DROP ANY INDEX            BY ACCESS  BY ACCESS
BHUVAN        CREATE ANY TABLE          BY ACCESS  BY ACCESS
BHUVAN        CREATE TABLE              BY ACCESS  BY ACCESS
BHUVAN        DROP USER                 BY ACCESS  BY ACCESS
SYSTEM        DROP USER                 BY ACCESS  BY ACCESS
BHUVAN        ALTER USER                BY ACCESS  BY ACCESS
SYSTEM        ALTER USER                BY ACCESS  BY ACCESS
BHUVAN        CREATE USER               BY ACCESS  BY ACCESS
SYSTEM        CREATE USER               BY ACCESS  BY ACCESS


Note: I have removed the entry which are not audited by any users 

To know the descriptions for audit trail action type codes

SQL> desc AUDIT_ACTIONS
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ACTION                                    NOT NULL NUMBER
 NAME                                      NOT NULL VARCHAR2(28)

SQL> select * from AUDIT_ACTIONS;

    ACTION NAME
---------- ----------------------------
         0 UNKNOWN
         1 CREATE TABLE
         2 INSERT
         3 SELECT
         4 CREATE CLUSTER
         5 ALTER CLUSTER
         6 UPDATE
         7 DELETE
         8 DROP CLUSTER
         9 CREATE INDEX
        10 DROP INDEX
............................
      219 ALTER FLASHBACK ARCHIVE
       220 DROP FLASHBACK ARCHIVE
       225 ALTER DATABASE LINK
       305 ALTER PUBLIC DATABASE LINK
180 rows selected.


To Find the audit action code for USER related privileges

SQL> select * from AUDIT_ACTIONS where name like '%USER%';

    ACTION NAME
---------- ----------------------------
        43 ALTER USER
        51 CREATE USER
        53 DROP USER
       117 USER COMMENT
       197 PURGE USER_RECYCLEBIN

To Read the audit information from Audit Table

SQL> col USERNAME format a7
SQL> col USERHOST format a15
SQL> col OBJ_NAME format a10
SQL> COL RETURNCODE format 99
SQL> col PRIV_USED format a10
SQL> col EXTENDED_TIMESTAMP format a35
SQL> set linesize 10000

 SQL> select USERNAME,USERHOST,EXTENDED_TIMESTAMP,OBJ_NAME, ACTION_NAME,RETURNCODE,PRIV_USED from dba_audit_trail where ACTION in(43,51,53);

USERNAM USERHOST        EXTENDED_TIMESTAMP                  OBJ_NAME   ACTION_NAME                  RETURNCODE PRIV_USED
------- --------------- ----------------------------------- ---------- ---------------------------- ---------- ----------
BHUVAN  cnbas-ldom-022  08-JUN-11 02.31.16.913957 PM +01:00 A          DROP USER                             0 DROP USER
BHUVAN  cnbas-ldom-022  08-JUN-11 02.31.32.604636 PM +01:00 B          ALTER USER                            0 ALTER USER

SQL>


Find the output system privileges that can be audited in the Oracle database(11gR2)


SQL> select * from system_privilege_map;

 PRIVILEGE NAME                                       PROPERTY
---------- ---------------------------------------- ----------
        -3 ALTER SYSTEM                                      0
        -4 AUDIT SYSTEM                                      0
        -5 CREATE SESSION                                    0
        -6 ALTER SESSION                                     0
        -7 RESTRICTED SESSION                                0
       -10 CREATE TABLESPACE                                 0
       -11 ALTER TABLESPACE                                  0
       -12 MANAGE TABLESPACE                                 0
       -13 DROP TABLESPACE                                   0
       -15 UNLIMITED TABLESPACE                              0
       -20 CREATE USER                                       0
       -21 BECOME USER                                       0
       -22 ALTER USER                                        0
       -23 DROP USER                                         0
       -30 CREATE ROLLBACK SEGMENT                           0
       -31 ALTER ROLLBACK SEGMENT                            0
       -32 DROP ROLLBACK SEGMENT                             0
       -40 CREATE TABLE                                      0
       -41 CREATE ANY TABLE                                  0
       -42 ALTER ANY TABLE                                   0
       -43 BACKUP ANY TABLE                                  0
       -44 DROP ANY TABLE                                    0
       -45 LOCK ANY TABLE                                    0
       -46 COMMENT ANY TABLE                                 0
       -47 SELECT ANY TABLE                                  0
       -48 INSERT ANY TABLE                                  0
       -49 UPDATE ANY TABLE                                  0
       -50 DELETE ANY TABLE                                  0
       -60 CREATE CLUSTER                                    0
       -61 CREATE ANY CLUSTER                                0
       -62 ALTER ANY CLUSTER                                 0
       -63 DROP ANY CLUSTER                                  0
       -71 CREATE ANY INDEX                                  0
       -72 ALTER ANY INDEX                                   0
       -73 DROP ANY INDEX                                    0
       -80 CREATE SYNONYM                                    0
       -81 CREATE ANY SYNONYM                                0
       -82 DROP ANY SYNONYM                                  0
       -83 SYSDBA                                            0
       -84 SYSOPER                                           0
       -85 CREATE PUBLIC SYNONYM                             0
       -86 DROP PUBLIC SYNONYM                               0
       -90 CREATE VIEW                                       0
       -91 CREATE ANY VIEW                                   0
       -92 DROP ANY VIEW                                     0
      -105 CREATE SEQUENCE                                   0
      -106 CREATE ANY SEQUENCE                               0
      -107 ALTER ANY SEQUENCE                                0
      -108 DROP ANY SEQUENCE                                 0
      -109 SELECT ANY SEQUENCE                               0
      -115 CREATE DATABASE LINK                              0
      -120 CREATE PUBLIC DATABASE LINK                       0
      -121 DROP PUBLIC DATABASE LINK                         0
      -125 CREATE ROLE                                       0
      -126 DROP ANY ROLE                                     0
      -127 GRANT ANY ROLE                                    0
      -128 ALTER ANY ROLE                                    0
      -130 AUDIT ANY                                         0
      -135 ALTER DATABASE                                    0
      -138 FORCE TRANSACTION                                 0
      -139 FORCE ANY TRANSACTION                             0
      -140 CREATE PROCEDURE                                  0
      -141 CREATE ANY PROCEDURE                              0
      -142 ALTER ANY PROCEDURE                               0
      -143 DROP ANY PROCEDURE                                0
      -144 EXECUTE ANY PROCEDURE                             0
      -151 CREATE TRIGGER                                    0
      -152 CREATE ANY TRIGGER                                0
      -153 ALTER ANY TRIGGER                                 0
      -154 DROP ANY TRIGGER                                  0
      -160 CREATE PROFILE                                    0
      -161 ALTER PROFILE                                     0
      -162 DROP PROFILE                                      0
      -163 ALTER RESOURCE COST                               0
      -165 ANALYZE ANY                                       0
      -167 GRANT ANY PRIVILEGE                               0
      -172 CREATE MATERIALIZED VIEW                          0
      -173 CREATE ANY MATERIALIZED VIEW                      0
      -174 ALTER ANY MATERIALIZED VIEW                       0
      -175 DROP ANY MATERIALIZED VIEW                        0
      -177 CREATE ANY DIRECTORY                              0
      -178 DROP ANY DIRECTORY                                0
      -180 CREATE TYPE                                       0
      -181 CREATE ANY TYPE                                   0
      -182 ALTER ANY TYPE                                    0
      -183 DROP ANY TYPE                                     0
      -184 EXECUTE ANY TYPE                                  0
      -186 UNDER ANY TYPE                                    0
      -188 CREATE LIBRARY                                    0
      -189 CREATE ANY LIBRARY                                0
      -190 ALTER ANY LIBRARY                                 0
      -191 DROP ANY LIBRARY                                  0
      -192 EXECUTE ANY LIBRARY                               0
      -200 CREATE OPERATOR                                   0
      -201 CREATE ANY OPERATOR                               0
      -202 ALTER ANY OPERATOR                                0
      -203 DROP ANY OPERATOR                                 0
      -204 EXECUTE ANY OPERATOR                              0
      -205 CREATE INDEXTYPE                                  0
      -206 CREATE ANY INDEXTYPE                              0
      -207 ALTER ANY INDEXTYPE                               0
      -208 DROP ANY INDEXTYPE                                0
      -209 UNDER ANY VIEW                                    0
      -210 QUERY REWRITE                                     0
      -211 GLOBAL QUERY REWRITE                              0
      -212 EXECUTE ANY INDEXTYPE                             0
      -213 UNDER ANY TABLE                                   0
      -214 CREATE DIMENSION                                  0
      -215 CREATE ANY DIMENSION                              0
      -216 ALTER ANY DIMENSION                               0
      -217 DROP ANY DIMENSION                                0
      -218 MANAGE ANY QUEUE                                  1
      -219 ENQUEUE ANY QUEUE                                 1
      -220 DEQUEUE ANY QUEUE                                 1
      -222 CREATE ANY CONTEXT                                0
      -223 DROP ANY CONTEXT                                  0
      -224 CREATE ANY OUTLINE                                0
      -225 ALTER ANY OUTLINE                                 0
      -226 DROP ANY OUTLINE                                  0
      -227 ADMINISTER RESOURCE MANAGER                       1
      -228 ADMINISTER DATABASE TRIGGER                       0
      -233 MERGE ANY VIEW                                    0
      -234 ON COMMIT REFRESH                                 0
      -235 EXEMPT ACCESS POLICY                              0
      -236 RESUMABLE                                         0
      -237 SELECT ANY DICTIONARY                             0
      -238 DEBUG CONNECT SESSION                             0
      -241 DEBUG ANY PROCEDURE                               0
      -243 FLASHBACK ANY TABLE                               0
      -244 GRANT ANY OBJECT PRIVILEGE                        0
      -245 CREATE EVALUATION CONTEXT                         1
      -246 CREATE ANY EVALUATION CONTEXT                     1
      -247 ALTER ANY EVALUATION CONTEXT                      1
      -248 DROP ANY EVALUATION CONTEXT                       1
      -249 EXECUTE ANY EVALUATION CONTEXT                    1
      -250 CREATE RULE SET                                   1
      -251 CREATE ANY RULE SET                               1
      -252 ALTER ANY RULE SET                                1
      -253 DROP ANY RULE SET                                 1
      -254 EXECUTE ANY RULE SET                              1
      -255 EXPORT FULL DATABASE                              0
      -256 IMPORT FULL DATABASE                              0
      -257 CREATE RULE                                       1
      -258 CREATE ANY RULE                                   1
      -259 ALTER ANY RULE                                    1
      -260 DROP ANY RULE                                     1
      -261 EXECUTE ANY RULE                                  1
      -262 ANALYZE ANY DICTIONARY                            0
      -263 ADVISOR                                           0
      -264 CREATE JOB                                        0
      -265 CREATE ANY JOB                                    0
      -266 EXECUTE ANY PROGRAM                               0
      -267 EXECUTE ANY CLASS                                 0
      -268 MANAGE SCHEDULER                                  0
      -269 SELECT ANY TRANSACTION                            0
      -270 DROP ANY SQL PROFILE                              0
      -271 ALTER ANY SQL PROFILE                             0
      -272 ADMINISTER SQL TUNING SET                         0
      -273 ADMINISTER ANY SQL TUNING SET                     0
      -274 CREATE ANY SQL PROFILE                            0
      -275 EXEMPT IDENTITY POLICY                            0
      -276 MANAGE FILE GROUP                                 1
      -277 MANAGE ANY FILE GROUP                             1
      -278 READ ANY FILE GROUP                               1
      -279 CHANGE NOTIFICATION                               0
      -280 CREATE EXTERNAL JOB                               0
      -284 CREATE ASSEMBLY                                   0
      -285 CREATE ANY ASSEMBLY                               0
      -286 ALTER ANY ASSEMBLY                                0
      -287 DROP ANY ASSEMBLY                                 0
      -288 EXECUTE ANY ASSEMBLY                              0
      -289 EXECUTE ASSEMBLY                                  0
      -281 CREATE ANY EDITION                                0
      -282 DROP ANY EDITION                                  0
      -283 ALTER ANY EDITION                                 0
      -301 CREATE CUBE DIMENSION                             0
      -302 ALTER ANY CUBE DIMENSION                          0
      -303 CREATE ANY CUBE DIMENSION                         0
      -304 DELETE ANY CUBE DIMENSION                         0
      -305 DROP ANY CUBE DIMENSION                           0
      -306 INSERT ANY CUBE DIMENSION                         0
      -307 SELECT ANY CUBE DIMENSION                         0
      -308 CREATE CUBE                                       0
      -309 ALTER ANY CUBE                                    0
      -310 CREATE ANY CUBE                                   0
      -311 DROP ANY CUBE                                     0
      -312 SELECT ANY CUBE                                   0
      -313 UPDATE ANY CUBE                                   0
      -314 CREATE MEASURE FOLDER                             0
      -315 CREATE ANY MEASURE FOLDER                         0
      -316 DELETE ANY MEASURE FOLDER                         0
      -317 DROP ANY MEASURE FOLDER                           0
      -318 INSERT ANY MEASURE FOLDER                         0
      -319 CREATE CUBE BUILD PROCESS                         0
      -320 CREATE ANY CUBE BUILD PROCESS                     0
      -321 DROP ANY CUBE BUILD PROCESS                       0
      -322 UPDATE ANY CUBE BUILD PROCESS                     0
      -326 UPDATE ANY CUBE DIMENSION                         0
      -350 FLASHBACK ARCHIVE ADMINISTER                      0
      -290 CREATE MINING MODEL                               0
      -291 CREATE ANY MINING MODEL                           0
      -292 DROP ANY MINING MODEL                             0
      -293 SELECT ANY MINING MODEL                           0
      -294 ALTER ANY MINING MODEL                            0
      -295 COMMENT ANY MINING MODEL                          0
      -327 ADMINISTER SQL MANAGEMENT OBJECT                  0
      -328 ALTER PUBLIC DATABASE LINK                        0
      -329 ALTER DATABASE LINK                               0

208 rows selected.

AUDIT RELATED VIEWS


DBA_FGA_AUDIT_TRAIL - display the captured audit information(FGA only (from FGA_LOG$))
DBA_AUDIT_EXISTS   -- displays audit trail entries produced by AUDIT EXISTS and AUDIT NOT EXISTS.
DBA_AUDIT_OBJECT                           -- displays audit trail records for all objects in the database.
DBA_AUDIT_POLICIES -- identify FGA audit policies
DBA_AUDIT_POLICY_COLUMNS     -- Identify FGA audit policies for the columns level in FGA
DBA_AUDIT_SESSION                        -- display session level auditing information
DBA_AUDIT_STATEMENT                 -- display statement level auditing information
DBA_AUDIT_TRAIL    -- display the captured audit information(Standard auditing only (from AUD$))                                                                            
DBA_COMMON_AUDIT_TRAIL    -- displays the captured audit information for both standard & FGA             
DBA_OBJ_AUDIT_OPTS                    -- display any object auditing
DBA_PRIV_AUDIT_OPTS                  -- display any privilege auditing
DBA_STMT_AUDIT_OPTS                 -- display any statement auditing
DBA_AUDIT_MGMT_CLEANUP_JOBS -- Displays the currently configured audit trail purge jobs                                                                     
DBA_AUDIT_MGMT_CLEAN_EVENTS -- Displays the history of purge events. Periodically, as user                                                                         SYS connected with the SYSDBA privilege, you should delete the contents of this view so that it does not grow too large.
DBA_AUDIT_MGMT_CONFIG_PARAMS -- displays information about the currently configured audit                                     trail properties that are used by the  DBMS_AUDIT_MGMT PL/SQL package.
DBA_AUDIT_MGMT_LAST_ARCH_TS     -- Displays the last archive timestamps that have set for audit   trail purges.
V$XML_AUDIT_TRAIL   -- If you are writing to an XML file, you can query V$XML_AUDIT_TRAIL.                                         


Tuesday, May 24, 2011

FINDING SCHEMA SIZE FOR A ORACLE DATABASE


SQL> set pagesize 10000
SQL> BREAK ON REPORT
SQL> COMPUTE SUM LABEL TOTAL OF "Size of Each Segment in MB" ON REPORT
SQL> select segment_type, sum(bytes/1024/1024) "Size of Each Segment in MB" from dba_segments where owner='SYS' group by segment_type order by 1;

SEGMENT_TYPE       Size of Each Segment in MB
------------------          --------------------------
CLUSTER                              1872.0625
INDEX                                   1419.3125
INDEX PARTITION                    166.25
LOB PARTITION                          .1875
LOBINDEX                                17.1875
LOBSEGMENT                        478.8125
NESTED TABLE                                   1
ROLLBACK                                          2
TABLE                                      1218.875
TABLE PARTITION                 441.3125
TYPE2 UNDO                         1055.5625
                                    --------------------------
TOTAL                                    6672.5625

11 rows selected.

Wednesday, May 18, 2011

Recreating Oracle Inventory in 10g/11g


CREATE / RECREATING CORRUPTED ORACLE INVENTORY IN UNIX SYSTEMS FROM 10G & 11G

The Oracle Universal Installer creates the oraInventory directory the first time it is run on a computer. oraInventory is repository which store/records oracle software products & their ORACLE_HOME location on a machine. This Inventory now days in XML format and called as XML Inventory where as in past it used to be in binary format & called as binary Inventory.
There are basically two kind of Inventory Global Inventory (also called as Central Inventory) and Local Inventory also called as Oracle Home Inventory.

Below document explains you the step by step approach for recreating the oracle inventory for oracle 10g & 11g database.

Note:
1)  No down time is required for recreating the global inventory (oraInventory)
2)  if you have corrupted oracle inventory or improper oracle inventory, you can rename the directory to avoid the confusion.

      mv oraInventory oraInventory_orig

Central Inventory
-----------------
Central Inventory contains the information relating to all Oracle products
Installed on a host. Central inventory (oraInventory) is an inventory that
lists ORACLE_HOMEs installed in the system using the inventory.xml file.
Each central inventory consists of a file called inventory.xml, which
contains the list of Oracle Homes installed.

Local Inventory
---------------
Oracle home inventory or local inventory is present inside each Oracle home.
It contains information relevant to the particular Oracle home only.
This inventory contains, among other things, a file called comps.xml,
which contains all the components  as well as patchsets or interim patches
installed in the ORACLE_HOME.

To determine where oraInventory is located

/var/opt/oracle/oraInst.loc or /etc/oraInst.loc depending upon the Platform.

Sample oraInst.loc file

/var/opt/oracle/oraInst.loc
inst_group=dba
inventory_loc=/apps/oracle/product/oraInventory

ORACLE_HOME/oraInst.loc
inst_group=dba
inventory_loc=/apps/oracle/product/oraInventory




To find the ORACLE_HOME & ORACLE_HOME_NAME

if you have oracle old inventory, then you can view from
/apps/oracle/product/oraInventory/ContentsXML/inventory.xml
you can see ORACLE_HOME & ORACLE_HOME_NAME

SAMPLE OUTPUT

<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 2009 Oracle Corporation. All rights Reserved -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>10.2.0.5.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="orahome_102" LOC="/apps/oracle/product/10.2.0.2" TYPE="O" IDX="1"/>
<HOME NAME="agent10g" LOC="/apps/oracle/product/agent10g" TYPE="O" IDX="2"/>
</HOME_LIST>
</INVENTORY>


Go to Oracle Universal installer location for creating Oracle Inventory
$ORACLE_HOME/oui/bin

if you have more than one Oracle product, you have to update the inventory for all the oracle home
Ex: Oracle DB home(different versions includes)
    Oracle Agent

Note: when you are running for different homes, you have run the oui in there respective home only
     
Ex: output for ORACLE_HOME(run it in $ORACLE_HOME/oui/bin)

SAMPLE OUTPUT

$ ./runInstaller -silent -ignoreSysPrereqs -attachHome ORACLE_HOME="/apps/oracle/product/10.2.0.2" ORACLE_HOME_NAME="orahome_102"
Starting Oracle Universal Installer...

No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.

>>> Ignoring required pre-requisite failures. Continuing...

The inventory pointer is located at /var/opt/oracle/oraInst.loc
The inventory is located at /apps/oracle/product/oraInventory
'AttachHome' was successful.

Ex: output for AGENT_HOME(run it in $AGENT_HOME/oui/bin)




SAMPLE OUTPUT

$ ./runInstaller -silent -ignoreSysPrereqs -attachHome ORACLE_HOME="/apps/oracle/product/agent10g" ORACLE_HOME_NAME="agent10g"
Starting Oracle Universal Installer...

No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.

>>> Ignoring required pre-requisite failures. Continuing...

The inventory pointer is located at /var/opt/oracle/oraInst.loc
The inventory is located at /apps/oracle/product/oraInventory
'AttachHome' was successful.



We can apply the patch by specify oracle inventory location by the below option.

-- Apply the Patch with the address of the Oracle Inventory

$ opatch apply -invPtrLoc /app/oracle/oraInst.loc

$ opatch lsinventory -invPtrLoc /app/oracle/oraInst.loc


We can apply the patch without the oracle inventory location also by the below option. BUT THIS IS NOT A BEST PRATICE.

The patch can be applied to an ORACLE_HOME with -no_inventory option, but then you won’t have the record of patches applied to that ORACLE_HOME.