Oracle VPD on Remote database using DBLINk

Hi All,
How can i apply row level security on a table that is available in another database using DBlink
we have two databases PDSSM and EVTA, and i would like to apply row level security on a table in EVTA from a schema in PDSSM using dblink. MXODSADM IS A SCHEMA IN EVTA AND MXEMBARGO IS A SCHEMA IN PDSSM. there is a dblink(EVTA.GMM.COM) between mxembargo and mxodsadm.
begin
dbms_rls.add_policy (
object_schema => 'MXODSADM',
object_name => 'vehicle_retail_sale',
policy_name => ' MXEMBARGO_EVTA_POLICY',
function_schema =>'MXEMBARGO',
policy_type => dbms_rls.SHARED_CONTEXT_SENSITIVE,
--policy_type => dbms_rls.STATIC,
policy_function => ' MXEMBARGO_EVTA_POLICY.MXEMBARGO_EVTA_PREDICATE',
statement_types => 'select, insert,update,delete',
update_check => TRUE,
enable => TRUE,
static_policy => TRUE
end;
I am a complete Database person and i need to do this in my application, can anyone provide me how can i do this using dblink.

wojpik wrote:
hello
I have one short question to you.
Is that possible to create view at remote database using dblink? Following syntax returns error
create view ViewName@DbLinkDame (ColumnName) as
(select 1 from dual )
"ORA-00905:missing keyword"
Is that possible at all?
And particulary - is that possible when remote database is MSSQL and I am using heterogeneous services?
I really appreciate your help
best regards
Wojtek
Edited by: wojpik on Oct 21, 2009 3:59 AMI doubt you would be able to fire any ddl through database link. You have to connect to remote database to run any ddl even if it is Oracle or some other database.
Regards
Anurag

Similar Messages

  • Insert a blob in remote database using dblink

    i have a view (it has a BLOB column) from where i need to select the records. After selecting i need to insert it into a synonym in the remote database through a db link.
    if i execute the procedure i get error; ora-22992--cannot use LOB locators selected from remote table. My code is
    INSERT INTO [email protected]
    SELECT PID,RNO, PTYPE,blob_field
    FROM view;
    I dont wish to creat a temporary table and still wish to perform the above function.
    So is there any method to do this. I tried with DBMS_LOB.APPEND but it didnt work out. Any solution will be greatly appreciated.
    Thanks,
    -Nitin

    i have a view (it has a BLOB column) from where i need to select the records. After selecting i need to insert it into a synonym in the remote database through a db link.
    if i execute the procedure i get error; ora-22992--cannot use LOB locators selected from remote table. My code is
    INSERT INTO [email protected]
    SELECT PID,RNO, PTYPE,blob_field
    FROM view;
    I dont wish to creat a temporary table and still wish to perform the above function.
    So is there any method to do this. I tried with DBMS_LOB.APPEND but it didnt work out. Any solution will be greatly appreciated.
    Thanks,
    -Nitin

  • How can I access a database remote without using dblink, synonyms,aliases?

    My store procedure access a remote tables using dblink, synonyms, alias, but by business company requirenments I nedd to use another data base access method. My PL/SQL statement looks like
    select c.cus_id, c.cus_name, p.bankaccno
    into v_cus_id, v_cus_name, v_bankaccno
    from customer c, payment@finantial p
    where c.cus_id = p.cus_id
    Are any method else to connect to several remote databases concurrently?
    If Yes, plase say me how is it, or tell me where do I obtain some examples, or any documentation.
    Edited by: user518321 on Apr 21, 2009 1:58 PM
    Ok, But I must not use any of these data base access method, metioned: dbliks, aliases, synonyms.
    Edited by: user518321 on Apr 21, 2009 2:05 PM
    Ok, It is enough for now, I am surprised for the response time and for their arguments, thanks a lot.
    Edited by: user518321 on Apr 21, 2009 2:50 PM

    If you want to access a table in a remote database using SQL, you will need a database link. It would be exceptionally odd for the business to require that you access a remote database and to prohibit the use of database links. What is the business reason for that combination?
    If you want to look into rather more esoteric solutions, you could load a JDBC driver for the remote database, write a Java stored procedure that queries the remote table using that JDBC driver, and then cobble together some PL/SQL that joins the two result sets. You won't be able to reference the remote table in SQL and the solution won't scale well as data volumes increase and you'll be writing a whole lot of code to manually join tables together, but it does avoid database links. Of course, whatever concerns lead to the ban on database links would probably apply to loading a JDBC driver into the database and writing Java stored procedures to access the remote database, but since you haven't explained the reasoning behind the restrictions, we're just guessing.
    Justin

  • How to access remote database using applet

    hi all,
    I want to know how to access remote database using applet,
    Please help me anybody.
    Regards
    Jesu

    If the database is on a public server, you probably can't access it directly (security wise). You can make your applet talk to a server-side application, which makes the database calls on behalf of the applet. But even in an intranet environment this setup is often preferable, because you don't need to distribute a JDBC driver to all your clients.

  • Lock-ups while inserting to a remote database using a dblink

    Our application runs across multiple instances of Oracle 8i - 8.1.6.
    Throughout the day we run some batch processes to transfer data across these instances using dblinks. Ocassionally the process locks up and further investigation shows that the server from which we are pushing information out seems to have executed an insert statement on a remote instance (insert into test_table@tst_dblink select * from local_table) and is waiting for a return from the remote server while the remote instance seems to be hanging too. Oracle does not return any error but simply waits forever for the statement to finish.
    If anybody has experienced this before can you please share any information you may have on 1. how to prevent this from happening or 2. How to make oracle give up on the transaction, roll it back and raise an error?
    Thanks a lot....

    Well, certainly we need more info to fix the problem! couple of "system states" on both the machines when the job is hanging would help. couple of "stack trace" of the shadow process will also help. please call local oracle support with the system state and stack trace.
    Sounds like the job is hanging on some resource (lock,enque,latch,io...). oracle doesn't give up for few resources, like waiting on ST,latch, io etc. we have to kill the offending process if we want!!
    just my 2 cents :)
    G

  • Connecting to Remote Database using Debian w/Oracle XE

    Hello.
    I have managed to install Oracle XE on a Debian box.
    I am trying to connect to a remote server located on my network.
    I am using the following connection string:
    # sqlplus <User>/<Password>@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<IP>)(PORT=1521)))(CONNECT_DATA=(SID=<SID>)))'
    However, I was given both a SID and a Service_name.
    I tried connecting with both.
    Is it possible to parametrize both? I checked and the remote server is up, and that is the existing port.
    Thanks a lot!

    user603592 wrote:
    Hello.
    I have managed to install Oracle XE on a Debian box.
    I am trying to connect to a remote server located on my network.
    I am using the following connection string:
    # sqlplus <User>/<Password>@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<IP>)(PORT=1521)))(CONNECT_DATA=(SID=<SID>)))'
    However, I was given both a SID and a Service_name.
    I tried connecting with both.
    Is it possible to parametrize both? yes, see below
    bcm@bcm-laptop:~$ sqlplus -h
    SQL*Plus: Release 11.2.0.1.0 Production
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Use SQL*Plus to execute SQL, PL/SQL and SQL*Plus statements.
    Usage 1: sqlplus -H | -V
        -H             Displays the SQL*Plus version and the
                 usage help.
        -V             Displays the SQL*Plus version.
    Usage 2: sqlplus [ [<option>] [{logon | /nolog}] [<start>] ]
      <option> is: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]
        -C <version>   Sets the compatibility of affected commands to the
                 version specified by <version>.  The version has
                 the form "x.y[.z]".     For example, -C 10.2.0
        -L             Attempts to log on just once, instead of
                 reprompting on error.
        -M "<options>" Sets automatic HTML markup of output.  The options
                 have the form:
                 HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
                 [ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
        -R <level>        Sets restricted mode to disable SQL*Plus commands
                 that interact with the file system.     The level can
                 be 1, 2 or 3.  The most restrictive is -R 3 which
                 disables all user commands interacting with the
                 file system.
        -S             Sets silent mode which suppresses the display of
                 the SQL*Plus banner, prompts, and echoing of
                 commands.
      <logon> is: {<username>[/<password>][@<connect_identifier>] | / }
               [AS {SYSDBA | SYSOPER | SYSASM}] [EDITION=value]
        Specifies the database account username, password and connect
        identifier for the database connection.  Without a connect
        identifier, SQL*Plus connects to the default database.
        The AS SYSDBA, AS SYSOPER and AS SYSASM  options are database
        administration privileges.
        <connect_identifier> can be in the form of Net Service Name
        or Easy Connect.
          @[<net_service_name> | [//]Host[:Port]/<service_name>]
         <net_service_name> is a simple name for a service that resolves
         to a connect descriptor.
         Example: Connect to database using Net Service Name and the
               database net service name is ORCL.
            sqlplus myusername/mypassword@ORCL
         Host specifies the host name or IP address of the database
         server computer.
         Port specifies the listening port on the database server.
         <service_name> specifies the service name of the database you
         want to access.
         Example: Connect to database using Easy Connect and the
               Service name is ORCL.
            sqlplus myusername/mypassword@Host/ORCL
        The /NOLOG option starts SQL*Plus without connecting to a
        database.
        The EDITION specifies the value for Session Edition.
      <start> is: @<URL>|<filename>[.<ext>] [<parameter> ...]
        Runs the specified SQL*Plus script from a web server (URL) or the
        local file system (filename.ext) with specified parameters that
        will be assigned to substitution variables in the script.
    When SQL*Plus starts, and after CONNECT commands, the site profile
    (e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile
    (e.g. login.sql in the working directory) are run.  The files may
    contain SQL*Plus commands.
    Refer to the SQL*Plus User's Guide and Reference for more information.
    bcm@bcm-laptop:~$

  • Replicating clobs and blobs in a remote database across dblink

    9iR2
    When creating a materialized view in a warehouse pointing to a remote table in an OLTP environment, I got this error when trying to replicate a table with 3 clobs.
    ORA-22992: cannot use LOB locators selected from remote tables
    So, how does Oracle recommend replicating Blobs and Clobs in a remote database/warehouse? Evidently using materialized views doesnt work.

    MV replication is obsolete.
    Move to 10gR2 and use Streams.

  • Unable to create publication item for remote database using db link

    The mobile repository is in instance A.
    I have to access and sync data from a table in remote database instance B.
    I have run the consolidator_rmt.sql script in instance B under schema_B. I have created a private fixed user db link in instance A under schema_A to access schema_B's tables. I then created a synonym test_B for table test_B in schema_B using the DB link.
    While creating publication item for test_B using MDW, the column list for test_B appears blank. Has anyone encountered this problem and what is the solution.
    Thanks for your help.
    Rosa.

    Hello Pruthvi ,
    See these threads
    Uninstalling MaxDB
    Work process Ended.
    Thanks
    Chandran

  • Create database link from oracle DB to MySql database using dg4odbc

    Hi All
    we need to fetch a data of MySQL database from oracle database using dg4odbc connection.
    we are getting the below erros when we query select * from dual@myodbc;
    ORA-28546: connection initialization failed, probable Net8 admin error
    ORA-02063: preceding line from BUGZILLA
    OS and database details as follow
    1. OS - OEL 5.9 32 bit
    2. Database - 11.2.0.1 XE
    3. MySQL -  5.5.32
    4. ODBC - dg4odbc
    5. unixODBC - 2.2.14
    6.MySQL Connector - 5.1
    kindly help me to get out of this issue.
    Thanks in Advance
    Regards
    Venkatesh V

    Hi All
    we need to fetch a data of MySQL database from oracle database using dg4odbc connection.
    we are getting the below erros when we query select * from dual@myodbc;
    ORA-28546: connection initialization failed, probable Net8 admin error
    ORA-02063: preceding line from BUGZILLA
    OS and database details as follow
    1. OS - OEL 5.9 32 bit
    2. Database - 11.2.0.1 XE
    3. MySQL -  5.5.32
    4. ODBC - dg4odbc
    5. unixODBC - 2.2.14
    6.MySQL Connector - 5.1
    kindly help me to get out of this issue.
    Thanks in Advance
    Regards
    Venkatesh V

  • Connecting to remote database using Connector/J

    I'm new to JDBC so be gentle.
    Basically i'm trying to connect to a remote database from my own computer (client to server). As far as I know i'm doing everything correctly. Am I correct in thinking that Connector/J is native to JDK versions 1.2 and up? Which in turn means that I don't have to install any other drivers as long as i have the JDK installed?
    public void loadDriver() {
            try {
                Class.forName("com.mysql.jdbc.Driver").newInstance();
            catch (Exception ex) {
                System.out.println("Cannot load driver");
        }Ok, here's my loadDriver() method which isn't working and causes nothing else to work because it doesn't work. I'm getting the information from the mySQL documentation here: http://dev.mysql.com/doc/connector/j/en/cj-registering-with-driver-manager.html
    Not sure what's going wrong here, help would be very much appreciated
    Regards

    Ok i ended up putting the correct .jar file into the correct dir finally. It seems as though some of the instructions in the documentation are incorrect.
    Ok i am now able to load the driver but the connection keeps timing out when trying to connect to the database.
    At the moment i'm trying the following:
    con = DriverManager.getConnection("jdbc:mysql://kezzer.co.uk/db", "username", "password");But it doesn't seem to be working. Obviously i'm not using those exact strings for the database, username and password but that's the format it's currently in. Any ideas?

  • Connect to remote database using ODBC

    I am new to TimesTen and I would like some help connecting to remote timesten database using ODBC.
    I followed all the instructions in the manual to setup (like logical server and all). but, when I try to connect using "connect dsn=myRemoteDSN" command, it does not work. It gives me this error: 7001: User authentication failed
    It is asking me for username and password but I dont know how to setup username and password. Looked all over the internet and I could not find any relevant posts. I have already tried "unchecking" the authentication, but it still asks me for username and password.

    thanks for your help. I did not realize that that I turned on ACL. creating a user and then granting the needed permissions did the trick.
    I now have another problem. I use windows platform and .NET 2.0 (C#) to connect to remote timesten database. The driver provided by timesten (as part of installation) does not seem to support ADO.NET. I get "driver does not support this function" exception when I try to insert data into a table. Ironically, it does insert the data successfully, but still generates the exception. I looked at various forums.. everyone seems to have the same problem, but have not had any solution yet?
    Could you let me know if you encountered this issue before and how you might have resolved it?
    Many thanks
    Murthy

  • Cannot insert data from local database into remote database using subquery

    I have two oracle databases on different host.
    One is version 8i in Host A and the other is 9i in Host B.
    First, I try to create a dblink in 8i to 9i, but it fail.
    Then, I create a dblink in 9i to 8i, it success.
    I have already tried some select statement in 9i to view the table in 8i, which is success and that means the dblink is really work.
    The sql statement is like
    Select * from table1@hostA
    Then I have tried running some INSERT statement in 9i, which is copy data from table 1 in 8i to table 2 in 8i, both tables are in 8i. The sql statement is like
    Insert INTO table2@hostA(field1, field2)
    select field1, field2
    from table1@hostA
    This also success.
    Also, I have tried to use the following INSERT statement
    Insert INTO table2@hostA(field1, field2) values ('XXX', 'XXX)
    This also success.
    However, when I try to insert data from table in 9i to table in 8i using the following INSERT statement, it failed.
    Insert INTO table2@hostA(field1, field2)
    select field1, field2
    from table1
    The statement can execute, but all the rows inserted with every field value equal to NULL. I have tried to run the select part, it can return the data. But when I run the INSERT statement above, the value inserted into table2 is all equal to NULL.
    One more thing, I discover that the databases are using different NLS_CHARACTERSET
    9i is AL32UTF8
    8i is WE8ISO8859P1
    Is this relevant to my problem?
    Does anyone know the solution about this problem?
    Thanks!!

    How is the best way to do this ?How much are you planning to send?
    You can use COPY command. Ensure that you have valid database link between two databases.
    Available options are:
    create - creates a new table. errors out if the destination table exists.
    replace - drop the destination table and re-creates with data.
    insert - inserts data if the destination table exists.
    append– appends data into an existing table.
    use set arraysize 5000 -The arraysize specifies the number of rows that SQL*Plus will retrieve from the database at one time.
    copy from scott/tiger@ORCL to scott/tiger@ORCL92 create new_emp using select * from emp;

  • Oracle TDE - Can multiple databases use the same Oracle wallet?

    Oracle Advanced Security Transparent Data Encryption
    I will have 2 or more databases running under the same Oracle 11.2 home. According to Oracle's documentation, it is preferred to reference the wallet via the sqlnet.ora file. That's fine. My question is if I want to use encryption in each of those databases, then I have no choice but to use the shared wallet then, correct.
    I need to confirm that I have not missed something.
    From Oracle's documentation:
    Specifying a Wallet Location for Transparent Data Encryption
    If you wish to use a wallet specifically for TDE, then you must specify a wallet location in the sqlnet.ora file by using the ENCRYPTION_WALLET_LOCATION parameter.
    Oracle recommends that you use the ENCRYPTION_WALLET_LOCATION parameter to specify a wallet location for TDE.
    http://docs.oracle.com/cd/E18283_01/network.112/e10746/asoappa.htm#i634447
    Oracle Advanced Security Transparent Data Encryption
    ENCRYPTION_WALLET_LOCATION = (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
    (DIRECTORY =
    /etc/ORACLE/WALLETS/oracle)))
    thanks!

    Do not do this, follow this http://www.youtube.com/watch?v=Z9odSZxdoGU instead!
    Best, Peter

  • When remote database used in DB Link is down, JDBC hangs

    Hello!
    I have DB Link defined in my Oracle DB I work with from JSP application
    which uses
    Tomcat's connection pool. When remote DB is available, everything is
    fine. But when
    it goes down (I explicitly shut it down with "shutdown immediate"),
    JDBC call hangs:
    Statement Stmt1 = conn.createStatement();
    rs = Stmt1.executeQuery("SELECT something FROM mytable@mylink");
    Second line causes hang forever (or long enough for me to wait, more
    that 30 minutes).
    If I add this:
    Stmt1.setQueryTimeout(5);
    then it hangs for about 1min45sec, then throws exception "end of line
    in communication
    channel". Unfortunately, 1min45sec is too much to wait for the end
    user. Also, it resets
    my connection to my DB (not remote one), so it is no longer usable,
    which costs me
    something to recover.
    It looks like the error occurs only when connection I use had
    successful "history" of
    being able to connect via DB Link. If I get connection not from
    Tomcat's connection
    pool, but force a new connection, everything works fine (something to
    do with session
    using DB Link).
    Has anyone had similar problem? Is a workaround different from creating
    a new
    connection available?
    Thanks!

    Well, it appeared that this is nothing to do with Tomcat. The following sequence
    of calls causes the same symptoms:
    Statement stmt2 = cn.createStatement();
    ResultSet rs2 = stmt2.executeQuery("select 'x' from dual@mylink");
    rs2.next();
    System.out.println(rs2.getString(1));
    rs2.close();
    stmt2.close();
    // !!! do shutdown immediate to DB referenced by mylink, now
    stmt2 = cn.createStatement();
    rs2 = stmt2.executeQuery("select 'x' from dual@mylink"); // !!! hangs forever
    rs2.next();
    System.out.println(rs2.getString(1));
    rs2.close();
    stmt2.close();
    If I would create a new connection for the second set of statements (before
    second stmt2 = ...), it will not hang, and I will get correct error:
    java.sql.SQLException: ORA-02068: following severe error from MYLINK
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Looks like something to do with Oracle JDBC driver?

  • Moving audit Records from one database to another database using dblink

    i got five database, i have to move sys.aud$ records from five databases to one centralized database into another schema every day at 10:00 clock, i have to use a dblink for this, i have to create same table as sys.aud$ with different schema in centralized database with one extra column db_unique_name,by using db_link how i need to move records from all the five databases to one centralized database, can anyone help me here how to create a db_link from to move records from five database to one centralized database, due to maintainance perspective i have to move the records from all the five databases to one centralized database. i have to write a script for moving the audit records from all the five databases to one centralized database, can anyone help me how to write the script, or if you have any related scripts , can u post here, it will helpful for me.

    spool audit.log
    --"Auditing Initialisation Parameters: check initialization parameter"
    select name || '=' || value from v$parameter where name like '%audit%'
    ---"if auditing is disabled then issue this command and bounce"
    alter system set audit_trail=db,extended scope = spfile
    shutdown immediate
    startup
    create tablespace ORDER_DATA datafile '+DDATA' size 50m;
    create user INFO identified by INFO;
    Grant connect,resource to INFO;
    Alter user INFO quota unlimited on ORDER_DATA;
    create table INFO.ORDER as select * from sys.aud$;
    alter INFO.ORDER add db_unique_name varchar2(50);
    create table INFO.ORDER
    partition by range (Timestamp#)
    subpartition by hash(dbid)
    subpartition template
    (subpartition sp1 tablespace users,
    subpartition sp2 tablespace users)(
    partition p1 values less than (TO_DATE('07/29/2010','MM/DD/YYYY')),
    partition p2 values less than (TO_DATE('07/29/2011','MM/DD/YYYY')),
    partition p3 values less than (MAXVALUE)) tablespace BGORDER_DATA as select * from sys.aud$
    spool off;
    exit
    BEGIN
    DBMS_SCHEDULER.create_job(
    job_name => 'Move Aud$ records',
    job_type => 'PLSQL_BLOCK',
    job_action => 'CREATE OR REPLACE PROCEDURE bgorder_aud
                        AS
                   ts TIMESTAMP;
                   BEGIN
    ts := SYSTIMESTAMP;
    insert into info.order select * from sys.aud$ where timestamp# < ts;
    delete sys.aud$ where timestamp# < ts;
    commit;
    END;
    start_date => TRUNC(SYSDATE) + 22 / 24,
    repeat_interval => 'FREQ=daily;BYHOUR=22;BYMINUTE=0;BYSECOND=0',
    enabled => TRUE,
    comments => 'Move records');
    END;
    /

Maybe you are looking for

  • Is there User Group and Role Reporting in SAP Enterprise Portal?

    I want to know if there is a way to pull users statistics our of SAP Enterprise Portal like you can out of the R3 backend systems. I would like functionality similar to the SUIM transaction. I know through user administration you can access any user,

  • Groups Based On SubGroup Totals

    I'm wondering, without doing a subreport, if you can have Groups that are based on values within subgroups. For example: g:  Warehouse A d:     Item # subtotal:  Count of Item # for Warehouse A g:  Warehouse B d:     Item # subtotal:  Count of Item #

  • Verify filename and password

    I am trying to listen to a internet radio station that I used to listen to before and now I get an error that reads: "Cannot open file. Verify that the filename and path are correct and try again". I have other friends who listen to the station with

  • LabVIEW 8 & Windows XP Embedded?

    We have a system running XP Embedded and I would like to run a compiled LV8 application on it.  It requires one of the DAQCards (1200) to gather data.  I guess I'm just not sure how this will all fit on the system.  Traditional NI-DAQ 7.4.1 is a 386M

  • Can't get Camera Raw to update from 8.3 to 8.4

    I'm having the same problem as many users on these forums where Photoshop CC will not detect an update for camera raw. When I go into about plugin it shows ACR as 8.3 still. I tried uninstalling and reinstalling Photoshop and that took me from 14.1 t