Cannot create a trigger [message #526233] |
Mon, 10 October 2011 05:03 |
zabltn
Messages: 45 Registered: September 2011
|
Member |
|
|
Okay now i can log in but here i faced with another erorr, while i am creating a trigger it gives the following erorr:
SQL> ed
Wrote file afiedt.buf
1 create or replace trigger trgr
2 before insert on myTable
3 for each row
4 begin
5 select mySequence.nextval into :new.ID from dual;
6* end;
SQL> /
create or replace trigger trgr
*
ERROR at line 1:
ORA-04089: cannot create triggers on objects owned by SYS
note: i tried and gave different names for the trigger, still it is the same.
|
|
|
|
Re: User login fails [message #526248 is a reply to message #526240] |
Mon, 10 October 2011 05:47 |
zabltn
Messages: 45 Registered: September 2011
|
Member |
|
|
Okay thanks i will, but what do you mean by dont use SYS objects, i have not used any SYS object i just tried to create a trigger in my own user and it fails, gives the above erorr.
|
|
|
Re: User login fails [message #526264 is a reply to message #526248] |
Mon, 10 October 2011 06:34 |
|
Littlefoot
Messages: 21808 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I believe that Michel's objection refers this line:ORA-04089: cannot create triggers on objects owned by SYS
As you saidcreate or replace trigger trgr
before insert on myTable and Oracle replied that it can not create trigger on an object owned by SYS, it means that myTable is owned by SYS. It doesn't matter that it was you (zabltn) who created a table (typing CREATE TABLE myTable ...) - it is still owned by SYS, as you were logged in as SYS.
You should create your own user (or, if you don't want to bother, SCOTT's schema would be OK) and practice your skills there.
[Updated on: Mon, 10 October 2011 06:35] Report message to a moderator
|
|
|
|
|
Re: User login fails [message #526398 is a reply to message #526264] |
Mon, 10 October 2011 23:26 |
zabltn
Messages: 45 Registered: September 2011
|
Member |
|
|
Dear Littlefoot,
Thanks but i have created either the table and tha trigger by the same newly created user <user1>, the table and sequence was created successfuly but it gives the erorr by creating the trigger.
[Updated on: Mon, 10 October 2011 23:30] Report message to a moderator
|
|
|
|
Re: User login fails [message #526400 is a reply to message #526398] |
Mon, 10 October 2011 23:55 |
zabltn
Messages: 45 Registered: September 2011
|
Member |
|
|
Dear Sai Pradyumn,
Here is what i have done:
SQL> conn user1/user1 @myNSN as sysdba
Connected.
SQL> create table myTable (ID number);
Table created.
SQL> select owner from all_tables where table_name= 'MYTABLE';
OWNER
------------------------------
SYS
SQL> ed
Wrote file afiedt.buf
1 create or replace trigger trgr
2 before insert on myTable
3 for each row
4 begin
5 select mySequence.nextval into :new.ID from dual;
6* end;
SQL> /
create or replace trigger trgr
*
ERROR at line 1:
ORA-04089: cannot create triggers on objects owned by SYS
I have created with the user <user1> now please let me know where is my misstake, or if it is okay then why still it says SYS.
Dear BlackSwan you can see it in the above example.
[Updated on: Tue, 11 October 2011 00:07] Report message to a moderator
|
|
|
|
|
Re: User login fails [message #526417 is a reply to message #526411] |
Tue, 11 October 2011 01:00 |
zabltn
Messages: 45 Registered: September 2011
|
Member |
|
|
Michel, Thank you very much for always giving the neccessary information.
But friends, i had tried to login without the sysdba rule but then it would give erorr for the privilege.
SQL> conn user1/user1 @myNSN
Connected.
SQL> create table tbl (ID number);
create table tbl (ID number)
*
ERROR at line 1:
ORA-01031: insufficient privileges
[Updated on: Tue, 11 October 2011 01:02] Report message to a moderator
|
|
|
|
|
Re: User login fails [message #526422 is a reply to message #526419] |
Tue, 11 October 2011 01:14 |
zabltn
Messages: 45 Registered: September 2011
|
Member |
|
|
Exactly, i had tried to grant some privileges but then it gives error that you have to be SYS to grant a privilege, but i dont know the password for the SYS user i am not able to login as a SYS.
Therefor can you please tell me how to grant a powerfull privilege for the user user1 like the SYSDBA power to be able to do create, drop... objects, while i dont know the SYS user password.
|
|
|
|
Re: User login fails [message #526425 is a reply to message #526424] |
Tue, 11 October 2011 01:24 |
|
Michel Cadot
Messages: 68645 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Quote:Exactly, i had tried to grant some privileges but then it gives error that you have to be SYS to grant a privilege,
This is not true, you have to be a DBA (or something like that) but surely NOT SYS/SYSDBA.
Quote: but i dont know the password for the SYS user i am not able to login as a SYS.
As you previously saw when you connect AS SYSDBA then you are SYS, you don't need SYS password.
Connecting AS SYSDBA is like "su" in Unix, you connect from your user to SYS.
I advise you to:
1/ As SYS, create a new account, say "userdba", that you will give it DBA role.
2/ From this new account, make the account management like granting CREATE TABLE to your previous user (user1).
3/ Play with "user1" to make your tests.
Regards
Michel
|
|
|
Re: User login fails [message #526442 is a reply to message #526425] |
Tue, 11 October 2011 02:26 |
zabltn
Messages: 45 Registered: September 2011
|
Member |
|
|
Thanks, i did the following steps, now please tell me should i give the default tablespace which is in my case SYSTEM or i have to create a new tablespace.
SQL> create user user2 identified by user2;
User created.
SQL> conn user2/user2 @myNSn as sysdba
Connected.
SQL> grant create any table to user1;
Grant succeeded.
SQL> conn user1/user1 @myNSN
Connected.
SQL> create table tbl(ID number);
create table tbl(ID number)
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'SYSTEM'
|
|
|
|
|
|
|
Re: User login fails [message #526640 is a reply to message #526639] |
Wed, 12 October 2011 02:51 |
|
Michel Cadot
Messages: 68645 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
It is better to create your own "DBA" role or roles with the necessary privileges to allow the dbas to make their tasks (which can be different depending on the dba, for instance depending on his/her level or skills).
Regards
Michel
|
|
|