Posts categorized “Oracle”


June 22, 2013
  Oracle SQL Developer 3.2 Debian Package

Oracle has released version 3.2 (.20.09) of their SQL Developer tool. They’re still releasing RPMs, so developers on Debian-based systems need to use alien to install it on their machines. We have done that, and have made this available for others to use as well. What makes this particular release of SQL Developer so great is that it now runs reliably under Java 1.7 - no more keeping a 1.6 JDK floating around just for SQL Developer!

The .deb package can be downloaded here, or you can browse current and previously posted packages in the “SQL Developer” directory of the Bit Badger Solutions Software Repository.

Categorized under , , ,
Tagged , , ,


March 2, 2010
  Oracle SQL Developer 2.1 Debian Package

It had been a while since I had updated SQL Developer. It turns out that version 2.1 was released March 1st of this year. I’ve downloaded it and created a Debian package. It can be downloaded from the Bit Badger Solutions Linux Software Repository.

I’ve used it with Sun’s Java 6 Update 18; I have not tested it with OpenJDK. If you have problems getting it to work, you may want to check the previous post on this topic.

Categorized under ,
Tagged , ,


October 29, 2008
  Oracle SQL Developer Debian Package

Oracle SQL Developer is a Java-based tool that provides a graphical interface to a database. While it’s main focus is Oracle (of course), it can be hooked up, via JDBC, to many other databases, such as MySQL, PostgreSQL, and SQL Server. It’s similar to Toad, but is provided by Oracle at no cost.

Oracle provides SQL Developer in either an RPM, or a generic binary install. I like the ability to manage packages, but I’ve never had much luck at getting RPM to run on Ubuntu. I downloaded the RPM file, and, using alien, I converted the package to a .deb package (Debian package format) and installed it. It worked like a charm!

I haven’t tested it with gcj, but using Sun’s Java 6 update 7 from the Ubuntu repositories, it ran just fine. After you install the package, do a directory list on /usr/lib/jvm. You’re looking for the Sun JDK - if it’s installed, you’ll have a symlink java-6-sun that points to java-6-sun-1.6.0.07. Once you’ve determined the location of the JDK, run “sqldeveloper” from the command line - the program will prompt you for the path to your JDK. Enter it (probably /usr/lib/jvm/java-6-sun) and you’re good to go. (You have to install the package as root - but, for the rest of these steps, use your normal user, not root, as this puts settings in a .sqldeveloper directory off your home directory.) The package installs an icon in the “Programming” or “Development” group. Once you’ve told it where the JDK is, you can use this to launch it.

Download SQL Developer 1.5.1 Debian Package

Categorized under , , , , , ,
Tagged , , , , ,


July 9, 2007
  Transferring Data Between Oracle and SQL Server

There are lots of “how to” articles on sharing data between Oracle and SQL Server. Most of these involve installing Oracle’s code base on the SQL Server machine, then using that instance to link tables within Oracle. This technique does not require that, thanks to a product from Oracle called Oracle Instant Client.

To set up the Oracle piece, download the packages for “Basic” and “ODBC Supplement”, and follow the instructions for installation, on the machine with SQL Server. (This is not an “install” per se - it’s basically an unzip.) Next, you’ll need to provide a TNSNAMES.ORA file - this can be any valid file, including a simple shell with an “ifile=” statement pointing to a common TNSNAMES.ORA file. Finally, set the environment variable TNS_ADMIN to point to the directory where this TNSNAMES.ORA file resides.

Now, you can easily create a DTS script through SQL Server to push or pull data however you’d like. Oracle Instant Client will appear in the drop-down list of providers, and you’ll be able to specify your connection the way you normally do (i.e., “DB01.WORLD”).

Happy migrating!

Categorized under , ,
Tagged , , , ,


June 15, 2007
  Transferring CLOBs Across Linked Oracle Databases

