Good article to understand error management with PL/SQL
http://www.oracle.com/technetwork/issue-archive/2005/05-mar/o25plsql-093886.html
Oracle DBA
create or replace trigger trigger_01
before insert on test
for each row
follows trigger_02
....
create or replace trigger trigger_02
before insert on test
for each row
[oracle@oratest01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Tue Jun 23 02:00:05 2009
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges
SQL> create table vty_ra1 (a varchar2(10)); SQL> alter table vty_ra1 modify a clob; ORA-22858: invalid alteration of datatype
alter table vty_ra1 modify a long;
alter table vty_ra1 modify a clob;
INF - RMAN-00571: =========================================================== INF - RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== INF - RMAN-00571: =========================================================== INF - Recovery Manager complete. INF - End of Recovery Manager output. INF - End Oracle Recovery Manager.
CauseCatalog db's tns entry must be in tnsnames.ora.
Check your $ORACLE_HOME/network/admin/tnsnames.ora file.
export ORACLE_HOME=# detach $ORACLE_HOME/oui/bin/runInstaller -detachHome -silent -local ORACLE_HOME=$ORACLE_HOME # confirm: $ORACLE_HOME/OPatch/opatch lsinventory -all # remove directory rm -rf $ORACLE_HOME
When you upgrade database to 11g r2 when running catupgrd.sql SQL> SELECT TO_NUMBER('MUST_BE_SAME_TIMEZONE_FILE_VERSION') 2 FROM sys.props$ 3 WHERE 4 ( 5 ((SELECT TO_NUMBER(value$) from sys.props$ 6 WHERE name = 'DST_PRIMARY_TT_VERSION') != 7 (SELECT tz_version from registry$database)) 8 AND 9 (((SELECT substr(version,1,4) FROM registry$ where cid = 'CATPROC') = 10 '9.2.') OR 11 ((SELECT substr(version,1,4) FROM registry$ where cid = 'CATPROC') = 12 '10.1') OR 13 ((SELECT substr(version,1,4) FROM registry$ where cid = 'CATPROC') = 14 '10.2') OR 15 ((SELECT substr(version,1,4) FROM registry$ where cid = 'CATPROC') = 16 '11.1')) 17 ); SELECT TO_NUMBER('MUST_BE_SAME_TIMEZONE_FILE_VERSION') * ERROR at line 1: ORA-01722: invalid number control following steps SQL> SELECT * FROM v$timezone_file; FILENAME VERSION -------------------- ---------- timezlrg_14.dat 14 SQL> select TZ_VERSION from registry$database; TZ_VERSION ---------- 4 If version of timezone_file is different than TZ_VERSION run following update. SQL> update registry$database set TZ_VERSION = (select version FROM v$timezone_file); SQL> commit; try to run catupgrd.sql
import java.sql.*; class Conn { public static void main (String[] args) throws Exception { Class.forName ("oracle.jdbc.OracleDriver"); Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger"); try { Statement stmt = conn.createStatement(); try { ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION"); try { while (rset.next()) System.out.println (rset.getString(1)); // Print col 1 } finally { try { rset.close(); } catch (Exception ignore) {} } } finally { try { stmt.close(); } catch (Exception ignore) {} } } finally { try { conn.close(); } catch (Exception ignore) {} } } }
("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger");
drop TYPE appuser.table_logtable;
CREATE OR REPLACE
TYPE bankdb.type_hpl_heslog AS OBJECT
(col1 DATE,
col2 VARCHAR2(14)
)
/
CREATE OR REPLACE
TYPE appuser.table_logtable AS TABLE OF type_logtable;
select * from dba_dependencies
where name = 'TYPE_LOGTABLE' and owner='APPUSER';
col machine format a20
col osuser format a20
select s.sid,s.username, s.osuser, s.machine, sum(u.extents) from V$TEMPSEG_USAGE u, v$session s
where s.saddr=u.session_addr
group by sid,s.username, s.osuser, s.machine
order by 5 desc;
SID USERNAME OSUSER MACHINE SUM(U.EXTENTS)
---------- ------------------------------ -------------------- -------------------- --------------
1718 APPUSER orauser2 node1 7561
2170 RAMAZAN rozturk DOMAIN\PCRAMAZAN 120
3358 OTHERUSER SYSTEM node3 11
SQL> select sum(bytes) from dba_free_space where tablespace_name='UNDOTBS'; SUM(BYTES) ---------- 1080098816--select extent total size by grouping status
SQL> SELECT DISTINCT STATUS, SUM (BYTES), COUNT (*) FROM DBA_UNDO_EXTENTS GROUP BY STATUS; STATUS SUM(BYTES) COUNT(*) --------- ------------------ ---------------- ACTIVE 18481152 17 EXPIRED 14417920 220 UNEXPIRED 2064187392 8695
SQL> show parameter undo NAME TYPE VALUE ------------------------------------ -------------------------------- ----------- undo_management string AUTO undo_retention integer 3600 undo_tablespace string UNDOTBS
you can set "_undo_autotune" and undo_retention parameters to trigger clearing unexpired extents which no one in use.
ALTER SYSTEM SET "_undo_autotune"=FALSE; ALTER SYSTEM SET undo_retention=3600;
SQL> select count(*) from v$session; COUNT(*) ---------- 503
SQL> select 'alter system kill session '''||sid||','||serial#||''' immediate;' cmd from v$session where last_call_et>600 and status='INACTIVE'; CMD ---------------------------------------------------------------------- alter system kill session '3803,3' immediate; alter system kill session '3806,5' immediate; alter system kill session '3811,3' immediate; alter system kill session '3813,10' immediate; alter system kill session '3814,20' immediate; alter system kill session '3816,14' immediate; alter system kill session '3823,135' immediate; alter system kill session '3824,25' immediate; .....