more tips and techniques for dbas and developers malesh gummula independent consultant

25
More Tips and More Tips and Techniques for Techniques for DBAs and DBAs and Developers Developers Malesh Gummula Malesh Gummula http://geocities.com/ http://geocities.com/ malesh_oracle malesh_oracle Independent Consultant Independent Consultant

Upload: neil-craig

Post on 02-Jan-2016

226 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

More Tips and More Tips and Techniques for Techniques for

DBAs and DBAs and DevelopersDevelopersMalesh GummulaMalesh Gummulahttp://geocities.com/http://geocities.com/

malesh_oraclemalesh_oracleIndependent ConsultantIndependent Consultant

Page 2: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

IntroductionIntroduction

Most books and documentation are set up

like reference materials

Training courses focus on the fundamental

aspects of products in a limited time

Hands-on experience is one of the best ways

to learn tricks to maximize your use of

Oracle

Page 3: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

The Topics “Gotchas” of Dropping and Recreating Tables

See Hidden I NIT.ORA Parameters

Change the SQL Prompt

Resize the Redo Logs

Using DECODE for Multiple Values

Use DECODE for < or > comparisons

I dentify and Delete Duplicate Records

OS Commands and Utilities

Files that are Created or Grow by Default

Page 4: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

““Gotchas” of Dropping and Gotchas” of Dropping and Recreating TablesRecreating Tables

Dropping a table will cause the following actions to occur:Dropping a table will cause the following actions to occur:

All indexes on the table are dropped from the databaseAll indexes on the table are dropped from the database

All triggers on the table are dropped from the databaseAll triggers on the table are dropped from the database

All triggers that reference the table are invalidatedAll triggers that reference the table are invalidated

All constraints on the table are dropped (PK, UK, Check, All constraints on the table are dropped (PK, UK, Check, Not Null)Not Null)

All foreign keys pointing to the table are disabledAll foreign keys pointing to the table are disabled

All packages, procedures, and views that reference the All packages, procedures, and views that reference the table are invalidatedtable are invalidated

All grants on the table are dropped from the database.All grants on the table are dropped from the database.

Page 5: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

““Gotchas” of Dropping and Gotchas” of Dropping and Recreating TablesRecreating Tables

DBA_DEPENDENCIESDBA_DEPENDENCIES

NameName Null?Null? TypeType

---------------------------------------------- -------------------------- ----------------------------------------------

OWNEROWNER NOT NULLNOT NULL VARCHAR2(30)VARCHAR2(30)

NAMENAME NOT NULLNOT NULL VARCHAR2(30)VARCHAR2(30)

TYPETYPE VARCHAR2(12)VARCHAR2(12)

REFERENCED_OWNERREFERENCED_OWNER VARCHAR2(30)VARCHAR2(30)

REFERENCED_NAMEREFERENCED_NAME VARCHAR2(64)VARCHAR2(64)

REFERENCED_TYPEREFERENCED_TYPE VARCHAR2(12)VARCHAR2(12)

REFERENCED_LINK_NAMEREFERENCED_LINK_NAME VARCHAR2(128)VARCHAR2(128)

DEPENDENCY_TYPE VARCHAR2(4)

Page 6: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

SELECTSELECT OWNER, NAME, TYPE, REFERENCED_OWNER, OWNER, NAME, TYPE, REFERENCED_OWNER, REFERENCED_NAME, REFERENCED_TYPE REFERENCED_NAME, REFERENCED_TYPE

FROMFROM ALL_DEPENDENCIES ALL_DEPENDENCIESWHEREWHERE REFERENCED_NAME = ‘EMP_TABLE’; REFERENCED_NAME = ‘EMP_TABLE’;OWNEROWNER NAMENAME TYPETYPE

REFERENCED_OWNERREFERENCED_OWNER REFERENCED_NAMEREFERENCED_NAME REFERENCED_TREFERENCED_T---------------------------------------------------------------------------------------------------------------------------- ------------------------------------- ---------------------------------PRODPROD PROD_BATCH_UTILITY_PPROD_BATCH_UTILITY_P PACKAGEPACKAGEPRODPROD EMP_TABLEEMP_TABLE NON-EXISTENTNON-EXISTENTPRODPROD PROCESS215PROCESS215 FUNCTIONFUNCTION

