DROP DB Link within PL/SQL proc.
Hi,
In a PL/SQL procedure and I have to delete and recreate a DB Link within a cursor. The DB Link has always the same name but the definition changes depending of some parameters. If I add DBMS_SESSION.CLOSE_DATABASE_LINK(my_dblink) and EXECUTE IMMEDIATE 'DROP DATABASE LINK my_dblink', I got this error message ORA-00439: feature not enabled: Enterprise User Security. If I don't use DBMS... I got ORA-02011: duplicate database link name. So, it seems I'm unable to delete and recreate a DB Link within my cursor. Any idea what's wrong?
Thank you.
This is the part not working :
LOOP
FETCH cur_modele_abc INTO v_no_centre, v_modele;
EXIT WHEN cur_modele_abc%NOTFOUND;
BEGIN
--DBMS_SESSION.CLOSE_DATABASE_LINK('MY_DB_LINK');
EXECUTE IMMEDIATE 'DROP DATABASE LINK MY_DB_LINK';
COMMIT;
EXCEPTION WHEN OTHERS THEN --> Si dblink était inexistant.
v_string := 'CREATE DATABASE LINK MY_DB_LINK'
||' CONNECT TO '|| v_modele ||' IDENTIFIED BY '|| v_modele ||
' USING ''ABC_NATREL''';
END;
v_string := 'CREATE DATABASE LINK MY_DB_LINK'
||' CONNECT TO '|| v_modele ||' IDENTIFIED BY '|| v_modele ||
' USING ''ABC_NATREL''';
EXECUTE IMMEDIATE v_string;
ssdw_abc_stage_production_map.main(v_no_centre, p_job => p_jobname);
COMMIT;
--execute immediate 'ALTER SESSION CLOSE DATABASE LINK MY_DB_LINK';
--DBMS_SESSION.CLOSE_DATABASE_LINK('MY_DB_LINK');
SELECT TO_CHAR(SYSDATE, 'DD-MON-YYYY HH:MI:SS') INTO v_date FROM dual;
abc_courriel('SSDW_STAGE Modèle ABC '||v_date, 'Modèle chargé : '||v_modele||' - '||v_no_centre);
END LOOP;
...
Similar Messages
-
Hi,
As user SYS i need to Dynamically DROP all the database link in the Database.
I cant drop private database link .
For example i have few database links under APPS schema that i would like to drop.
Please note that it should be done by SYS user
SQL> declare
2
3 cursor c is
4 select *
5 from dba_db_links;
6
7
8 begin
9 for c_rec in c loop
10
11 if c_rec.owner = 'PUBLIC' then
12 execute immediate ' drop public database link '||'"'||c_rec.db_link||'"';
13 else
14 dbms_output.put_line (' drop database link '||'"'||c_rec.db_link||'"');
15 execute immediate ' drop database link '||'"'||c_rec.db_link||'"';
16 end if;
17 end loop;
18
19 end;
20 /
drop database link "APPS_TO_APPS"
declare
ERROR at line 1:
ORA-02024: database link not found
ORA-06512: at line 15Thanks791550 wrote:
Yet it doest work please see bellow:Correct. The domain name can optionally be included with the database name. So if you for example want to drop database link "ABC.DEF.WORLD.COM", does ABC refer to the link name and DEF.WORLD.COM to the domain?
Or is ABC the schema name, DEF the link name and WORLD.COM the domain?
And what is schema ABC exists with link DEF.WORLD.COM and in the current schema there's a link called ABC for domain DEF.WORLD.COM ?
So there is no clean and correct way for Oracle to resolve the schema scope of a database link name.
If you, as SYS, want to drop all database links, then you can use the DBMS_SYS_SQL interface - this is a (mostly undocumented) interface for parsing SQL as any specific schema on the database. The DBMS_SQL interface (restricted to parsing as the current schema) is documented and runs on top of this system interface.
E.g.
create or replace procedure DropDbLink( schemaName varchar2, dbLink varchar2 ) is
cur number;
plsql varchar2(1000);
uid number;
rc number;
begin
select
u.user_id into uid
from dba_users u
where u.username = schemaName;
plsql := 'drop database link "'||dbLink||'"';
cur := SYS.DBMS_SYS_SQL.open_cursor;
SYS.DBMS_SYS_SQL.parse_as_user(
c => cur,
statement => plsql,
language_flag => DBMS_SQL.native,
userID => uid
rc := SYS.DBMS_SYS_SQL.execute( cur );
SYS.DBMS_SYS_SQL.close_cursor( cur );
end;
/This proc, as SYS, allows you to drop any private database link from the SYS schema. -
I'm working on a portal in Sharepoint 2007. It appears that I can only have one set of "Links" on a page, so I am grouping my related links into folders. I'm having two issues with this...
#1. I need to change the order of the links within a folder. When I try to Change Order under the Actions menu, I only get the main list of links, not those within the folder. How can I reorder links within a folder?
#2. When I click a Links folder, all links go away, except for the links within that folder. Is there any way to make the Links list work in a Tree view?
Sorry for the newbie questions, but I've not worked much in Sharepoint and I had this project dropped on me. :(Hi,
For Question #1,
refer this link.
Hope it helps!
Thanks,
Avni Bhatt
If this helped you resolve your issue, please mark it Answered -
This question sound funny. I just want to make sure this rule. In Oracle database before 10g, we can only use DML and transaction control code within PL/SQL block. We can not use DDL or other control languages within PL/SQL block. How about 10g? can I use DDL in PL/SQL block in 10g?
I have created a procedure to drop all materialized view. Drop object is DDL. I used a piece of code like this:
v_sql_stmt1 := 'DROP MATERIALIZED VIEW'||v_schema||'.'||x.mview_name;
EXECUTE IMMEDIATE v_sql_stmt1;
The procedure was compiled successfully. However, when I run this SP, it generate ORA-00905 missing keyword error on EXECUTE IMMEDIATE statement part. Is this caused by missing keyword in sql statement or DROP as DDL can not be used in PL/SQL block? If it is first one, what is the keyword for DROP MATERIALIZED VIEW statement?The versions of Oracle that run on this planet have been able to do DDL in PL/SQL for quite some time now. The DBAs who blasted off into space with you and worked in a vacuum the past however many years you feel you've been limited by this need to be replaced or re-introduced to Oracle.
For what it's worth, the error looks like you're missing a space. -
Possible to have multiple data sources within 1 SQL querey?
Hi All,
Is it possible to join to a table in a different datasource within 1 SQL Querey?
Something like...
Connection 1
Select *
From Table
Join
Connection 2
On
Connection1.Table1.Field1 = Connection2.Table2.Field2 Thanks,
JohnJohnbr (Oracle11G) wrote:
Is it possible to join to a table in a different datasource within 1 SQL Querey?Called distributed joins - joining a table from one database with that of another database. Also possible to do heterogeneously across different database products - e.g. joining an Oracle table with a SQL-Server table.
As already explained, some kind of communication interface is needed from the local database to the remote database, in order for the remote table to be read and joined to the local database. This interface is called a database link in Oracle.
The basic steps. First define the database link:
create database link <linkname>
connect to <account>
identified by <password>
using <connection-string>Complete syntax details and examples are in the SQL Reference Guide (see http://tahiti.oracle.com)
After the database link has been identified, you should now be able to address remote tables as follows:
select * from <remote-table>@<link-name>A distributed join would look something like the following:
select
from <local-table> t1,
<remote-table>@<link-name> t2
where t1.. = t2..However... this is almost always a BAD IDEA to do distributed joins. It seldom performs well. Performance is immediately constrained to the speed, bandwidth and latency of the network link between local and remote databases. It cannot scale with data volumes and increased frequency of use.
So if the remote table is not small, the network link not robust and reliable, and join not infrequent, it is bad idea to make use of distributed joins. In which case other alternative (and far superior) features need to be considered instead - like materialised views. -
Doc Links within Summ Total LMS
I have created a couple of Captivate tutorials that feature
links to PDF docs. Now I need to start using these tutorials
through Summ Total LMS and I don't know how to post the PDF files
so that I can edit the Captivate with the appropriate document
address to make the links work.Hi,
Simply make the link to the pdf document using the file name
within captivate e.g., sales.pdf, without any filepath etc.
Then publish the project, and select the zip function within
captivate. Prior to uploading to SumTotal, double click the zipped
project and drag and drop all the .pdf files you have links to into
the zip package.
Then upload to SumTotal as a zipped package. The links within
captivate will open the .pdf.
Just make sure you have set the option to 'New' to open a new
window on click, in the click box properties within captivate when
making the link, that way the .pdf will openin a fresh window
allowing the project to remain.
Webbo -
Anchor links within a PDF?
Is it possible to create anchor links within the body of a PDF? How?
For example, having a list of topics at the top and then creating anchors that drop down to each topical section.
Thank you!Yes. You can either used Named Destinations, or page views.
Named Destinations need to be set up before the link is created, but can be
used by more than one link. Page views are created ad-hoc when you select
the action "Go to page view". -
I'm having trouble dropping a database link. In SQLPlus I get:
SQL> SELECT db_link FROM USER_DB_LINKS where db_link like 'PROD%';
DB_LINK
PROD.CBS.STATE.OR.US
PROD.CBS.STATE.OR.US
PROD_DB.CBS.STATE.OR.US
PROD_RI.CBS.STATE.OR.US
SQL> drop database link PROD_RI.CBS.STATE.OR.US;
drop database link PROD_RI.CBS.STATE.OR.US
ERROR at line 1:
ORA-02084: database name is missing a component
This is the method identified in the 10g manual: http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10739/ds_admin.htm#sthref3729
When I try to drop the same link using OEM, I get the message:
ORA-02024: database link not found
In the case of OEM, I'm logging on as a different user then the owner of the link. In the case of SQLPlus, I get the same error whether or not I'm logged in as the owner of the db link, or myself.
Thanks,
ChuckUsing the quotes worked:
drop database link "PROD_RI.CBS.STATE.OR.US";
but only if I own the database link. How, as the DBA, can I get rid of a link that someone else created (our DEV system is littered with experiemental links).
The same above doesn't work if it's owned by someone else:
SQL> DROP DATABASE LINK "IRISHRD.CBS.STATE.OR.US";
DROP DATABASE LINK "IRISHRD.CBS.STATE.OR.US"
ERROR at line 1:
ORA-02024: database link not found
I tried changing the schema context to no avail either:
SQL> DROP DATABASE LINK "IRISHRD.CBS.STATE.OR.US";
DROP DATABASE LINK "IRISHRD.CBS.STATE.OR.US"
ERROR at line 1:
ORA-01031: insufficient privileges
Thanks,
Chuck -
Hello !
How may I drop DB Link in OWB 9.0.3.
I can not find this option.
Thanks.Hi Stanislav,
There are 2 dblinks in OWB. One is from the repository to the (metadata) sources, the other is from the target database schema to the sources.
To drop the first one, you will have to use SQL*Plus of OEM as there is nothing to delete these with from the repository.
For the second one, you can generate code (in this case for the module) and choose "drop objects first". THen you will see drop scripts and you can run these individually.
In the new 904 release you can choose drop on the object itself (the connector) which makes it much simpler.
Hope this helps,
Jean-Pierre -
Using OS Commands within PL/SQL
How can I use Operating system commands from within PL/SQL procedures or functions? Kindly explain with an example.
Thanx,
SBPreviously we have used external procedures to use Windows kernel32.dll to start an external program. However this does not work on Oracle9i.
Instead I have modified an example in Java to acceive this. The following class can start an external program either synchronously or asynchronously and in synchronous mode it will return the programs output.
import java.io.*;
import java.util.*;
public class util
// Executes an operating system command. The command shall be fully qualified.
// The Java connects with silent login. No environment set-up files are run
// and no path is set. The mode can be "sync" or "async" for respectively
// synchronous and asynchronous execution
static public int OSCmd(String cmd, String mode, String[] output)
throws IOException, InterruptedException
System.out.println("OSCmd "+cmd+" ("+mode+")");
output[0]="";
// start command
Process proc = Runtime.getRuntime().exec(cmd);
if (mode.equals("sync"))
// get command's stdout and stderr
InputStream stdout = proc.getInputStream();
InputStream stderr = proc.getErrorStream();
String str;
// Stdout
BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
while ((str = br.readLine()) != null)
output[0]+=str+"\n";
br.close();
// Stderr
br = new BufferedReader(new InputStreamReader(stderr));
while ((str = br.readLine()) != null)
output[0]+=str+"\n";
br.close();
// wait for command to terminate
proc.waitFor();
return proc.exitValue();
return 0;
You need the following permissions:
call dbms_java.grant_permission('COMMON', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute');
call dbms_java.grant_permission('COMMON', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
call dbms_java.grant_permission('COMMON', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
And then create the Java stored procedure:
create or replace function os_cmd2(p_cmd varchar2, p_mode varchar2, p_output in out varchar2) return number
as language java
name 'util.OSCmd(java.lang.String, java.lang.String, java.lang.String[]) return int'; -
Can't see the ESS Additional Personal Data link within Personal Information
Hi All,
For some reasons, I can not see the Additional Personal Data link within the ESS Personal Information iView. I have checked the Homepage framework and the existence of the iView in the PCD and everything appears to be fine.
Do I need to assign any additional infotype to my id or give myself specific authorisations to see this link?
I would really appreciate if you could provide an answer to my query.
Thanks,
VibhuHi,
I think mostly you have maintained the data in PA30 Transaction and had data in Info type 0105.
After this try to check with your EA-HR patch and SAP HR patch in the services. If both are not maintained at the same patch levels such type of problems will occur.
Regards,
kishore. -
I am running on an iMac OS X 10.6.3 using Firefox 3.6.3 as my default browser and I use Postbox 1.1.5 as my email client. Anytime I click on a link within an email message two instances of Firefox open, one with my home page and one with the site the link was meant for. This happens only when Firefox is not already open. If Firefox is running and a link is clicked on it opens normally within the open instance of Firefox. I have contacted Postbox and am currently awaiting a response to see if they have any suggestions. While this is not a serious issue it is a bit annoying. I have Firefox set to open new links in tabs not new instances of windows, so it shouldn't be that. Any help in getting this to stop would be greatly appreciated.
== This happened ==
Every time Firefox opened
== Not sure, it's been going on for quite awhile.That is a bug on Mac.
See https://bugzilla.mozilla.org/show_bug.cgi?id=531552 - Firefox 3.6b opens two windows when opening external links
''(please do not comment in bug reports to avoid bug spam for the devs)'' -
When I enter a new URL or select a bookmark, Firefox loads the page promptly. When I click on a link within that page to go to another page, the Firefox tab green spinner often just spins and spins. It either takes a very long time to load (2 or more minutes), or never finishes loading. It's usually a greater problem when I "Open a link in a new tab". I can usually make the new page appear by reloading, either clicking the red X and the circular arrow, or Ctrl-F5, etc.
Try the Firefox SafeMode to see how it works there. <br />
''A troubleshooting mode, which disables most Add-ons.'' <br />
''(If you're not using it, switch to the Default Theme.)''
* You can open the Firefox 4/5/6/7 SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
* Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
''Don't select anything right now, just use "Continue in SafeMode."''
''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
If it is good in the Firefox SafeMode, your problem is probably caused by an extension, and you need to figure out which one. <br />
http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes -
I'm using FF 34.0.5 (I like it). I use to be able to right click on a link, within an e-mail, and the link would open in a new tab. Now when I click on the link it opens in the same tab replacing my e-mail.
Example - a friend sends me an e-mail containing a link to a web site he thinks I'd like. I click on the link and go to the web site and then go back to the e-mail tab and reply to him. Now, when clicking that link, my e-mail disappears and is replaced by the new site.
How can I fix this? When this happened once before I was told to change the 'value' for a specific 'preference name' through the about:config page.
Can anyone help jog my memory?
Thanks!Is this about clicking a link in an external program?
You can check this pref on the about:config page for external links.
* browser.link.open_newwindow.override.external (-1)
If this pref has the default value -1 then browser.link.open_newwindow is used.
* http://kb.mozillazine.org/browser.link.open_newwindow
*1: current tab; 2:new window; 3:new tab;
You can open the <b>about:config</b> page via the location/address bar.
You can accept the warning and click "I'll be careful" to continue.
*http://kb.mozillazine.org/about:config -
Passing sysdate in milliseconds from OAF page to PL/Sql proc
Hi All,
I have a requirement wherein I need to pass SYSDATE in milliseconds from OAF page to the PL/SQL package.
Basically I will be calling a PL/SQL api from AM . So here I need to pass SYSDATE in milliseconds as one of the PL/SQL proc parameters.
How do you I go about this ?
Any help is aprreciated.
Thanks in Advanceget the current database date by
oracle.sql.date currentDate=OADBTransaction's method getCurrenctDBDate ()
(OADBTransaction object can be obtained from AM Object itself).
Now you may convert this currentDate to java date object.
currentDateObjAsJavaDate=currentDate.toDate()
now miliseconds (since1970, I remember so, please see documentation) =currentDateObjAsJavaDate.getTime();
Maybe you are looking for
-
SSD's not working/ being detected - Windows install errors on HP Dv6-1149wm laptop
Okay, well I have tried three different brand new ssd's: 1. kingston v300 120gb SSD, 2. samsung 840 120gb ssd, and 3. another kingston v300 120gb SSD. Tried in that order. The Kingston drives- Were not detected at all by the bios no errors or nothing
-
How to make means of transport field as a mandatory field in MV45AFZZ
Hi All, I am new to User-Exits. In Sales Order creation I have got a requirement In such a way that based on Sold to and Shipto Party Combination of sales order I have to make Means of Transport Field as a Mandatory Field. I have gone through the Pro
-
Help with Oracle Database XE edition tutorial
Hi, I am a student and our instructor has told us to install 11g and now has us running through the 10g tutorial and I've run into a number of problems. There is one issue that I cannot find the solution for and was hoping that somebody could give me
-
Anyone know how to hook up two computers to High Speed DSL using one modem?
any insight is appreciated
-
Hi All, In apps 11i if the user account has closed then what will be status of notification which is waiting for his approval? Will it be activated if we enable the user account?The user account deactivated one month ago. Need help. Thanks in Advance