Sunday, October 28, 2007

List Users Connected to Oracle Database

col ip_address format a16

select username,osuser,terminal,
UTL_INADDR.get_host_address(substr(machine,instr(machine,'\')+1)) ip
from v$session
where username is not null order by username,osuser;
List Users Connected to Oracle DatabaseSocialTwist Tell-a-Friend

Monday, October 22, 2007

Viewing Privilege and Role Information in Oracle 10g Database

DBA view describes all column object grants in the database. ALL view describes all column object grants for which the current user or PUBLIC is the object owner, grantor, or grantee. USER view describes column object grants for which the current user is the object owner, grantor, or grantee.

DBA_COL_PRIVS

ALL_COL_PRIVS

USER_COL_PRIVS

ALL view lists column object grants for which the current user is object owner or grantor. USER view describes column object grants for which the current user is the grantor.

ALL_COL_PRIVS_MADE

USER_COL_PRIVS_MADE

ALL view describes column object grants for which the current user or PUBLIC is the grantee. USER view describes column object grants for which the current user is the grantee.

ALL_COL_PRIVS_RECD

USER_COL_PRIVS_RECD

DBA view lists all grants on all objects in the database. ALL view lists the grants on objects where the user or PUBLIC is the grantee. USER view lists grants on all objects where the current user is the grantee.

DBA_TAB_PRIVS

ALL_TAB_PRIVS

USER_TAB_PRIVS

ALL view lists the all object grants made by the current user or made on the objects owned by the current user. USER view lists grants on all objects owned by the current user.

ALL_TAB_PRIVS_MADE

USER_TAB_PRIVS_MADE

ALL view lists object grants for which the user or PUBLIC is the grantee. USER view lists object grants for which the current user is the grantee.

ALL_TAB_PRIVS_RECD

USER_TAB_PRIVS_RECD

This view lists all roles that exist in the database.


DBA_ROLES

DBA view lists roles granted to users and roles. USER view lists roles granted to the current user.

DBA_ROLE_PRIVS

USER_ROLE_PRIVS

DBA view lists system privileges granted to users and roles. USER view lists system privileges granted to the current user.

DBA_SYS_PRIVS

USER_SYS_PRIVS

This view describes roles granted to other roles. Information is provided only about roles to which the user has access.

ROLE_ROLE_PRIVS

This view contains information about system privileges granted to roles.
Information is provided only about roles to which the user has access.

ROLE_SYS_PRIVS

This view contains information about object privileges granted to roles. Information is provided only about roles to which the user has access.


ROLE_TAB_PRIVS

This view lists the privileges that are currently enabled for the user.

SESSION_PRIVS

This view lists the roles that are currently enabled to the user.


SESSION_ROLES
Viewing Privilege and Role Information in Oracle 10g DatabaseSocialTwist Tell-a-Friend

Wednesday, October 17, 2007

Predefined Roles in Oracle 9i Enterprise Database

Roles
Predefined Roles
Along with the installation, more exactly with the creation of an oracle database, Oracle creates predefined roles. These are:

* connect, resource, dba
These might not be created anymore in future versions of Oracle.
Oracle 9.2 grants create session, alter session, create synonym, create view, create database link, create table, create cluster and create sequence to connect.

It also grants create table , create cluster, create sequence, create trigger create procedure, create type, create indextype and create operator to resource.
The role dba gets basically everything and that with admin option.


* delete_catalog_role, execute_catalog_role, select_catalog_role
Accessing data dictionary views (v$ views and static dictionary views)

* exp_full_database, imp_full_database
This role is needed to export objects found in another user's schema.
* aq_user_role, aq_administrator_role, global_aq_user_role(?)
* logstdby_administrator
* snmpagent
* recovery_catalog_owner
* hs_admin_role
* oem_monitor, oem_advisor
* scheduler_admin
* gather_system_statistics
* plustrace
* xdbadmin
* xdbwebservices
* ctxapp
Predefined Roles in Oracle 9i Enterprise DatabaseSocialTwist Tell-a-Friend

Thursday, October 11, 2007

Using DB_VERIFY Utility in Oracle 10g Enterprise Database for identifying block corruption in backup files and live datafiles

This was in my Alert Log file

Wed Oct 07 22:00:57 2009
GATHER_STATS_JOB encountered errors. Check the trace file.
Wed Oct 07 22:00:57 2009
Errors in file d:\oracle\product\10.2.0\admin\synapse\bdump\synapse_j001_1036.trc:
ORA-01578: ORACLE data block corrupted (file # 1, block # 51522)
ORA-01110: data file 1: 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\SYNAPSE\SYSTEM01.DBF'


Using Using DB_VERIFY Utility in Command prompt

C:\>dbv file=D:\ORACLE\PRODUCT\10.2.0\ORADATA\SYNAPSE\SYSTEM01.DBF

DBVERIFY: Release 10.2.0.4.0 - Production on Thu Oct 8 11:36:18 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

DBVERIFY - Verification starting : FILE = D:\ORACLE\PRODUCT\10.2.0\ORADATA\SYNAP
SE\SYSTEM01.DBF
Page 51342 is influx - most likely media corrupt
Corrupt block relative dba: 0x0040c88e (file 1, block 51342)
Fractured block found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x0040c88e
last change scn: 0x0000.01f696a1 seq: 0x1 flg: 0x06
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x00345352
check value in block header: 0xb5cc
computed block checksum: 0x82d

Page 51343 is marked corrupt
Corrupt block relative dba: 0x0040c88f (file 1, block 51343)
Bad header found during dbv:
Data in bad block:
type: 3 format: 0 rdba: 0x00000005
last change scn: 0x0003.00020002 seq: 0x0 flg: 0x06
spare1: 0x0 spare2: 0x0 spare3: 0x7010
consistency value in tail: 0x000005d8
check value in block header: 0x3
computed block checksum: 0xe09f

Page 51344 is marked corrupt
Corrupt block relative dba: 0x0040c890 (file 1, block 51344)
Bad header found during dbv:
Data in bad block:
type: 16 format: 2 rdba: 0x000009a8
last change scn: 0x0d78.00000294 seq: 0x0 flg: 0x00
spare1: 0x0 spare2: 0x0 spare3: 0xbd
consistency value in tail: 0x7f00001d
check value in block header: 0x201
block checksum disabled

Page 51345 is marked corrupt
Corrupt block relative dba: 0x0040c891 (file 1, block 51345)
Bad header found during dbv:
Data in bad block:
type: 255 format: 3 rdba: 0x23000000
last change scn: 0xba00.0000fdfb seq: 0x26 flg: 0x01
spare1: 0x2a spare2: 0x1b spare3: 0x100
consistency value in tail: 0x00000000
check value in block header: 0x100
block checksum disabled

Page 51346 is influx - most likely media corrupt
Corrupt block relative dba: 0x0040c892 (file 1, block 51346)
Fractured block found during dbv:
Data in bad block:
type: 0 format: 0 rdba: 0x00000000
last change scn: 0x0000.00000000 seq: 0x0 flg: 0x00
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x00000000
check value in block header: 0x0
block checksum disabled

Page 51347 is marked corrupt
Corrupt block relative dba: 0x0040c893 (file 1, block 51347)
Completely zero block found during dbv:

Page 51381 is marked corrupt
Corrupt block relative dba: 0x0040c8b5 (file 1, block 51381)
Bad check value found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x0040c8b5
last change scn: 0x0000.01f73e6b seq: 0x2 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x3e6b0602
check value in block header: 0x94a3
computed block checksum: 0x89d9

Page 51522 is marked corrupt
Corrupt block relative dba: 0x0040c942 (file 1, block 51522)
Bad check value found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x0040c942
last change scn: 0x0000.01fb92b7 seq: 0x1 flg: 0x06
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x92b70601
check value in block header: 0x1201
computed block checksum: 0x1



DBVERIFY - Verification complete

Total Pages Examined : 66560
Total Pages Processed (Data) : 40487
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 8111
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1929
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 16025
Total Pages Marked Corrupt : 8
Total Pages Influx : 2
Highest block SCN : 33440950 (0.33440950)
Using DB_VERIFY Utility in Oracle 10g Enterprise Database for identifying block corruption in backup files and live datafilesSocialTwist Tell-a-Friend