PUBLICPUBLIC EMP_TABLEEMP_TABLE SYNONYMSYNONYMPRODPROD POST205POST205 FUNCTIONFUNCTION

PUBLICPUBLIC EMP_TABLEEMP_TABLE SYNONYMSYNONYM

““Gotchas” of Dropping and Gotchas” of Dropping and Recreating TablesRecreating Tables

Page 7: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Set heading offSet heading offspool recompile.sqlspool recompile.sqlSELECTSELECT ‘ ‘alteralter ‘||decode(object_type,’ ‘||decode(object_type,’PACKAGE PACKAGE BODYBODY’,’’,’PACKAGEPACKAGE’,object_type)||’,object_type)||‘ ‘||owner||’‘ ‘||owner||’..’||object_name||’ ’||object_name||’ compile;compile;’’FROMFROM dba_objects dba_objectsWHEREWHERE status= ‘INVALID’; status= ‘INVALID’;spool offspool off

alteralter PROCEDURE PROD.CM1279 PROCEDURE PROD.CM1279 compile;compile;alteralter FUNCTION PROD.DELETE_TRADE_DATE FUNCTION PROD.DELETE_TRADE_DATE compile;compile;alteralter FUNCTION PROD.POP_TEMP_MATCH FUNCTION PROD.POP_TEMP_MATCH compile;compile;alteralter VIEW TEST_ACCT.POST215_V VIEW TEST_ACCT.POST215_V compile;compile;alteralter FUNCTION TEST_ACCT.PROCESS215 FUNCTION TEST_ACCT.PROCESS215 compile;compile;alteralter FUNCTION TEST_ACCT.PROCESS216 FUNCTION TEST_ACCT.PROCESS216 compile;compile;alter PACKAGE TEST_ACCT.TEST_UTILITY_P compile;

““Gotchas” of Dropping and Recreating Gotchas” of Dropping and Recreating TablesTables

Page 8: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

See Hidden INIT.ORA See Hidden INIT.ORA ParametersParameters

Regular INIT.ORA: Regular INIT.ORA: V$PARAMETERV$PARAMETER

NameName Null?Null? TypeType -------------------------------------------------------------------------------------------------- ------------------------ ------------------------ ---------------------------------------- ----------------------------------------

NUMNUM NUMBERNUMBER

NAMENAME VARCHAR2(64)VARCHAR2(64)

TYPETYPE NUMBERNUMBER

VALUEVALUE VARCHAR2(512)VARCHAR2(512)

ISDEFAULTISDEFAULT VARCHAR2(9)VARCHAR2(9)

ISSES_MODIFIABLEISSES_MODIFIABLE VARCHAR2(5)VARCHAR2(5)

ISSYS_MODIFIABLEISSYS_MODIFIABLE VARCHAR2(9)VARCHAR2(9)

ISMODIFIEDISMODIFIED VARCHAR2(10)VARCHAR2(10)

ISADJUSTEDISADJUSTED VARCHAR2(5)VARCHAR2(5)

DESCRIPTION VARCHAR2(64)

Page 9: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

See Hidden INIT.ORA ParametersSee Hidden INIT.ORA Parameters To view the “regular” init.ora parameters, issue:, issue:SQL>SQL> SELECT NAME, VALUE, ISDEFAULTSELECT NAME, VALUE, ISDEFAULT22 FROM V$PARAMETERFROM V$PARAMETER33 ORDER BY NAME;ORDER BY NAME;

NAME VALUE ISDEFAULT-------------------------

------------------------- ---------partition_view_enabled FALSE TRUEplsql_v2_compatibility FALSE TRUEpre_page_sga TRUE FALSEprocesses 150 FALSEpush_join_predicate FALSE TRUEread_only_open_delayed FALSE TRUErecovery_parallelism 0 TRUE

Page 10: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

See Hidden INIT.ORA See Hidden INIT.ORA ParametersParameters