Linking databases in Oracle make it easy to share data, and can be useful for replication. However, there is a limitation in Oracle that prevents Character Large Objects (CLOBs) from coming across these links. The following technique uses stored procedures and a temporary table to pull CLOBs across a database link.

First, you’ll need the temporary table, which will hold a sequence number, the primary key for the table where you’ll want to reconstruct the CLOB, and some text. This table can reside in the source or destination database, but must be linked from the other one. For our purposes, it looks like this…

1
2
3
4
5
6
7
8
9
10
11
create table clob_xfer_area
(
cxa_pk number(12),
cxa_number number(12),
cxa_text varchar2(4000 byte)
);
alter table clob_xfer_area add
(
constraint pk_cxa_id
primary key (cxa_pk, cxa_number)
);

Second, you’ll need the procedure in the source database that breaks the CLOB apart and populates the temporary table.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
set serveroutput on size 1000000
set lines 1000
set pages 0
set tab off
set feedback on
create or replace
procedure break_clobs_apart
is
v_line_number number(3);
v_text_piece varchar2(4000);
v_total_length number(12);
cursor clob_cur is
select twc_pk, twc_clob_field
from table_with_clob;
begin /* { */
for clob_rec in clob_cur loop /* { */
v_total_length := 1;
v_line_number := 0;
while (v_total_length <=
DBMS_LOB.GETLENGTH(clob_rec.twc_clob_field)) loop /* { */
v_line_number := v_line_number + 1;
v_text_piece := DBMS_LOB.SUBSTR(clob_rec.twc_clob_field,
3999, v_total_length);
v_total_length := v_total_length + 3999;
insert into clob_xfer_area (
cxa_pk,
cxa_number,
cxa_text
)
values (
clob_rec.twc_pk, -- cxa_pk
v_line_number, -- cxa_number
v_text_piece -- cxa_text
);
end loop; /* } of while */
end loop; /* } of clob_cur */
end; /* } of procedure break_clobs_apart */

Third, you’ll need a procedure in the destination database that puts the CLOB back together, and deletes the data from the temporary table.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
set serveroutput on size 1000000
set lines 1000
set pages 0
set feedback on
set tab off
create or replace
procedure put_clobs_together
is
v_new_clob clob;
cursor pk_cur is
select distinct cxa_pk
from clob_xfer_area;
cursor piece_cur(p_cxa_pk number) is
select cxa_text
from clob_xfer_area
where cxa_pk = p_cxa_pk
order by cxa_number;
begin /* { */
for pk_rec in pk_cur loop /* { */
DBMS_LOB.CREATETEMPORARY(v_new_clob, TRUE);
DBMS_LOB.OPEN(v_new_clob, DBMS_LOB.LOB_READWRITE);
for piece_rec in piece_cur(pk_rec.cxa_pk) loop /* { */
DBMS_LOB.WRITEAPPEND(v_new_clob, LENGTH(piece_rec.cxa_text),
piece_rec.cxa_text);
end loop; /* } of piece_cur */
DBMS_LOB.CLOSE(v_new_clob);
update dest_table_with_clob
set migrated_clob = v_new_clob
where dtwc_pk = pk_rec.cxa_pk;
end loop; /* } of pk_cur */
delete from clob_xfer_area;
end; /* } of procedure put_clobs_together */

Finally, you’ll need a procedure that controls the whole thing. We’ll assume that this procedure is loaded in the destination database, and the source database is linked with the name “source”.

1
2
3
4
5
6
7
8
9
10
11
set lines 1000
set pages 0
set feedback on
set tab off
create or replace
procedure xfer_clobs
is
begin /* { */
break_clobs_apart@source;
put_clobs_together;
end; /* } */

(This does not include a commit - the changes will not be persistent unless they are committed.)

Of course, these processes could (and, to be useful, likely would) be integrated into other procedures and scripts. But, this framework will successfully transfer CLOBs across linked databases in Oracle.

Categorized under , , , ,
Tagged , , , ,