Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
Debug DDL trigger

Debug DDL trigger

2005-08-24       - By rjamya

Reply:     <<     11     12     13     14     15     16     17  

Not true, see below for an example on 9204

SQL> get t1.sql
1 conn t1/t1
2 create table t1.some_tbl tablespace cons
3 as select * from dba_objects where rownum < 100
4 /
5 drop trigger raj_test_trig
6 /
7 alter session set events '10046 trace name context forever, level 4'
8 /
9 CREATE OR REPLACE TRIGGER raj_test_trig
10 BEFORE DDL ON SCHEMA
11 DECLARE
12 PRAGMA AUTONOMOUS_TRANSACTION;
13 v_datestamp DATE := sysdate;
14 v_ddl_stmt VARCHAR2(4000);
15 v_ora_error NUMBER;
16 v_table_count PLS_INTEGER := 1;
17 BEGIN
18 dbms_output.enable(1000000);
19 dbms_output.put_line('Trigger: checking for table');
20 dbms_output.put_line('Trigger: sysevent is ' || ora_sysevent);
21 if ora_sysevent = 'DROP' then
22 SELECT COUNT(*) INTO v_table_count
23 FROM user_tables
24 WHERE table_name = ora_dict_obj_name;
25 dbms_output.put_line('Trigger: table count is ' || v_table_count);
26 IF v_table_count > 0 THEN
27 v_ddl_stmt := 'CREATE TABLE t1.'||ora_dict_obj_name||'_bkp AS SELECT *
FROM t1.'||ora_dict_obj_name;
28 dbms_output.put_line('Trigger cmd: ' || v_ddl_stmt);
29 EXECUTE IMMEDIATE v_ddl_stmt;
30 END IF;
31 END IF;
32 END;
33 /
34 set serveroutput on
35 drop table some_tbl;
36* select table_name from user_tables;

SQL> @(protected)
Connected.
create table t1.some_tbl tablespace cons
*
ERROR at line 1:
ORA-00955 (See ORA-00955.ora-code.com): name is already used by an existing object



Trigger dropped.


Session altered.


Trigger created.

drop table some_tbl
*
ERROR at line 1:
ORA-00604 (See ORA-00604.ora-code.com): error occurred at recursive SQL level 1
ORA-06519 (See ORA-06519.ora-code.com): active autonomous transaction detected and rolled back
ORA-06512 (See ORA-06512.ora-code.com): at line 19

TABLE_NAME
-- ---- ---- ---- ---- ---- --
SOME_TBL

SQL> connect / as sysdba
Connected.
SQL> drop table t1.some_tbl;

Table dropped.


Raj

On 8/24/05, Jared Still <jkstill@(protected)> wrote:
>
> I believe the triggers that Raj was thinking of were logon triggers.
>
> Those do not fire for accounts with the DBA privilege.
>
> Jared
>
> On 8/23/05, Wolfgang Breitling <breitliw@(protected)> wrote:
> >
> > At 08:08 AM 8/23/2005, rjamya wrote:
> > >psst: for all this to succeed, you should be a non-dba user ...
> > >these triggers don't fire for people with DBA privs.
> >
> > Not quite correct. They don't fire for sys, but they DO fire for
> > ordinary users, even those with the DBA role.
> >
> >
> > Regards
> >
> > Wolfgang Breitling
> > Centrex Consulting Corporation
> > http://www.centrexcc.com
> >
> > --
> > http://www.freelists.org/webpage/oracle-l
> >
>
>
>
> --
> Jared Still
> Certifiable Oracle DBA and Part Time Perl Evangelist
>
>


--
-- ---- ---- ---- ---- ---- --
select standard_disclaimer from company_requirements where category =
'MANDATORY';