““Hidden” INIT.ORA: Hidden” INIT.ORA: X$KSPPI and X$KSPPSV

X$KSPPIX$KSPPI X$KSPPSVX$KSPPSV

NameName TypeType NameName TypeType---------------------------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------------- ------------------------------------------------------------------

ADDRADDR RAW(4)RAW(4) ADDRADDR RAW(4)RAW(4)

INDXINDX NUMBERNUMBER INDX NUMBER

INST_IDINST_ID NUMBERNUMBER INST_IDINST_ID NUMBERNUMBER

KSPPINMKSPPINM VARCHAR2(64)VARCHAR2(64) KSPPSTVLKSPPSTVLVARCHAR2(512)VARCHAR2(512)

KSPPITYKSPPITY NUMBERNUMBER KSPPSTDFKSPPSTDFVARCHAR2(9)VARCHAR2(9)

KSPPDESCKSPPDESC VARCHAR2(64)VARCHAR2(64) KSPPSTVFKSPPSTVF NUMBERNUMBER

KSPPIFLGKSPPIFLG NUMBERNUMBER

Page 11: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

See Hidden INIT.ORA ParametersSee Hidden INIT.ORA Parameters To see all init.ora parameters, “regular” and “hidden”, that have been

modified directly or indirectly, issue::

SQL>SQL> SELECT nam.ksppinm || '=' || SELECT nam.ksppinm || '=' || val.ksppstvlval.ksppstvl

22 FROM x$ksppi nam, x$ksppsv valFROM x$ksppi nam, x$ksppsv val

33 WHERE nam.indx = val.indx AND WHERE nam.indx = val.indx AND

44 val.ksppstdf ='FALSE’ val.ksppstdf ='FALSE’ ORDER BY 1;

NAM.KSPPINM||’=’||VAL.KSPPSTVLNAM.KSPPINM||’=’||VAL.KSPPSTVL------------------------- ------------------------- ------------------------- ---------------------------------- ---------

partition_view_enabled=FALSEpartition_view_enabled=FALSE

_affinity_on=FALSE_affinity_on=FALSE

_wait_for_sync=TRUE_wait_for_sync=TRUE

compatible=8.0.0compatible=8.0.0

Page 12: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Global Login Script:Global Login Script:

$ORACLE_HOME/sqlplus/admin/glogin.sql

Local Login Script:

$ORACLE_PATH/login.sql

set heading offset heading offselect 'Logged in as ' || select 'Logged in as ' || username from user_users;username from user_users;set heading onset heading on will print “Logged in as SCOTT” when you connect as will print “Logged in as SCOTT” when you connect as

SCOTT.SCOTT.

Changing the SQL PromptChanging the SQL Prompt

Page 13: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

In glogin.sql or login.sql:In glogin.sql or login.sql:set heading offset heading offset prompt offset prompt offspool make_prompt.sqlspool make_prompt.sqlSELECTSELECT ‘set sqlprompt ‘‘‘|| d.name ||‘@‘ || ‘set sqlprompt ‘‘‘|| d.name ||‘@‘ ||substr(s.machine,1,decode substr(s.machine,1,decode (instr(s.machine,‘.‘), 0, (instr(s.machine,‘.‘), 0, length(s.machine),length(s.machine),

instr(s.machine,‘.‘) - 1)) || ‘-instr(s.machine,‘.‘) - 1)) || ‘-SQL> ‘‘‘SQL> ‘‘‘

FROMFROM V$SESSION s, V$DATABASE D V$SESSION s, V$DATABASE DWHEREWHERE s.SID=1 s.SID=1;;spool offspool off@make_prompt.sql@make_prompt.sqlset heading onset heading onset feedback onset feedback on

Changing the SQL PromptChanging the SQL Prompt

The prompt will look The prompt will look like:like:

PHIS@survlpd-SQL>

Page 14: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Resize the Redo LogsResize the Redo LogsSQL> SQL> SELECT * FROM V$LOG;SELECT * FROM V$LOG;

GROUP#GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS CHANGE# FIRST_TIMTHREAD# SEQUENCE# BYTES MEMBERS ARC STATUS CHANGE# FIRST_TIM

