Help Importing objects from 1 user to another user and problem with trigger

Hello community, i am having a little difficulty with the exporting objects from one user to another specifically the exporting of the trigger.
Here is the situation, because of SOX purpose whenever a update is sent to the client the dba have to execute the script as himself (priviliged user) and is not allowed to log into the schema to make changes. Therefore we perpend the object definitions with &user_schema.. and they define user_schema in sqlplus and execute the update script.
Here is a small example which requires two users (user1 and user2) with the following grants (connect, create table, create trigger, create view, create sequence). Please forgive the naming of the objects, just trying to be as simple as possible.
I start out by logging in as system user via sqlplus and execute the following.
------------------Begin sqlplus----------------------
define user_schema=user1;
create table &user_schema..abc01 (
  col1 number,
  col2 varchar2(20),
  col3 number,
  constraint pk_abc01_col1 primary key (col1)
create table &user_schema..xyz01 (
  col1 number,
  col2 varchar2(20),
  col3 number,
  constraint pk_xyz01_col1 primary key (col1)
create or replace view &user_schema..view1 as
select x.col1, x.col2, x.col3, a.col1 as acol1, a.col2 as acol2, a.col3 as acol3
from xyz01 x
inner join abc01 a on a.col1 = x.col1;
create sequence &user_schema..seq_xyz01 start with 1 increment by 1;
create or replace trigger &user_schema..trig01
before insert on &user_schema..xyz01 for each row
begin
  if (nvl(:new.col1, -1) = -1) then
    select seq_xyz01.nextval into :new.col1 from dual;
  end if;
end;
/--------------------End sqlplus----------------------
I would then proceed to export using the exp utility via the command line
exp system/systempassword file=user1.dmp owner=user1
Then import user1 objects into user2
imp system/systempassword file=user1.dmp fromuser=user1 touser=user2
Now the problem:
When i take a look at the sql for user2 trigger (trig01) i see the following (viewed via sqldeveloper)
create or replace TRIGGER "USER2".trig01
before insert on user1.xyz01 for each row
begin
  if (nvl(:new.col1, -1) = -1) then
    select seq_xyz01.nextval into :new.col1 from dual;
  end if;
end;its referring to user1.xyz01 table, however i want it to point to is user2.xyz01 table. Can someone please help me out or offer another solution to go about this because i need the ability to import the objects into a different user without the import failing and having to recompile the object.
I've also tried executing this while connected as system user via sqlplus:
define user_schema=user1
create or replace trigger &user_schema..trig01
before insert on xyz01 for each row
begin
  if (nvl(:new.col1, -1) = -1) then
    select seq_xyz01.nextval into :new.col1 from dual;
  end if;
end;
/but that fails stating that table or view does not exist, please help
however that fails because i
Edited by: user3868150 on Nov 6, 2009 6:05 PM

When performing an update in their system, the same script will be run with different values, thats not the problem.
The client currently have just that one schema in their environment, however they want to have another instance of the application set up in their environment (same database) and have that go off on its own track separate from the original application.
Now when we do an exp of the schema and the imp it into another user it get imported, however its incorrect. As stated before the trigger will be acting on the table in the original schema when it should be acting on the table in the newly imported schema.
I suppose there is no other way around this when a trigger is created the way in which i outlined above. I guess after the data gets imported into a different user the trigger would have to be recompiled to point to the correct table.
If you have an alternate solution to go about this i am open to suggestions. However like i mentioned in the original post because of SOX purpose the dba is not allowed to log in and execute update scripts as the schema user. The scripts should only be executed as that privileged user (dba).
Also if i hard code the user when the trigger is created
create or replace trigger user1.trig01
before insert on user1.xyz01 for each row
begin
if (nvl(:new.col1, -1) = -1) then
select seq_xyz01.nextval into :new.col1 from dual;
end if;
end;
/it still doesn't get imported the way that i want it to be imported in user2
create or replace TRIGGER "USER2".trig01
before insert on user1.xyz01 for each row
begin
  if (nvl(:new.col1, -1) = -1) then
    select seq_xyz01.nextval into :new.col1 from dual;
  end if;
end;now when i do an insert to test
insert into user1.xyz01 (col2, col3) values ('abc', 123); -- Works fine, no problems here
insert into user2.xyz01 (col2, col3) values ('abc', 123);Results in an error ORA-01400: cannot insert NULL into ("USER2".XYZ01"."COL1") because the trigger doesn't exist on user2.xyz01 table.
Just try and create the schema like how i outlined above in your environment to see what i'm talking about. It seems that the only way to get the trigger to be imported the way i want it to is to actually log in as that user and create the trigger.
sqlplus user1/user1
{code}
create or replace trigger trig01
before insert on xyz01 for each row
begin
if (nvl(:new.col1, -1) = -1) then
select seq_xyz01.nextval into :new.col1 from dual;
end if;
end;
{code}
Edited by: user3868150 on Nov 6, 2009 6:10 PM

Similar Messages

  • How can we import object from 1 user to another user using DATA PUMP

    hi,
    i have taken full export by EXPDP( data pump) now i want to import user objects from target user of one database to another user of different database.
    plz reply me solution
    Thanks

    Hi,
    impdp 'user/user@db' DIRECTORY=DATA_PUMP_DIR(DEFAULT) DUMPFILE=FILENAME.dmp LOGFILE=IMPORT.LOG REMAP_SCHEMA=SOURCE SCHEMA:TArget SCHEMA
    1.Before Import check whether user importing has read,write on directory.
    2.Always Try to Add logfile clause This will help.
    3.Add TABLE_EXISTS_ACTION=REPLACE if you want target schema tables to be replaced by source schema table(if both has same table)
    Regards,
    NEerav

  • Using the Import utility from other users and going to a different schema

    I has a user today with rights
    Insert into XXXX.TABLE values(); Works just fine for another schema's table which has select,insert,update,delete.
    We tried to utiile the import utility from OTHER USERS
    Insert failed ORA-00942
    Do you want ot ignore all errors
    Even though we have rights to the schema under OTHER USERS.
    When connected as the owner it works fine.

    I've be trying to find a work-around to this issue & found this old post -- I'm having the same problem.
    I'm using Oracle 11g and SD 2.1.1.64.
    I have user A with a table that grants select,insert,update, and delete privs to user B. Logging into user B I, of course, can do inserts, deletes, etc. on the the table in user A's schema.
    When I use the import data feature to load data from a CSV file I can't get it to work while logged into user B. It does work fine if logged into user A. It looks like the issue may be that it doesn't put the schema prefix of "A." on the insert statements.
    Has anyone found a way to get around this issue yet?

  • Cannot import object from one user to another user

    hi,
    I tried importing a table which contains objects of type varray. The imp.exe did not import the types and table containing the objects. The table contains data. How to do it. I am using Oracle 8.1.7
    Anto Paul

    If you want to create that table in one enviroment and the another table is in other database you can make this :
    CREATE TABLE TABLE1 AS SELECT * FROM SCHEMA_NAME.TABLE2 ( this case apply if the another table is in your database )
    or
    CREATE TABLE TABLE1 AS SELECT * FROM SCHEMA_NAME@DATABASE_LINK
    ( this case apply if the another table is in other database )
    [email protected]
    Joel P�rez

  • Anything containing or involving Adobe causes my pc to "freeze".. this was not a problem until the last "forced" update from firefox... any help out there from you firefox people... same problem with other webbrowsers as well...

    pc goes "to sleep" trying to "fix problem", to end it, i have to force close

    This article may help: A flashing question mark appears when you start your Mac.

  • Help flashing do not disconnet won't go away and problem with video

    Hi - when I go into the options to set my music download etc, the page for video is grey and will not allow me to select automatic updates. When I drag the video over it says it has been unable to install it.
    It now also keeps flashing the 'do not disconnet screen'
    I am technophobic so really need help. My hubby bought this for my christmas as I love music but I am lost - it is the 60 GB version so there is loads of room.

    If your ipod is a 60gig one, you have a fifth generation ipod (As known as ipod video)
    this is the correct forum for your answer
    http://discussions.apple.com/forum.jspa?forumID=808
    i would like to help you, but i never used and ipod video.
    good luck

  • I want to copy all the objects from one user to another... Please help

    Hii Experts.... I have a problem here. Please give me solution for this...
    I am using Oracle 11g on my windows XP system.
    I created a new user named "some"
    I want to copy all the objects from scott user to some user... Please help me
    Please Explain me in detailed way
    Thank you

    SowmyRaj wrote:
    Hii Experts.... I have a problem here. Please give me solution for this...
    I am using Oracle 11g on my windows XP system.
    I created a new user named "some"
    I want to copy all the objects from scott user to some user... Please help me
    If all what you are interested is Scott schema than no need to use the datapump or CTAS. Run demobld.sql in your schema and it would have all the objects of Scott.
    http://www.oracle.com/technology/sample_code/tech/sql_plus/htdocs/demobld.html
    HTH
    Aman....

  • How to move database objects from one user to another user

    Could someone help how to move database objects from one user to another user
    Thanks in advance

    Thanks a lot for the reply.
    Actually I wanted to know whether there is any command to change the owner ship of the table.
    For ex table1 belongs to user1. can the owner of table1 to be changed to owner2.
    directly using an oracle command. I knew that it can be done using import and export, since the table was 200 million thought the rename command would be faster instead of import and export.
    Thanks Billy for letting me know that it is not possible using oracle query.

  • Copy Users/Permissions/objects from a database to another database

    Can anyone help me how to copy users, permissions, stored procedures, views, functions and all other objects from one database to another database.
     I need a SQL Script to get this job done. I cannot use backup restore or SSIS Package.

    There's also a transfer sqlserver objects task available in SSIS
    http://www.mssqltips.com/sqlservertip/2064/transfer-database-task-and-transfer-sql-server-objects-task-in-ssis/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How can you move the objects from one server to another?

    how can you move the objects from one server to another?

    Hi,
    Collecting objects for Transporting
    1. rsa1->transport connection
    2. left panel choose 'object type', middle panel choose 'infocube' and 'select objects'
    3. then choose your infocube and 'transfer'
    4. will go to right panel, choose collection mode 'manual' and grouping only 'necessary objects'
    5. after objects collection finished, create request
    6. If they are $TMP, then change the package.
    7. When you click the Save on the change package, it will prompt for transport. Here you can provide an existing open transport request number, or if you like here itself you can create a new one.
    8. You can check the request in SE09 to confirm.
    Releasing Transport Request  
    Lets say you are transporting from BWD to BWQ
    Step 1: In BWD go to TCode SE10
    Step 2: Find the request and release it (Truck Icon or option can be found by right click on request #)
    Note: First release the child request and then the parent request
    Steps below are to import transport (generally done by basis )
    Step 1: In BWQ go to Tcode STMS
    Step 2: Click on Import queue button
    Step 3: Double Click on the line which says BWQ (or the system into which transport has to be imported)
    Step 4: Click on refresh button
    Step 5: High light the trasnport request and import it (using the truck icon)
    Transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/224381ad-0701-0010-dcb5-d74236082bff
    Hope this helps.
    thanks,
    JituK

  • Migrating ODI objects from one environment to another

    Hi,
    This is for the first time that i am trying to migrate odi objects from one environment to another. I am facing issue and requesting help.
    The odi installation is the part of ASCP module of JDEdwards where some standard objects (interfaces/packages) are already created. I have developed some custom interfaces and want to migrate the same to QA environment.
    I exported the specific folder (including children) to an xml file and then trying to import the same in the QA environment.
    When i choose "Synonym Insert_Update" option to import is prompts error :
    You are importing an object from another repository with same identifier. This is forbidden
    This is completely new folder which do not exist on target. If I import using Duplication option, it successfully import and assigns new internal ID to object (which is as expected). But how will I update the newly created object in future ?
    What should be followed to migrate objects ?

    user8628169 wrote:
    Hi,
    This is for the first time that i am trying to migrate odi objects from one environment to another. I am facing issue and requesting help.
    The odi installation is the part of ASCP module of JDEdwards where some standard objects (interfaces/packages) are already created. I have developed some custom interfaces and want to migrate the same to QA environment.
    I exported the specific folder (including children) to an xml file and then trying to import the same in the QA environment.
    When i choose "Synonym Insert_Update" option to import is prompts error :
    You are importing an object from another repository with same identifier. This is forbidden
    recreate your OA repository with repository id different from your DEV repository.
    Then you should not get this problem.
    This is completely new folder which do not exist on target. If I import using Duplication option, it successfully import and assigns new internal ID to object (which is as expected). But how will I update the newly created object in future ?
    What should be followed to migrate objects ?

  • Move objects from one tablespace to another

    Hello
    Running Oracle 10g rel 2 and I would like to move all objects from one tablespace to another. There are Primary Key indexes to other tables in this tablespace. The size grew too large and I want to reduce the size.
    Thank you.

    Good afternoom Sir!
    I believe that below "ask tom - moving tables across tablespaces" may help you.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:47812348053
    Regards,
    Marcello M.

  • Moving object from one client to another using transport requests...

    Hi,
    If we want to move one object from one client to another, we go to se09 and release it. I know this. But after release what are the next steps to move it from one system to another ?
    Regards,
    Rajesh

    Hello Rajesh
    If the two systems share a <u>common</u> transport directory then you can simply go to transaction <b>STMS</b>, double-click on the <b>import queue</b> (target system), then choose menu <b>Extras -> Other Requests -> Add.</b>
    The transport request will be added to the import buffer. Next you can import the request.
    If the two systems do not share a common transport directory you can use RFC-enabled function module <b>EPS_FTP_PUT</b> to copy the data and cofile from the source to the target system (check for <b>DIR_TRANS</b> directories using transaction AL11).
    Regards
      Uwe

  • Moving Object from One container to another in workOrder Dri

    Hi , I am able to Move Object from One container to another container in workOrder Driver.
    here is my code which i am using
    <do-move-src-object class-name="ValeUser">
    <arg-dn>
    <token-local-variable name="var-str-nwoContent"/>
    </arg-dn>
    <arg-dn>
    <token-text xml:space="preserve">\</token-text>
    <token-global-variable name="dirxml.auto.treename"/>
    <token-text xml:space="preserve">\</token-text>
    <token-global-variable name="hrfeed.inactive.container"/>
    </arg-dn>
    </do-move-src-object>
    Thanks
    Adarsh Kumar

    Originally Posted by AndersG
    Idmlearner,
    > am able to Move Object from One container to another container
    > in workOrder Driver.
    >
    Possibly better asked in support.identity-manager
    - Anders Gustafsson (Sysop)
    The Aaland Islands (N60 E20)
    Novell has a new enhancement request system,
    or what is now known as the requirement portal.
    If customers would like to give input in the upcoming
    releases of Novell products then they should go to
    http://www.novell.com/rms
    Identity Manager - NOVELL FORUMS
    If you are not a nntp user.
    Thomas

  • Transportation ( how to transport objects from one server to another)

    Hi BW guru's
    Please tell me the steps to transport objects from one server to another server.

    Follow the steps.
    1. RSA1 > Transport connection
    2. In the right window there is a catagory "all object according to type"
    3. Select required object you want to transport.
    4. Expand that object , there is select object, double click on this you will get the number of objects, select yours one.
    5. Continue.
    6. Go with the selection, select all your required objects you want to transport.
    7. There is icon Transport Object (Truck Symbol).
    8. Click that, it will creat one request, note it down this request.
    9. Go to Transport Organiser (T.code SE01).
    10. in the display tab, enter the Request, then go with display.
    11. Check your transport request whether contains the required objects or not, if not go with edit, if yes "Release" that request.
    Thats it, your cordinator will move this request to Quality or Production.
    Hope its helps.
    Regards

Maybe you are looking for

  • Open Delivery Schedule list

    My current client wants to display a list of Open Delivery Schedules via ME3M or ME3N in ALV mode. using selection criteria WE101 or WE103. The problem is that these reports also display schedule lines that were already received.  I tried changing th

  • How to add a calculated field in a list definition (schema.xml)?

    Hello, I'm currently trying to add a calculated field to a list definition (schema.xml). I have put the following code at the end of the schema.xml for the list I want to create. But when I deploy and activate the feature for the list, it doesn't app

  • Error occured while uploading the data for Tocde QP01 (BDC)

    Hi, I am facing a strange problem i.e. when i try to upload the data for the Tcode QP01 i am able to upload the data for the 18 rows but when it is more than 18 ,it gives the following error and saves the data upto 18 rows only :- CALL_TRANSACTION QP

  • IPad (first gen) wont turn on

    Hi. I got an 32 gb wifi only ipad (1st gen) recently. I had taken really, really good care of it and never dropped it or got it wet or anything. Yesterday I set it down for about 20 minutes. When I came back it had turned off and would not turn back

  • SCEP Anyconnect version 3 MS CA

    Hi All Im using anyconnect and SCEP proxy on the ASA, trying to get identity certs from a windows CA. I want the certs to have a common name of the user id of the person requesting, basically to take the username as the common name. Is there a way to