Not true, see below for an example on 9204<br>
<br>
SQL&gt; get t1.sql<br>
&nbsp; 1&nbsp; conn t1/t1<br>
&nbsp; 2&nbsp; create table t1.some_tbl tablespace cons<br>
&nbsp; 3&nbsp; as select * from dba_objects where rownum &lt; 100<br>
&nbsp; 4&nbsp; /<br>
&nbsp; 5&nbsp; drop trigger raj_test_trig<br>
&nbsp; 6&nbsp; /<br>
&nbsp; 7&nbsp; alter session set events '10046 trace name context forever,
level 4'<br>
&nbsp; 8&nbsp; /<br>
&nbsp; 9&nbsp; CREATE OR REPLACE TRIGGER raj_test_trig<br>
&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp; BEFORE DDL ON SCHEMA<br>
&nbsp;11&nbsp; DECLARE<br>
&nbsp;12&nbsp;&nbsp;&nbsp;&nbsp; PRAGMA AUTONOMOUS_TRANSACTION;<br>
&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp; v_datestamp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp; DATE := sysdate;<br>
&nbsp;14&nbsp;&nbsp;&nbsp;&nbsp; v_ddl_stmt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; VARCHAR2(4000);<br>
&nbsp;15&nbsp;&nbsp;&nbsp;&nbsp; v_ora_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp; NUMBER;<br>
&nbsp;16&nbsp;&nbsp;&nbsp;&nbsp; v_table_count&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; PLS_INTEGER := 1;<br>
&nbsp;17&nbsp; BEGIN<br>
&nbsp;18&nbsp;&nbsp;&nbsp;&nbsp; dbms_output.enable(1000000);<br>
&nbsp;19&nbsp;&nbsp;&nbsp;&nbsp; dbms_output.put_line('Trigger: checking for
table');<br>
&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp; dbms_output.put_line('Trigger: sysevent is ' |
| ora_sysevent);<br>
&nbsp;21&nbsp;&nbsp;&nbsp;&nbsp; if ora_sysevent = 'DROP' then<br>
&nbsp;22&nbsp;&nbsp;&nbsp;&nbsp; SELECT COUNT(*) INTO v_table_count<br>
&nbsp;23&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM user_tables<br>
&nbsp;24&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE table_name = ora_dict_obj_name;<br>
&nbsp;25&nbsp;&nbsp;&nbsp;&nbsp; dbms_output.put_line('Trigger: table count is
' || v_table_count);<br>
&nbsp;26&nbsp;&nbsp;&nbsp;&nbsp; IF v_table_count &gt; 0 THEN<br>
&nbsp;27&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_ddl_stmt :=
'CREATE TABLE t1.'||ora_dict_obj_name||'_bkp AS SELECT * FROM
t1.'||ora_dict_obj_name;<br>
&nbsp;28&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dbms_output.put_line(
'Trigger cmd: ' || v_ddl_stmt);<br>
&nbsp;29&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXECUTE IMMEDIATE v_ddl_stmt
;<br>
&nbsp;30&nbsp;&nbsp;&nbsp;&nbsp; END IF;<br>
&nbsp;31&nbsp;&nbsp;&nbsp;&nbsp; END IF;<br>
&nbsp;32&nbsp; END;<br>
&nbsp;33&nbsp; /<br>
&nbsp;34&nbsp; set serveroutput on<br>
&nbsp;35&nbsp; drop table some_tbl;<br>
&nbsp;36* select table_name from user_tables;<br>
<br>
SQL&gt; @(protected)<br>
Connected.<br>
create table t1.some_tbl tablespace cons<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; *<br>
ERROR at line 1:<br>
ORA-00955 (See ORA-00955.ora-code.com): name is already used by an existing object<br>
<br>
<br>
<br>
Trigger dropped.<br>
<br>
<br>
Session altered.<br>
<br>
<br>
Trigger created.<br>
<br>
drop table some_tbl<br>
*<br>
ERROR at line 1:<br>
ORA-00604 (See ORA-00604.ora-code.com): error occurred at recursive SQL level 1<br>
ORA-06519 (See ORA-06519.ora-code.com): active autonomous transaction detected and rolled back<br>
ORA-06512 (See ORA-06512.ora-code.com): at line 19<br>
<br>
TABLE_NAME<br>
-- ---- ---- ---- ---- ---- --<br>
SOME_TBL<br>
<br>
SQL&gt; connect / as sysdba<br>
Connected.<br>
SQL&gt; drop table t1.some_tbl;<br>
<br>
Table dropped.<br>
<br>
<br>
Raj<br><br><div><span class="gmail_quote">On 8/24/05, <b class="gmail
_sendername">Jared Still</b> &lt;<a href="mailto:jkstill@(protected)">jkstill
@(protected)</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border
-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left:
1ex;">
I believe the triggers that Raj was thinking of were logon triggers.<br>
<br>
Those do not fire for accounts with the DBA privilege.<br>
<br>
Jared<br><br><div><span class="gmail_quote">On 8/23/05, <b class="gmail
_sendername">Wolfgang Breitling</b> &lt;<a href="mailto:breitliw@(protected)"
target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
breitliw@(protected)</a>&gt; wrote:</span><blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex;
padding-left: 1ex;">
At 08:08 AM 8/23/2005, rjamya wrote:<br>&gt;psst: for all this to succeed, you
should be a non-dba user ...<br>&gt;these triggers don't fire for people with
DBA privs.<br><br>Not quite correct. They don't fire for sys, but they DO fire
for
<br>ordinary users, even those with the DBA role.<br><br><br>Regards<br><br
>Wolfgang Breitling<br>Centrex Consulting Corporation<br><a href="http://www
.centrexcc.com" target="_blank" onclick="return top.js.OpenExtLink(window,event
,this)">
http://www.centrexcc.com</a><br><br>--<br><a href="http://www.freelists.org
/webpage/oracle-l" target="_blank" onclick="return top.js.OpenExtLink(window
,event,this)">
http://www.freelists.org/webpage/oracle-l</a><br></blockquote></div><span class
="sg"><br><br clear="all"><br>-- <br>Jared Still<br>Certifiable Oracle DBA and
Part Time Perl Evangelist<br><br>

</span></blockquote></div><br><br clear="all"><br>-- <br>-- ---- ---- ---- ----
-- -----<br>select standard_disclaimer from company_requirements where category
= 'MANDATORY';<br>