---------------------------------------------------------------------------- ---------------------------------------------------------------------------- --------- --------- --------- --------- ------------------ --------- --------- --------- ---------

1 1 422 52,428,800 1 1 1 422 52,428,800 1 NO INACTIVE 680764231 05-APR-00 NO INACTIVE 680764231 05-APR-00

2 1 423 262,144,000 1 2 1 423 262,144,000 1 NO INACTIVE 680764271 05-APR-00 NO INACTIVE 680764271 05-APR-00

3 1 424 262,144,000 1 NO CURRENT 680764463 05-APR-00

SQL> SQL> SELECT * FROM V$LOGFILE;SELECT * FROM V$LOGFILE;GROUP#GROUP# STATUSSTATUS MEMBERMEMBER

----------------------------------------------------------------------------------------------------------------------------------------------------------------

/emc08/ORACLE/DHIS/redoQHIS01a.log/emc08/ORACLE/DHIS/redoQHIS01a.log 11

/emc02/oradata/DHIS/redoQHIS02a.log/emc02/oradata/DHIS/redoQHIS02a.log 22

/emc07/oradata/DHIS/redoQHIS03a.log/emc07/oradata/DHIS/redoQHIS03a.log 33

Page 15: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Resize the Redo LogsResize the Redo Logs1)1) Drop the redo log (or group of redo logs): Drop the redo log (or group of redo logs):

SQL> SQL> ALTER DATABASE DROP LOGFILE GROUP 1;ALTER DATABASE DROP LOGFILE GROUP 1;(If the active log group is 1, you will get the following error:)(If the active log group is 1, you will get the following error:)

ORA-01623: log 1 is current log for thread 1 – cannot dropORA-01623: log 1 is current log for thread 1 – cannot drop

(If this occurs, switch the logfile group: “ALTER SYSTEM SWITCH (If this occurs, switch the logfile group: “ALTER SYSTEM SWITCH LOGFILE;” and reissue.)LOGFILE;” and reissue.)

Database altered.Database altered.

2)2) Now there are two log groups remaining (#2, 3). Next, we will Now there are two log groups remaining (#2, 3). Next, we will physically remove the file:physically remove the file:

SQL> SQL> !rm /emc08/ORACLE/DHIS/redoQHIS01a.log!rm /emc08/ORACLE/DHIS/redoQHIS01a.log3)3) Add the redo log back to group 1, with a 16M size: Add the redo log back to group 1, with a 16M size:

SQL> SQL> ALTER DATABASE ADD LOGFILE GROUP 1 ALTER DATABASE ADD LOGFILE GROUP 1 '/emc08/ORACLE/DHIS/redoQHIS01a.log' SIZE 16M'/emc08/ORACLE/DHIS/redoQHIS01a.log' SIZE 16M

Database altered.Database altered.

4)4) Switch the logfile until it points to the recently changed group (in Switch the logfile until it points to the recently changed group (in this example group 1).this example group 1).

SQL> SQL> ALTER SYSTEM SWITCH LOGFILE;ALTER SYSTEM SWITCH LOGFILE;System altered.System altered.

The new redo log (from group 1) is now 16M in size.The new redo log (from group 1) is now 16M in size.

Repeat #1-4 above until all three redo logs have been resized.Repeat #1-4 above until all three redo logs have been resized.

Page 16: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Using DECODE for Multiple Values in One Using DECODE for Multiple Values in One ClauseClause

Decode Example:Decode Example:

SQL> SELECT DECODE(SEX, ’M’, ’Male’, ’F’, ’Female’, ’Unknown’)

2 FROM TABLE_NAME;

Table Example:

SQL>SQL> SELECT * FROM ACCOUNT_PHONES_T;SELECT * FROM ACCOUNT_PHONES_T;PHONEPHONE555-1212555-12125553333SQL>SQL> SELECT PHONE, SUBSTR(PHONE,1,3)||SELECT PHONE, SUBSTR(PHONE,1,3)||

