Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.8.0.25.04 に接続されました。
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 212 CPU used by this session 4 212 CPU used when call started 1 212 SQL*Net roundtrips to/from client 2 ...略... 212 execute count 621 ...略... 212 parse count (hard) 100 212 parse count (total) 144 212 parse time cpu 2 212 parse time elapsed 2 ...略... 212 session pga memory 3337208 212 session pga memory max 5189280 212 session uga memory 1904696 212 session uga memory max 3119464 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 212 CPU used by this session 694 212 CPU used when call started 694 ...略... 212 SQL*Net roundtrips to/from client 200002 ...略... 212 execute count 100669 ...略... 212 parse count (hard) 106 212 parse count (total) 100149 212 parse time cpu 4 212 parse time elapsed 23 ...略... 212 session pga memory 3402744 212 session pga memory max 5189280 212 session uga memory 1904696 212 session uga memory max 3119464 ...略... 212 user commits 100000
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 176 CPU used by this session 4 176 CPU used when call started 1 176 SQL*Net roundtrips to/from client 2 ...略... 176 execute count 417 ...略... 176 parse count (hard) 78 176 parse count (total) 126 176 parse time cpu 5 176 parse time elapsed 5 ...略... 176 session pga memory 3026592 176 session pga memory max 5123744 176 session uga memory 1773632 176 session uga memory max 3053928 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 176 CPU used by this session 705 176 CPU used when call started 705 ...略... 176 SQL*Net roundtrips to/from client 200002 ...略... 176 execute count 100441 ...略... 176 parse count (hard) 81 176 parse count (total) 100129 176 parse time cpu 9 176 parse time elapsed 21 ...略... 176 session pga memory 3026592 176 session pga memory max 5123744 176 session uga memory 1773632 176 session uga memory max 3053928 ...略... 176 user commits 100000 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 44 CPU used by this session 5 44 CPU used when call started 1 44 SQL*Net roundtrips to/from client 2 ...略... 44 execute count 621 ...略... 44 parse count (hard) 100 44 parse count (total) 144 44 parse time cpu 4 44 parse time elapsed 6 ...略... 44 session logical reads 2518 44 session pga memory 3206136 44 session pga memory max 5123744 44 session uga memory 1904800 44 session uga memory max 3054064 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 44 CPU used by this session 723 44 CPU used when call started 723 ...略... 44 SQL*Net roundtrips to/from client 200002 ...略... 44 execute count 100669 ...略... 44 parse count (hard) 106 44 parse count (total) 100149 44 parse time cpu 8 44 parse time elapsed 28 ...略... 44 session pga memory 3271672 44 session pga memory max 5123744 44 session uga memory 1904800 44 session uga memory max 3054064 ...略... 44 user commits 100000 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 39 CPU used by this session 4 39 CPU used when call started 1 39 SQL*Net roundtrips to/from client 2 ...略... 39 execute count 621 ...略... 39 parse count (hard) 100 39 parse count (total) 144 39 parse time cpu 3 39 parse time elapsed 1 ...略... 39 session pga memory 3206136 39 session pga memory max 5123744 39 session uga memory 1904800 39 session uga memory max 3054064 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 39 CPU used by this session 698 39 CPU used when call started 698 ...略... 39 SQL*Net roundtrips to/from client 200002 ...略... 39 execute count 100669 ...略... 39 parse count (hard) 106 39 parse count (total) 100149 39 parse time cpu 10 39 parse time elapsed 23 ...略... 39 session pga memory 3271672 39 session pga memory max 5123744 39 session uga memory 1904800 39 session uga memory max 3054064 ...略... 39 user commits 100000
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 176 CPU used by this session 3 176 CPU used when call started 1 176 SQL*Net roundtrips to/from client 2 ...略... 176 execute count 621 ...略... 176 parse count (hard) 100 176 parse count (total) 144 176 parse time cpu 1 176 parse time elapsed 3 ...略... 176 session pga memory 3206136 176 session pga memory max 5123744 176 session uga memory 1904800 176 session uga memory max 3054064 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 176 CPU used by this session 673 176 CPU used when call started 673 ...略... 176 SQL*Net roundtrips to/from client 200002 ...略... 176 execute count 100669 ...略... 176 parse count (hard) 106 176 parse count (total) 100149 176 parse time cpu 6 176 parse time elapsed 22 ...略... 176 session pga memory 3271672 176 session pga memory max 5123744 176 session uga memory 1904800 176 session uga memory max 3054064 ...略... 176 user commits 100000
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 176 CPU used by this session 5 176 CPU used when call started 1 176 SQL*Net roundtrips to/from client 2 ...略... 176 execute count 621 ...略... 176 parse count (hard) 100 176 parse count (total) 144 176 parse time cpu 1 176 parse time elapsed 3 ...略... 176 session pga memory 3206136 176 session pga memory max 5123744 176 session uga memory 1904800 176 session uga memory max 3054064 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 176 CPU used by this session 698 176 CPU used when call started 698 ...略... 176 SQL*Net roundtrips to/from client 200002 ...略... 176 execute count 100669 ...略... 176 parse count (hard) 106 176 parse count (total) 100149 176 parse time cpu 4 176 parse time elapsed 26 ...略... 176 session pga memory 3271672 176 session pga memory max 5123744 176 session uga memory 1904800 176 session uga memory max 3054064 ...略... 176 user commits 100000 ...略...
COUNT(1) ---------- 100000
...略...
Client -> Datatabase - Multi row Insert / バルクロード行数調整
Multi row Insertなので繰り返し実行ではありますが、ぐるぐる というより、ぐーーーーる、ぐーーーーる系な感じw です。( N+1だと ぐるぐる、ぐーーーる、ぐーーるの違いを表現できなーーーいw )
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 38 CPU used by this session 4 38 CPU used when call started 1 38 SQL*Net roundtrips to/from client 2 ...略... 38 execute count 621 ...略... 38 parse count (hard) 100 38 parse count (total) 144 38 parse time cpu 2 38 parse time elapsed 5 ...略... 38 session pga memory 3206136 38 session pga memory max 5123744 38 session uga memory 1904800 38 session uga memory max 3054064 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 38 CPU used by this session 98 38 CPU used when call started 98 38 SQL*Net roundtrips to/from client 20002 ...略... 38 execute count 10719 ...略... 38 parse count (hard) 107 38 parse count (total) 10154 38 parse time cpu 5 38 parse time elapsed 10 ...略... 38 session pga memory 3337208 38 session pga memory max 5123744 38 session uga memory 1970280 38 session uga memory max 3054064 ...略... 38 user commits 10000
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 38 CPU used by this session 4 38 CPU used when call started 1 38 SQL*Net roundtrips to/from client 2 ...略... 38 execute count 621 ...略... 38 parse count (hard) 100 38 parse count (total) 144 38 parse time cpu 2 38 parse time elapsed 2 ...略... 38 session pga memory 3206136 38 session pga memory max 5123744 38 session uga memory 1904800 38 session uga memory max 3054064 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 38 CPU used by this session 35 38 CPU used when call started 35 38 SQL*Net roundtrips to/from client 2002 ...略... 38 execute count 1719 ...略... 38 parse count (hard) 107 38 parse count (total) 1154 38 parse time cpu 2 38 parse time elapsed 2 ...略... 38 session pga memory 3795960 38 session pga memory max 7400440 38 session uga memory 2101240 38 session uga memory max 3054064 ...略... 38 user commits 1000 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 38 CPU used by this session 5 38 CPU used when call started 1 38 SQL*Net roundtrips to/from client 2 ...略... 38 execute count 621 ...略... 38 parse count (hard) 100 38 parse count (total) 144 38 parse time cpu 3 38 parse time elapsed 3 ...略... 38 session pga memory 3206136 38 session pga memory max 5123744 38 session uga memory 1904800 38 session uga memory max 3054064 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 38 CPU used by this session 63 38 CPU used when call started 63 38 SQL*Net roundtrips to/from client 202 ...略... 38 execute count 819 ...略... 38 parse count (hard) 107 38 parse count (total) 254 38 parse time cpu 9 38 parse time elapsed 11 ...略... 38 session pga memory 3533816 38 session pga memory max 34925560 38 session uga memory 2232200 38 session uga memory max 5702640 ...略... 38 user commits 100 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 19 CPU used by this session 5 19 CPU used when call started 2 19 SQL*Net roundtrips to/from client 2 ...略... 19 execute count 559 ...略... 19 parse count (hard) 100 19 parse count (total) 142 19 parse time cpu 5 19 parse time elapsed 3 ...略... 19 session pga memory 3271672 19 session pga memory max 5123744 19 session uga memory 1899488 19 session uga memory max 3053984 ...略...
SID NAME VALUE ---------- ---------------------------------------------------------------- ---------- 19 CPU used by this session 3334 19 CPU used when call started 3334 19 SQL*Net roundtrips to/from client 22 ...略... 19 execute count 667 ...略... 19 parse count (hard) 107 19 parse count (total) 162 19 parse time cpu 728 19 parse time elapsed 730 ...略... 19 session pga memory 6286328 19 session pga memory max 286518264 19 session uga memory 5043712 19 session uga memory max 31643696 ...略... 19 user commits 10
...略...
COUNT(1) ---------- 100000
...略...
ふーーーっ。
完!
では、また、別のネタでお会いしましょう :)
テスト環境の情報
macOS Apple SiliconのVirtualBox
oracle@Mac ~ % ./print_env.sh
*** mac info. *** Model Name: MacBook Air Chip: Apple M2 Total Number of Cores: 8 (4 performance and 4 efficiency) Memory: 24 GB
[oracle@arm64-oraclelinux8u10 ~]$ cat show_mrows_ins_tab_size.sql select segment_name,bytes/1024/1024 as "MB" from dba_segments where owner='SCOTT' and segment_name = upper('mrows_ins_tab') /
[oracle@arm64-oraclelinux8u10 ~]$ cat post_process.sql SELECT COUNT(1) FROM scott.mrows_ins_tab /
@show_mrows_ins_tab_size
truncate table scott.mrows_ins_tab / exit
[oracle@arm64-oraclelinux8u10 ~]$ cat show_mystats.sh sqlplus system/hogehoge@localhost:1521/freepdb1 @show_mystats2 scott
[oracle@arm64-oraclelinux8u10 ~]$ cat show_mystats2.sql set veri off SELECT s.sid, n.name, s.value FROM v$sesstat s INNER JOIN v$statname n ON s.statistic# = n.statistic# AND s.sid = (SELECT sid FROM v$session WHERE username = UPPER('&1')) WHERE s.value > 0 AND ( n.name LIKE '%memory%' OR n.name LIKE '%CPU%' OR n.name LIKE '%I/O%' OR n.name LIKE '%write%' OR n.name LIKE '%read%' OR n.name LIKE 'redo%' OR n.name LIKE 'SQL*Net%' OR n.name LIKE '%commit%' OR n.name LIKE 'execute count' OR n.name LIKE 'parse%' ) ORDER BY n.name;
for (int i = 0; i < totalRows; i += chunkSize) { int currentBatchSize = Math.min(chunkSize, totalRows - i); executeMultiRowInsert(conn, i, currentBatchSize);
if (chunkSize == 1 && (i % commitInterval) == 0) { conn.commit(); } else { conn.commit(); } }
public static void showSessionStats() { try { ProcessBuilder pb = new ProcessBuilder("/bin/bash", "-c", "/home/oracle/show_mystats.sh"); Process process = pb.start();
// 結果の取得 InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr);
In the port, we use WebGL, the Canvas API, HTML 5 <audio> elements, the local storage API, and WebSockets to demonstrate the possibilities of pure web applications in modern browsers such as Safari and Chrome.
G5Server:˜ discus$ G5Server:˜ discus$ cd /Volumes/DiscusWork/Development/Oracle/Middleware/user_projects/domains/mac_de_oracle/bin G5Server:/Volumes/DiscusWork/Development/Oracle/Middleware/user_projects/domains/mac_de_oracle/bin discus$ ./startWebLogic.sh /Volumes/DiscusWork/Development/Oracle/Middleware/user_projects/domains/mac_de_oracle/bin/startWebLogic.sh: Don't know how to set the shared library path for Darwin. . . JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=48m -XX:MaxPermSize=128m . WLS Start Mode=Development . ・・・・中略・・・・ . *************************************************** * To start WebLogic Server, use a username and * * password assigned to an admin-level user. For * * server administration, use the WebLogic Server * * console at http://hostname:port/console * *************************************************** starting weblogic with Java version: java version "1.6.0-dp" Java(TM) SE Runtime Environment (build 1.6.0-dp-b88-34) Java HotSpot(TM) Core VM (build 1.6.0-b88-17-release, interpreted mode, sharing) Starting WLS with line:
PowerMac G5 + Java SE6.0 DP1 de Oracle JDeveloper 11gとOracle Weblogic Server 10.3をインストールしちゃうぞ〜の続きです。
前回はOTNからJDeveloper 11g Studio Edition (Base Install For all the platforms without JDK 6)を入手したところまでだったので、今回はOracleあたらしいインストーラ?!(どうもBEAさんのものをベースにしたみたい・・・インストーラを起動するとcom.bea・・・と表示されるし)を起動するところまで。
ということで早速取りかかる..
・ダウンロードしたJDeveloper 11g installのjarファイル
ファインダーからアプリケーション→ユーティリティ→Java→Java SE 6→Java Preferenceを起動し、Java Application Running SettingでJava SE 6が一番上に来ていることを確認。(このようになっていないとダブルクリックでは起動できないのでご注意を。)
Java SE 6.0 PD1のJava PreferenceのJava Application Running Settingだけではshell上のパスまでは変更してくれないので、手動でJDKへのパスをJava SE 5.0からava SE 6.0へ変更しちゃいます。(PowerPC版のMacOSXではJava SE 6は正式にはリリースされていないので面倒なのは仕方ないですね。) シンボリックリンク CurrentJDKが1.5を指してしるので1.6に切り替えちゃいます。これでJava SE 6.0 DP1が動きます。
今日はSun Tech Days 2008 in Tokyo 1日目に行って来た。 受講セッションは、Key note、Java SE 6 Update 10 and Deployment、Java Persistence APIs そしてなぜかレセプションも。というのも、うちの奥さんがレセプションの終わり頃なら帰れるよん。というメールをくれたので、うちの子供を連れて行けばレセプションへ参加できる状況になったから。(子育て中の身では時間調整やらなんやらで、こちらの思う通りにはなかなか出来ないのだが、子育ての負荷分散に貢献している妻にも感謝。ベコリ)
FUNCTION getBfile ( i_dir_name IN VARCHAR2, i_file_name IN vARCHAR2 ) RETURN BFILE;
PROCEDURE writeImageFile( directoryName IN VARCHAR2, fileName IN VARCHAR2, srcImage IN OUT NOCOPY BLOB );
END PYTHONCHALLENGE_UTL;
CREATE OR REPLACE PACKAGE BODY PYTHONCHALLENGE_UTL AS
FUNCTION getBfile ( i_dir_name IN VARCHAR2, i_file_name IN VARCHAR2 ) RETURN bfile AS v_file BFILE; BEGIN v_file := BFILENAME(UPPER(i_dir_name),i_file_name); RETURN v_file; END getBfile;
PROCEDURE writeImageFile( directoryName IN VARCHAR2, fileName IN VARCHAR2, srcImage IN OUT NOCOPY BLOB ) IS file utl_file.file_type; BEGIN file := UTL_FILE.FOPEN(UPPER(directoryName), fileName, 'w', 32767); DBMS_LOB.OPEN(srcImage, DBMS_LOB.LOB_READONLY);
DECLARE v_raw RAW(32767); amount INTEGER; offset INTEGER; BEGIN offset := 1; LOOP amount := 32767; DBMS_LOB.READ(srcImage, amount, offset, v_raw); UTL_FILE.PUT_RAW(file, v_raw, true); offset := offset + amount; END LOOP; EXCEPTION WHEN no_data_found THEN NULL; WHEN OTHERS THEN UTL_FILE.FCLOSE(file); DBMS_LOB.CLOSE(srcImage); RAISE_APPLICATION_ERROR(-20001, sqlerrm()); END;
UTL_FILE.FCLOSE(file); DBMS_LOB.CLOSE(srcImage); END writeImageFile;
CREATE OR REPLACE PACKAGE LEVEL16 AS FUNCTION getResult RETURN NUMBER AS LANGUAGE JAVA NAME 'jp.macdeoracle.Level16.getResult() return java.lang.boolean'; END LEVEL16;
では、SQL*Plusから実行してみましょう!
Last login: Sun Mar 23 20:29:41 on ttyp2 Welcome to Darwin! G5Server:˜ discus$ ssh oracle@corydoras oracle@corydoras's password: Last login: Sun Mar 23 20:31:49 2008 from 192.168.1.19 [oracle@corydoras ˜]$ cd python_challenge [oracle@corydoras python_challenge]$ ll 合計 264 -rw-r--r-- 1 oracle oinstall 254006 3月 23 16:26 level16.gif
public class Table2Xml2 { public Table2Xml2() throws SQLException { OracleDataSource ods; ods = new OracleDataSource(); ods.setURL( "jdbc:oracle:thin:scott/tiger@192.168.1.20:1521:lampeye" );
さて、Oracleデータベース側だけでリレーショナルデータをXMLTypeインスタンスへ変換する方法は一通り試したので、今度はリレーショナルデータを取り出しクライアント側でXMLへ変換してみた。 接続するOracleデータベースはいままで通り、Oracle11g R1 EE 11.1.0.6.0 for Linux(x86)なのだが、クライアントとして利用するMacOSX 10.4.11の構成は多少異なるので以下に示しておく。
public class Table2Xml1 { public Table2Xml1() throws SQLException { OracleDataSource ods; ods = new OracleDataSource(); ods.setURL( "jdbc:oracle:thin:scott/tiger@192.168.1.20:1521:lampeye" );
Connection conn = ods.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select * from emp order by empno"); OracleXMLQuery xmlqry = new OracleXMLQuery(conn, rs);
G5Server:/Users/Shared/saxonb9-0-0-2j oracle$ java -cp saxon9.jar net.sf.saxon.Query -? Saxon 9.0.0.2J from Saxonica Usage: java net.sf.saxon.Query [options] query {param=value}... Options: -cr:classname Use specified CollectionURIResolver class -dtd:on|off Validate using DTD -expand:on|off Expand defaults defined in schema/DTD -explain[:filename] Display compiled expression tree -ext:[on|off] Allow|Disallow external Java functions -l:on|off Line numbering for source document -mr:classname Use specified ModuleURIResolver class -o:filename Send output to named file -outval:recover|fatal Handling of validation errors on result document -p Recognize Saxon file extensions and query parameters -pipe:push|pull Execute internally in push or pull mode -projection:[on|off] Use|Don't use source document projection -r:classname Use URIResolver class -repeat:N Repeat N times for performance measurement -s:file|URI Provide initial context document -sa Schema-aware query (requires Saxon-SA) -strip:all|none|ignorable Strip whitespace text nodes -t Display version and timing information -tree:tiny|linked Select tree model -T[:classname] Use TraceListener class -TJ Trace calls to external Java functions -u Names are URLs not filenames -val:strict|lax Validate using schema -wrap:on|off Wrap result sequence in XML elements -x:classname Parser (XMLReader) used for source files -xi:on|off Expand XInclude on all documents -xmlversion:1.0|1.1 Version of XML to be handled -? Display this message param=value Set query string parameter +param=value Set query document parameter !option=value Set serialization option G5Server:/Users/Shared/saxonb9-0-0-2j oracle$
今日も行ってきましたSun Tech Days。
明日も行くかは微妙だけど、Dtrace for Web 2.0,JavaScript, PHP and CoolStack (SAMP)やEnterprise Database Inside: The PostgreSQLなんてセッションが夕方からあるので行くかも。
Ajax関連では、Ajax and Web 2.0 Related Frameworks and Toolkits
Gregさんが日本語でプレゼンしてました。このプレゼンが面白いこと。(^^;
いや〜マジでMac OS X Leopardのデモなんじゃないかと勘違いするくらいMacOSX Leopardバリバリ使っていましたよ。 Parallels Desktop 3.0 for MacでWindows XP上のデモやってました。やっぱりParallelsは必須だな。
(jMaki使ってみるか。。)
Please note that the December 2006 beta of Dashcode compatible with Mac OS X 10.4 Tiger will cease to function on July 15, 2007.
なんて思っていたタイミングで、Glossitopeのことを、今月の2時間で学ぶ Java Hot Topic (7月号)で知り、むくむくと制作意欲が。。。Glossitopeは、JavaVM上で動作するWidgetコンテナで、Java SE 6.0のスクリプトサポートを利用するか、javascript, Python, JRubyなど複数のスクリプト言語で記述することができるとのこと。
OracleJVM allows reusing Java SE applications and libraries directly in the database
resulting in significant productivity and performance gains. This release supports
Java SE 5 (i.e., compatibility with JDK 1.5), out of the box.
SQL> conn scott/tiger SQL> select name,method_name,accessibility,is_static,return_class from user_java_methods;
NAME METHOD_NAM ACCESSIBILITY IS_STA RETURN_CLA ---------------------------------------- ---------- ------------------ ------ ---------- jp/macdeoracle/CommandOutputReader $init$ NO - jp/macdeoracle/CommandOutputReader <init> PUBLIC NO - jp/macdeoracle/CommandOutputReader run PUBLIC NO - jp/macdeoracle/HostCommandExecuter <clinit> YES - jp/macdeoracle/HostCommandExecuter exec PRIVATE YES - jp/macdeoracle/HostCommandExecuter ls PUBLIC YES - jp/macdeoracle/HostCommandExecuter main PUBLIC YES - jp/macdeoracle/HostCommandExecuter <init> PUBLIC NO -
8行が選択されました。
SQL>
● 次にjavaストアドプロシージャのコール仕様を作成する
language java以降がポイントですよ。実行するstatic methodを指定します。
SQL> create or replace procedure ls(directory IN VARCHAR2) 2 as language java 3 name 'jp.macdeoracle.HostCommandExecuter.ls(java.lang.String)'; 4 /
プロシージャが作成されました。
では、実行してみると・・・・・。
あれれ、権限が足りないとでますね。。。。。
SQL> SQL> exec ls('c:¥temp'); BEGIN ls; END;
* 行1でエラーが発生しました。: ORA-29532: 不明なJava例外でJavaコールが終了しました: java.security.AccessControlException: the Permission (java.io.FilePermission <<ALL FILES>> execute) has not been granted to SCOTT. The PL/SQL to grant this is dbms_java.grant_permission( 'SCOTT', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' ) ORA-06512: "SCOTT.LS", 行1 ORA-06512: 行1
* 行1でエラーが発生しました。: ORA-29532: 不明なJava例外でJavaコールが終了しました: java.security.AccessControlException: the Permission (java.io.FilePermission <<ALL FILES>> execute) has not been granted to SCOTT. The PL/SQL to grant this is dbms_java.grant_permission( 'SCOTT', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' ) ORA-06512: "SCOTT.LS", 行1 ORA-06512: 行1
public class HostCommandExecuter { public static final String OS_WINDOWS_ = "Windows"; public static final String OS_MACOSX_ = "Mac OS X"; public static final String OS_LINUX_ = "Linux";
private static void exec(String[] command) throws IOException, SecurityException, InterruptedException { Process myproc = Runtime.getRuntime().exec(command); new CommandOutputReader(myproc.getInputStream()).start(); new CommandOutputReader(myproc.getErrorStream()).start(); myproc.waitFor(); }
loadjavaを接続'Oracle9iR2_Scott'で呼出し中。引数: -order -resolve -definer -force -thin -schema scott -verbose creating : class SCOTT.jp/macdeoracle/CommandOutputReader loading : class SCOTT.jp/macdeoracle/CommandOutputReader created : "SCOTT".CREATE$JAVA$LOB$TABLE Error while creating class jp/macdeoracle/CommandOutputReader ソケットから読み込むデータはこれ以上ありません。 Error while testing for existence of dbms_java.handleMd5 Exception java.sql.SQLException: OALL8 is in an inconsistent state. created : "SCOTT".JAVA$CLASS$MD5$TABLE creating : class SCOTT.jp/macdeoracle/HostCommandExecuter loading : class SCOTT.jp/macdeoracle/HostCommandExecuter Error while creating class jp/macdeoracle/HostCommandExecuter ソケットから読み込むデータはこれ以上ありません。 The following operations failed class SCOTT.jp/macdeoracle/CommandOutputReader: creation (createFailed) class SCOTT.jp/macdeoracle/HostCommandExecuter: creation (createFailed) oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:863) at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116) at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46) at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97) at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:473) at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:360) at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:284) at oracle.jdevimpl.deploy.StoredProcProfileDt$Action$1.run(StoredProcProfileDt.java:383) #### デプロイが不完全です #### *** Note *** デプロイ・エラーの可能性の1つとして、ターゲット・データベースがJDKバージョン1.5をサポートしていないことが考えられます。 お使いのプロジェクト・プロパティ・コンパイラのソースとターゲットを古いバージョンに変更することで、この問題を修復できます。 ************
随分前のネタ(Oracle9i R2は、TurboLinux8 Enterprise Server - Powered by United Linux 1.0と Oracle10g R1 は、MacOSX Pantherの頃なので2005年くらいに公開するタイミングを逃していたネタ)なんですが、検索キーワードやOTN-Jなどでもたまに見かけるので、昔のネタに、Oracle10g R2 for Windowsの例も付け加えて公開することにした。
SCOTT> conn scott@zion パスワードを入力してください: 接続されました。 SCOTT> select * from v$version;
BANNER -------------------------------------------------------------------------------- Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production PL/SQL Release 9.2.0.1.0 - Production CORE 9.2.0.1.0 Production TNS for Linux: Version 9.2.0.1.0 - Production NLSRTL Version 9.2.0.1.0 - Production
SCOTT> SCOTT> SCOTT> set serveroutput on SCOTT> exec dbms_java.set_output(20000);
SCOTT> conn scott@panther パスワードを入力してください: 接続されました。 SCOTT> select * from v$version;
BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Prod PL/SQL Release 10.1.0.3.0 - Production CORE 10.1.0.3.0 Production TNS for MacOS X Server: Version 10.1.0.3.0 - Production NLSRTL Version 10.1.0.3.0 - Production
SCOTT> set serveroutput on SCOTT> exec dbms_java.set_output(20000);
PL/SQLプロシージャが正常に完了しました。
SCOTT> exec ls('/Users/oracle'); Desktop Documents Library Movies Music Pictures Public Sites jdevhome
BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod PL/SQL Release 10.2.0.2.0 - Production CORE 10.2.0.2.0 Production TNS for 32-bit Windows: Version 10.2.0.2.0 - Production NLSRTL Version 10.2.0.2.0 - Production
SCOTT>
SCOTT> set serveroutput on SCOTT> exec dbms_java.set_output(20000);
ADCへの登録が必要だが、Java SE 6.0 Release 1 Developer Preview 6がダウンロードできるようになっている。これまた暇をみて遊んでみますか。。
Java SE 6.0 Release 1 Developer Preview 6
Java SE 6 Release 1 is based on JDK 1.6.0_b88 and brings enhanced functionality to the Java SE platform on Mac OS X v10.4 Tiger. The preview supports both Intel-based and PowerPC-based Macintosh computers and is not removable. Please see the release notes for more information. This is Developer Preview 6 of Java SE 6 Release 1 for Mac OS X Tiger.
SQL*Plus: Release 10.1.0.3.0 - Production on 水 8月 17 00:00:20 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production With the Partitioning, OLAP and Data Mining options に接続されました。 SQL> !cat level11.sql -- level11 create or replace package level11 as function getAnswer return number; end level11; / show error
create or replace package body level11 as function getAnswer return number is language java name 'jp.discus.Level11.getAnswer() return java.lang.Intger';
end level11; / show errors
SQL> @level11
パッケージが作成されました。
エラーはありません。
パッケージ本体が作成されました。
エラーはありません。
SQL> set timi on SQL> select 2 case 3 when level11.getanswer() = 1 then 4 '成功' 5 else 6 '失敗' 7 end as "結果" 8 from 9 dual;
$ cat level9.sql -- Level9 package create or replace type hoge_typ is varray(2) of integer; / create or replace type hogehoge_typ is table of hoge_typ; / create or replace package level9 as c_first constant varchar2(16) := 'first.txt'; c_second constant varchar2(16) := 'second.txt'; function gethoge(which in varchar2) return hogehoge_typ; procedure writeimagefile( directoryname in varchar2, filename in varchar2, srcimage in out nocopy blob ); function getanswer() return boolean; end level9; / show error
コーディング後のloadjavaは、JDeveloper10g for MacOSX Developer Previewを利用している。
getAnswer() 関数は、getBlobSource()関数を呼び出し、戻り値から解答を取り出だすjava stored function としてある。この関数はラップされている method内で、Apache ant
に含まれているあるpackage ( jar ファイルは該当package分だけ入手可能 )を利用している。
javaのコード量は、60行〜70行程度だった。
Pythonなら3行程度で終わりそうな問題だ。しかし、PL/SQL+Javaでやるにはちょいと面倒かもしれない。いくつかポイントはあるのだが、escapeシーケンスと”ブンブンブン”蜂が飛ぶ〜〜がヒントになるpython global moduleだ。javaのJ2SEにはそのようなパッケージはないし、もちろん、PL/SQLやオラクルにはない。javaだと、apache ant に ”それ” に相当するパッケージがあるのだが使えるのかな? 調べるしかない・・・。
最近のコメント