How to create non sys tables in Oracle?

I tried to create a trigger:

create trigger afterupdate after insert on friends for each row begin dbms_output.put_line('hello world'); end afterupdate; 

However, the following error appeared:

 "cannot create triggers on objects owned by SYS" 
+7
oracle
source share
2 answers

Given this error, I assume that you log into the database as SYS to create your tables and write your code. You do not want to use the SYS schema for this: you should never create objects in the SYS schema. You will need to enter the database as another user. In general, if you are creating a completely new application, you must create a new user who will own all the objects for the new application.

For example, if you are creating a Facebook clone and want to use the USERS tablespace for your data

 CREATE USER facebook_appid IDENTIFIED BY <<password>> DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP; GRANT CREATE SESSION, CREATE TABLE, CREATE TRIGGER TO facebook_appid; 

Then you must connect to the database as facebook_appid using the password you provided.

 sqlplus facebook_appid/<<password>>@<<TNS alias>> 

Once you do this, you can create a table and trigger.

+6
source share

I think this is a privilege. You are trying to create a trigger on a table that is in the SYS schema, and you do not have privileges to do so.

Please go to the SYS schema and grant the user the right to create a trigger in the table.

-2
source share

All Articles