22 DECODEDECODE((SIGN(7-LENGTH(PHONE)),-1,SIGN(7-LENGTH(PHONE)),-1,

33 SUBSTR(PHONE,4,99), '-'||SUBSTR(PHONE,4,99), '-'||SUBSTR(PHONE,4,99)SUBSTR(PHONE,4,99)))

44 “PHONE_FORMATTED”“PHONE_FORMATTED”

55 FROM ACCOUNT_PHONES_T;FROM ACCOUNT_PHONES_T;PHONEPHONE PHONE_FORMATTEDPHONE_FORMATTED555-1212555-1212 555-1212555-121255533335553333 555-3333555-3333

If the length of phone > 7

If the length of phone not > 7

Page 17: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Using DECODE for < or > Using DECODE for < or > ComparisonsComparisonsTable Example:

SQL>SQL> SELECT * FROM SALARIES;SELECT * FROM SALARIES;HUSBAND_SALARYHUSBAND_SALARY WIFE_SALARYWIFE_SALARY---------------------------------------------------------- ---------------------------------------------- 45000 45000 6000060000 90000 39700

SQL Using DECODE and LEAST:SQL>SQL> SELECT husband_salary, wife_salary,SELECT husband_salary, wife_salary,DECODE (LEAST (husband_salary,wife_salary),DECODE (LEAST (husband_salary,wife_salary), husband_salary,'The Husband has the husband_salary,'The Husband has the lower salary',lower salary',

'The Wife has the lower salary''The Wife has the lower salary') ) "WHO_IS_LOWER""WHO_IS_LOWER"

FROM SALARIESFROM SALARIESWHERE husband_salary <> wife_salary;WHERE husband_salary <> wife_salary;HUSBAND_SALARYHUSBAND_SALARY WIFE_SALARYWIFE_SALARY WHO_IS_LOWERWHO_IS_LOWER----------------------------- ----------------------------- ------------------------------------------

------------------------------------------------ 45000 45000 60000 60000 The The

Husband has the lower salaryHusband has the lower salary 90000 39700 The

Wife has the lower salary

Page 18: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Using DECODE for < or > Using DECODE for < or > ComparisonsComparisonsTable Example, with <, >, and = values:

SQL>SQL> SELECT * FROM SALARIES;SELECT * FROM SALARIES;HUSBAND_SALARYHUSBAND_SALARY WIFE_SALARYWIFE_SALARY

45000 6000045000 6000090000 3970055000 55000

SQL Using DECODE and LEAST:

SQL>SQL> SELECT husband_salary, wife_salary,SELECT husband_salary, wife_salary,decode(decode(husband_salary - wife_salary, 0, 'The salaries husband_salary - wife_salary, 0, 'The salaries are the same', are the same',

decode(least(husband_salary,wife_salary),decode(least(husband_salary,wife_salary),

husband_salary,'The Husband has the lower husband_salary,'The Husband has the lower salary',salary',

‘‘The Wife has the lower salary')The Wife has the lower salary')) "WHO_IS_LOWER”) "WHO_IS_LOWER”

FROM SALARIES;FROM SALARIES;HUSBAND_SALARYHUSBAND_SALARY WIFE_SALARYWIFE_SALARY WHO_IS_LOWERWHO_IS_LOWER

45000 45000 60000 60000 The Husband has the The Husband has the lower salarylower salary

90000 39700 The Wife has the lower salary 55000 55000 The salaries are the same

Page 19: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Identify and Delete Duplicate RecordsIdentify and Delete Duplicate RecordsTable Example, with duplicate values:

SQL>SQL> SELECT * FROM EMP;SELECT * FROM EMP;EMP_IDEMP_ID OFFICE_IDOFFICE_ID EMPNAMEEMPNAME

305305 1212 ELLISON, GEORGEELLISON, GEORGE

305305 1212 MERCURIO, JASONMERCURIO, JASON

128128 1717 SIMPSON, LINDASIMPSON, LINDA

305305 2222 JACKSON, DREWJACKSON, DREW

To see duplicates, use the following SQL:To see duplicates, use the following SQL:

SQL> SQL> SELECT COUNT(*), EMP_ID, OFFICE_IDSELECT COUNT(*), EMP_ID, OFFICE_ID

FROM EMPFROM EMP

GROUP BY EMP_ID, OFFICE_IDGROUP BY EMP_ID, OFFICE_ID

HAVING COUNT(*) > 1;HAVING COUNT(*) > 1;

The result will be:The result will be:

COUNT(*)COUNT(*) EMP_IDEMP_ID OFFICE_IDOFFICE_ID

22 305305 1212

Page 20: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Identify and Delete Duplicate RecordsIdentify and Delete Duplicate RecordsTable Example, with duplicate values:

SQL>SQL> SELECT * FROM EMP;SELECT * FROM EMP;EMP_IDEMP_ID OFFICE_IDOFFICE_ID EMPNAMEEMPNAME

305305 1212 ELLISON, GEORGEELLISON, GEORGE

305305 1212 MERCURIO, JASONMERCURIO, JASON

128128 1717 SIMPSON, LINDASIMPSON, LINDA

305305 2222 JACKSON, DREWJACKSON, DREW

To delete ALL duplicates (not leaving any of the set):To delete ALL duplicates (not leaving any of the set):

SQL> SQL> DELETE FROM EMP DELETE FROM EMP AA WHERE WHERE

((EMP_ID, OFFICE_ID, 2EMP_ID, OFFICE_ID, 2) IN) IN

(SELECT (SELECT EMP_ID, OFFICE_ID, EMP_ID, OFFICE_ID, decode(count(*),1,1,2)decode(count(*),1,1,2)

FROM EMP FROM EMP BB

WHERE WHERE AA.EMP_ID=.EMP_ID=BB.EMP_ID AND.EMP_ID AND

AA.OFFICE_ID = .OFFICE_ID = BB.OFFICE_ID.OFFICE_ID

GROUP BY EMP_ID, OFFICE_ID);GROUP BY EMP_ID, OFFICE_ID);

Page 21: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Identify and Delete Duplicate RecordsIdentify and Delete Duplicate RecordsTable Example, with duplicate values:

SQL>SQL> SELECT * FROM EMP;SELECT * FROM EMP;EMP_IDEMP_ID OFFICE_IDOFFICE_ID EMPNAMEEMPNAME

305305 1212 ELLISON, GEORGEELLISON, GEORGE

305305 1212 MERCURIO, JASONMERCURIO, JASON

128128 1717 SIMPSON, LINDASIMPSON, LINDA

305305 2222 JACKSON, DREWJACKSON, DREW

To delete all of the duplicates (leaving just one of the set):To delete all of the duplicates (leaving just one of the set):

SQL> SQL> DELETE FROM EMP DELETE FROM EMP AA

WHERE WHERE ROWID ROWID > (> (

SELECT SELECT min(rowid)min(rowid) FROM EMP FROM EMP BB

WHERE WHERE AA.EMP_ID = .EMP_ID = BB.EMP_ID AND.EMP_ID AND

AA.OFFICE_ID = .OFFICE_ID = BB.OFFICE_ID);.OFFICE_ID);

Page 22: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

OS Commands and UtilitiesOS Commands and Utilities oerroerr> oerr ora 3200> oerr ora 320003200, 00000, "the segment type specification is invalid"03200, 00000, "the segment type specification is invalid"// *Cause: segment type is not TABLE, INDEX, or CLUSTER// *Cause: segment type is not TABLE, INDEX, or CLUSTER// *Action: use a correct segment type// *Action: use a correct segment type

dbv (db verify)dbv (db verify)> dbv file=system_01.dbf feedback=100> dbv file=system_01.dbf feedback=100 DBVERIFY: Release 8.1.6.0.0 - Wed Jul 4 09:15:04 1999 DBVERIFY: Release 8.1.6.0.0 - Wed Jul 4 09:15:04 1999 Copyright (c) Oracle Corporation 1979, 1994. All rights reserved. Copyright (c) Oracle Corporation 1979, 1994. All rights reserved. DBVERIFY - Verification starting : FILE = system_01.dbf DBVERIFY - Verification starting : FILE = system_01.dbf ..................................................................................................................................................

..............DBVERIFY - Verification complete DBVERIFY - Verification complete Total Pages Examined : 9216 Total Pages Examined : 9216 Total Pages Processed (Data) : 2044 Total Pages Processed (Data) : 2044 Total Pages Failing (Data) : 0 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 733 Total Pages Processed (Index): 733 Total Pages Failing (Index): 0 Total Pages Failing (Index): 0 Total Pages Empty : 5686 Total Pages Empty : 5686 Total Pages Marked Corrupt : 0 Total Pages Marked Corrupt : 0 Total Pages Influx : 0Total Pages Influx : 0

Page 23: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

OS Commands and UtilitiesOS Commands and Utilities unixenvunixenv oraenvoraenv> oraenv> oraenvORACLE_SID = [QHIS] ? THISORACLE_SID = [QHIS] ? THIS

ORACLE_HOME = [/home/oracle] ?ORACLE_HOME = [/home/oracle] ?

ipcs -aipcs -aT ID KEY MODE OWNER GROUP CREATOR CGROUP CBYTES QNUM T ID KEY MODE OWNER GROUP CREATOR CGROUP CBYTES QNUM

QBYTES LSPID LRPID STIME RTIME CTIMEQBYTES LSPID LRPID STIME RTIME CTIME

Message Queues:Message Queues:

q 0 0x3c180330 -Rrw--w--w- root root root root 0 q 0 0x3c180330 -Rrw--w--w- root root root root 0 0 32768 0 0 no-entry no-entry 13:48:08 0 32768 0 0 no-entry no-entry 13:48:08

PID LPID ATIME DTIME CTIMEPID LPID ATIME DTIME CTIME

Shared Memory:Shared Memory:

m 0 0x2f140002 --rw------- root sys root sys 2 m 0 0x2f140002 --rw------- root sys root sys 2 1286144 894 2:16:36 no-entry 2:16:361286144 894 2:16:36 no-entry 2:16:36

m 10 0x83e2a3c0 --rw-r----- oracle dba oracle dba 19 m 10 0x83e2a3c0 --rw-r----- oracle dba oracle dba 19 82288640 22369 24272 16:45:30 16:56:48 9:00:5982288640 22369 24272 16:45:30 16:56:48 9:00:59

T ID KEY MODE OWNER GROUP CREATOR CGROUP NSEMS T ID KEY MODE OWNER GROUP CREATOR CGROUP NSEMS OTIME CTIMEOTIME CTIME

Semaphores:Semaphores:

s 0 0x2f140002 --ra-ra-ra- root sys root sys 6 s 0 0x2f140002 --ra-ra-ra- root sys root sys 6 2:16:39 13:48:042:16:39 13:48:04

s 18 0x00000000 --ra-r----- oracle dba oracle dba 150 16:55:54 9:00:59

Page 24: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Files that Grow by DefaultFiles that Grow by Default the listener.log filethe listener.log file

$ORACLE_HOME/network/log

the alert_{SID}.log filethe alert_{SID}.log file $ORACLE_BASE/admin/{ORACLE_SID}/bdump

default audit filesdefault audit files $ORACLE_HOME/rdbms/audit

background dump filesbackground dump files $ORACLE_BASE/admin/{SID}/bdump

$ORACLE_BASE/admin/{SID}/cdump

$ORACLE_BASE/admin/{SID}/udump

Page 25: More Tips and Techniques for DBAs and Developers Malesh Gummula  Independent Consultant

Where to Now?Where to Now? malu’s free Oracle Tips web page at:malu’s free Oracle Tips web page at:

There are over 370 tips and answers to questions that have been There are over 370 tips and answers to questions that have been

posed to me over the years. This paper will be downloadable from posed to me over the years. This paper will be downloadable from

the web page as well.the web page as well.

Other good sites with links: Other good sites with links: www.orafaq.org, www.orafans.com, www.orafaq.org, www.orafans.com, www.ioug.org, www.orasearch.com, www.revealnet.com, www.ioug.org, www.orasearch.com, www.revealnet.com, www.lazydba.com, www.dbdomain.comwww.lazydba.com, www.dbdomain.com