約 5,800,974 件
https://w.atwiki.jp/hiropknot/pages/80.html
データベースバッファキャッシュとは 文字通り、データベースに対して「バッファ」と「キャッシュ」の役割を持つメモリ。 データファイルから読み込んだデータブロックのコピーが保持される。 空き容量が少なくなると、「LRU(Least Recently Used)」に基づきブロックを削除する。 「バッファ」としての働き 更新されたブロックをデータベースバッファキャッシュが一時的に保管する。 保管されたブロックは「CKPT」が発生した時点で「DBWn」によりデータファイルに書き込まれる。 「キャッシュ」としての働き データファイルから読み出したブロックをデータベースバッファキャッシュが一時的に保管する。 これにより、ディスクアクセスの回数を減らし、パフォーマンスを改善させる。 初期化パラメータ メモリサイズは初期化パラメータ:DB_CACHE_SIZEで指定する。ALTER SYSTEM文で動的な変更は可能。 標準のブロックサイズは初期化パラメータ:DB_BLOCK_SIZEで指定する。動的な変更は出来ない。 ユーザーの類似作成 Oracleのユーザ作成には、完全な新規作成と、既存のユーザを使用した類似作成がある。 類似作成を使用した場合、ユーザー名とパスワード以外、下記の内容がコピーされる。 コピーされる項目 ・プロファイル ・認証 ・ロール ・システム権限 ・オブジェクト権限 ・ステータス(ロック) ・割り当て制限 コピーされない項目 ・デフォルト表領域 ・一時表領域 参照整合性制約について 参照整合性制約とは 複数の表を関連付けるための共通する列。 表の各行について、外部キーの値が親キーの値に一致することが要求される。 参照整合性制約のフラッシュバックについて フラッシュバック・テーブルの場合 参照整合性制約を維持したままリカバリする。参照整合性に違反するリカバリは出来ない。 親表と子表を一度にフラッシュバック・テーブルをすると、参照整合性制約は維持されたままリカバリされる。 フラッシュバック・ドロップの場合 表はリカバリされるが、参照整合性制約は削除される。主キー制約は維持される。 索引 索引とは 表に関連付けられるオブジェクト。 表データの検索パフォーマンスを向上させるために作成する。 表に対して主キー制約または一意キー制約を指定すると、その列の索引が暗黙的に作成される。 ※暗黙的に作成された索引を削除するときは、まず索引自体を削除する必要がある。 索引が効果を発揮する状況 ・検索に頻繁に使用される。 ・多くのNULL値がある列で、NULL値以外を検索する。 ・多くの種類の値を持つ列を検索する。 ・問い合わせが全行の4%未満になる。 ・複数の表を結合する列(結合のパフォーマンスが向上する)。 事前定義済みロール 事前定義済みロールとは 事前定義済みロールの一覧 ・CONNECT,RESOURCE,DBAロール ・EXP_FULL_DATABASE,IMP_FULL_DATABASEロール ・DELETE_CATALOG_ROLE,EXECUTE_CATALOG_ROLE,SELECT_CATALOG_ROLEロール SYSユーザとSYSTEMユーザ 共通点 共に管理用アカウント 相違点 SYS データディクショナリを構成するすべての実表およびビューが作成されるスキーマ。 SYSTEM 管理情報を格納するための追加の表やビュー、およびOracle製品のオプションやツールで使用される内部的な表やビューが作成されるスキーマ。 ================================================== 【179】 Q データファイル・ヘッダーに格納されているビットマップを使用して管理する表領域の管理方法はどれか。 A ローカル管理 ローカル管理表領域は、データファイル・ヘッダーに格納されているビットマップを使用します。 ディクショナリ管理表領域に比べてパフォーマンスが向上し、管理が容易になり、領域の断片化の問題がなくなります。 領域の割当てと割当て解除の際の競合を避けることができます 表領域管理のデフォルトは、ローカル管理です 自動セグメント領域管理機能は、ローカル管理表領域でのみ使用可能です ================================================== 【35】 Q データベースの表、ビューまたはイベントに関連付けられたストアド・サブプログラムはどれか。 A データベース・トリガー データベース・トリガーは、データベースの表、ビューまたはイベントに関連付けられたストアド・サブプログラム。 ================================================== 【167】 Q 以下のようにリスナーを起動します。起動するリスナー名はどれか。 「lsnrctl start」 A LISTENER リスナーは、以下のコマンドで起動します。 「lsnrctl start [listener_name]」 listener_nameは、listener.ora ファイルで定義したリスナーの名前です。 リスナー名を省略した場合には、デフォルトのリスナー名のLISTENERを使用されます。 ================================================== 【159】 Q ログ・ライター・プロセス(LGWn)の処理に関する正しい説明はどれか。 A トランザクションのコミット時に、REDOログ・バッファをREDOログ・ファイルへ書込みます。 以下のような状況で書き込みを行います トランザクションのコミット時 タイムアウト発生(3秒ごと) REDOログ・バッファが3分の1になったとき DBWnプロセスが修正済のバッファをディスクに書き込む前 ================================================== 【56】 Q Linuxで必要なデータベースのハードウェア要件(10g) A 物理メモリー(RAM):512MB スワップ領域:1GBまたはRAMのサイズの2倍 /tmp内のディスク領域:400MB ディスク領域:3.7GB(2.5GB ソフトウェア・ファイル用 + 1.2GB データベース・ファイル用) ================================================== 【162】 Q Enterprise Managerのロールの画面のアクションはどれか。 A 類似作成 / 権限受領者の表示 / DDLの作成 ================================================== 【180】 Q 一連のSQL文の包括的なチューニングを行う時のアドバイザはどれか。 A SQLアクセス・アドバイザだけを利用する。 SQLアクセス・アドバイザは、1つ以上のSQL文を分析して推奨します。 SQLチューニング・アドバイザは、1つのSQL文を分析して推奨します。 SQLアクセス・アドバイザは、指定されたワークロードのスキーマ設計を自動的に分析し、 ワークロードに応じた索引とマテリアライズド・ビューの作成・保持または削除により SQL文をより迅速に実行する提案をします。 ================================================== 【48】 Q 誤って削除した表をリカバリする最も簡単な方法は何か。 A Flashback Dropを使用する。 Flashback Dropは、ごみ箱から削除した表を戻します 表だけでなく、表に関連する索引、トリガーなども戻します 《参考》参照整合性制約の表 Flashback Dropは、参照整合性制約を戻しません Flashback Tableは、関連する表を1度で実行すると参照整合性制約を戻することができますが、 戻し方によってはエラーになります ================================================== 【99】 Q インスタンス・リカバリが行われるデータベースの状態はどれか。 A OPEN時 ================================================== 【47】 Q デフォルトで、Oracle Enterprise Manager Database Controlへのアクセスが許可されているものはどれか。 A SYS / SYSTEM / SYSMAN ================================================== 【79】 Q Oracle Enterprise Managerでデータベースへのログイン時の接続モードはどれか。 A NORMAL / SYSDBA / SYSOPER ================================================== 【144】 Q ブロック・サイズに関する説明。 事前構成済テンプレートでは、ブロック・サイズを指定できません ※カスタム・オプションでは、ブロック・サイズを指定できます 標準のブロック・サイズは、DB_BLOCK_SIZE初期化パラメータで指定します SYSTEM表領域の作成には、標準のブロック・サイズが使用されます 標準のブロック・サイズ以外の2Kから32Kの任意の最大4つの非標準ブロック・サイズによる表領域を作成できます 標準のブロック・サイズは、データベースの作成後は変更できません ================================================== 【40】 Q メモリ・アドバイザはどれか。 A 共有プール・アドバイザ(SGA)/ バッファ・キャッシュ・アドバイザ(SGA)/ PGAアドバイザ メモリ・アドバイザは、インスタンス上のメモリを最適化します ==================================================
https://w.atwiki.jp/ohden/pages/742.html
Oracle Database 11gR2 install Windows 7-64bit Professional ■download 以下から所望のversionを取ってくる。 databasa download ※12cが登場しちゃったから、11gは下~の方にある。 Downloadした『win64_11gR2_database_2of2.zip』『win64_11gR2_database_1of2.zip』を解凍。 中身にあるdatabaseってdirを合わせてやるとinstallerになる。 ■install 回答したら中にsetup.exeがあるんで起動する。 dos窓が立ち上がって環境チェックする。最近の環境ならココで詰まる事は無いと思うが... 以下のように進めて行く。 defaultのdatabaseは不要です。 ココら辺でネット環境が無いと正常にinstallが終わらない。とりあえず、ネットに繋がってる環境でinstallするのが大事。 多分回避方法あるんだろうけど...調べてません。 詳細はdialogでも見れるけど、logに出力される。 C \Program Files\Oracle\Inventory\logs\installActionsyyyy-mm-dd_hh-MM-ssPM.log ~~~~~~~~~~~~~~~~~『C \app\Oracle』下じゃないので注意! で、完了。 更新日: 2015年10月15日 (木) 17時12分46秒 名前 コメント すべてのコメントを見る
https://w.atwiki.jp/ohden/pages/387.html
SQL DeveloperでDate型のカラムに日付が表示されない場合、『ALTER SESSION SET NLS_DATE_FORMAT= yyyy-mm-dd hh24 mi ss ;』を実行すれば表示されるようになる。 -- (s1n) 2011-06-03 17 11 32 http //otn.oracle.co.jp/forum/thread.jspa?threadID=35002158 sql*netについて語り合ってる -- (s1n) 2012-01-24 10 31 27 http //jibun.atmarkit.co.jp/lskill01/rensai/bronzedba01/bronzedba01.html ココ見て勉強してみる。 -- (s1n) 2012-02-07 13 42 19 Windows環境の場合、環境変数はOSのトコで設定するのではなく、『Oracle Administration Assistant for Windows』から設定する。具体的にはOracleホームの下にぶら下がってるOraDb10g_home1って感じのヤツがいるのでそいつのプロパティ。 -- (s1n) 2012-02-22 13 59 02 ・ユーザ一覧 select * from all_users; -- (s1n) 2012-02-27 14 16 57 ・テーブル一覧 select * from all_tables; -- (s1n) 2012-02-27 14 16 57 expdp/impdpメモ: スキーマ単位でバックアップした場合、復元環境に同名のスキーマがあるとおかしくなるみたいね。 -- (s1n) 2012-02-27 16 46 21 REDO LOG、アーカイブLOG:Oracleは処理内容を全て記録していってる。 -- (s1n) 2012-03-30 21 57 01 http //www.coltvox.com/download/slib/redologviewer.html REDO Logを見るためのViewer -- (s1n) 2012-03-30 21 57 39 http //otndnld.oracle.co.jp/document/products/oracle10g/102/doc_cd/server.102/B19211-01/logminer.html LogMiner -- (s1n) 2012-03-31 00 07 17 なるほど。環境にクラスタがある場合、アプリケーションのインストールと同時にDBを作るのはNGじゃね。アプリケーションをCドライブに入れて、DBはクラスタに構築するのがベターなので、別々に構築するのが良さそう。 -- (s1n) 2012-05-29 09 57 01 sqlplusにはパラメータを渡せる。『sqlplus user/password@dbid @run.sql %para1% %para2%』って感じ。実行されるrun.sqlの中では 1、 2って書くと置換される。 1→para1、 2→para2。 -- (s1n) 2012-09-28 17 58 43 DBの総データ量を調べる方法: http //imfaq.intra-mart.jp/imfaq/index.php?action=artikel cat=32 id=449 artlang=ja -- (s1n) 2012-10-03 16 23 55 sqlplusでSIDを省略するとどうなるか?通常『sqlplus user/passwd@sid』のようにして接続を行う。接続時、SIDを省略『sqlplus user/passwd』しても接続できる環境とできない環境がある。接続できるのは、接続先のOracleDBが接続元PCのローカル環境に存在し、環境変数『ORACLE_SID』が設定されている場合。この時sqlplusはLISTENERを用いずBEQ接続を用いてDBへの接続を行う。 -- (s1n) 2012-10-10 10 11 10 Bequeath Net8 IPC接続 -- (s1n) 2012-10-10 10 23 26 行ロック: 行ロックをしたい場合は『select文』を使う。『select文』末に『for update』と記載するとhitしたレコードがロックされる。ただし、表を結合していた場合は『of句』を使わないとロックされないらしい。 また、『wait句』を使うことで既にロックがかかっていた場合に、ロックが解除されるまでの時間を秒で指定する。『nowait句』を指定すると既にロックがかかっていた場合、エラーとなる。どちらも設定しない場合はロックが解除されるまで延々待ち続ける。 -- (s1n) 2012-10-15 18 19 06 マルチテーブル・インサート。『insert all』これを使うと、1回のSQLで複数データをinsertしたり、複数のtableに一度にい -- (s1n) 2012-11-19 09 15 07 Oracle10gまではlistener.logが4GByteに達するとTNSListenerが強制終了してたらしい。しかもサービス起動中はlistener.logが動かせないっておまけ付き。w 11gからはADR(Automatic Diagnostic Repository)って仕組みが導入されたおかげでサービス起動中でもlistener.logの移動はできるようになったらしい。 -- (s1n) 2012-12-10 20 58 41 OracleDatabase11gにおいてObject名は30Byte内に収めんといけんらしい。Table名やPKEY名、TableSpace名とか色々全部っぽい。 -- (s1n) 2015-09-18 17 03 06 DBA_TABLESPACE_USAGE_METRICS テーブルスペースの使用量を調べる -- (s1n) 2016-03-13 10 30 02 https //mydbhost.example.com 5500/em/ -- (s1n) 2018-07-18 16 25 46 Oracleでlimitを使いたい場合、ROWNUM+サブクエリを使う。12c以降であれば、OFFSET&FETCHを使う。 -- (s1n) 2020-05-25 11 20 34
https://w.atwiki.jp/arma3editjp/pages/14.html
Group 1つ以上のUnitを配置すると作成することが出来ます。editorの"Group"項目からarma3自体に入っている編成を呼び出すことも出来ます。 メリット Unitを1つ以上配置しGroup化するとUnit単体の時と比べてAIがより戦術的に動きます。自分のGroupを作るとGroup下のAIに自分で指揮を出せます。この事によりMissonなどでは分隊指揮によるロールプレイング性が向上します。 ヒント GroupはUnitをまとめて出したい時に使います。故に小規模な戦闘やあえてUnitを減らしたい時などはUnit単体で出した方が良い時もあります。
https://w.atwiki.jp/bioshock2/pages/18.html
Grace Holloway Better Times With Lamb My folks lived in the St. Louis Hooverville in 32... and the Drop is worse by a mile. Nobody s supposed to live down here, city pissing on us. Never dry. Ryan doesn t care. And Fontaine s a damn crook. But Doctor Lamb cares. We re still people to her. She s offering free mental counseling on Sundays. When I go, I get the feeling she s got a plan for Rapture... and for me. Sofia Lamb Ryan VS Lamb Religious Rights Ryan Religious rights, Doctor? You are free to kneel before whatever tribal fetish you favor in the comfort of your own home. But in Rapture, libery is our only law -- A man s only duty is to himself. To imply otherwise, therefore, is criminal. Lamb Ask yourself, Andrew -- what is your "Great Chain of Progress" but a faith? The chain is a symbol for an irrational force, guiding us towards ascension -- no less mystic than the crucifixes you seize and burn. (angry applause, shouting) Tobias Riefers Clinic Code At The Fishbowl What did they expect? You keep enough drugs stashed in this clinic to splice up a rhinoceros, of course every poor soul in the drop s gonna start beatin down your door. It s my job to think up a new key code to keep em out. Seems like every other day now... Nuts... I ll mull it over for a while at the Fishbowl Diner. Prentice Mill The End Of The Line This is it. It s over. I built this railroad from nothing... played by Mr.Ryan s rules. But then he asks me to sink my own cash reserves into the banks to give Rapture some breathing room, and now Austen Goddamned Bathysphere wants to buy me out. Decomission the whole line! I have no family... and no time for friends. I am the Atlantic Express... and this... this is the end of the line... Augustus Sinclair Wrong Side Of The Tracks Ol Pauper s Drop s the worst neighborhood in Rapture -- but it s a hell of an opportunity to raise up some ah, affordable housin . When Atlantic Express was constructin their luxury passenger line, this place was hollowed out beneath as flophouses for the railway crew. Nobody was s posed ta reside down here long-term -- but when you re broke in this town, you re not exactly swimmin in alternatives. I don t favor spendin more than an hour or so down here at a time. There ain t a side of the tracks more wrong than under em. Rock Flanagan, P.I. Camera In Hock Another day, no clients. Atlast and Ryan start goin at it hot and heavy, and all my business dries up. Used to be easy put the eye on some spliced-up dame s wandering husband and rake in the dough. Now it s got so bad I hadda put my camera in hock at King Pawn. Makes a guy consider splicin up himself... if I had two dimes to rub together, that is. Sofia Lamb Arrangements Lamb Now Eleanor, Mummy has to go away for a while. You shall be staying with Aunt Gracie. Eleanor Mummy, don t go... (edge of crying) Lamb Eleanor, you are better than that. Do you remember what I told you? Eleanor (miserable) I am very special. Lamb That s right. And what else? Eleanor (still sad) I was born to change the world. Lamb Yes. And when Mummy returns home... the world will be very different indeed. She will make it ready for you. Sofia Lamb Therapy With Grace 1 Grace Doctor Lamb. Sofia. I came down here to sing, and to start a family.. But I just don t fit with these people. Look at you. You fit with them. Lamb Grace... in Ryan s Rapture, I am the pariah. You and I share unpopular ideas -- but I wonder... how devoted are you to the Rapture people? If you wish to know more, wear this butterfly brooch at our next session. If not... no harm done -- we shall never speak of it again. Mark Meltzer Blood And Lamb This Lamb woman s powers of manipulation are almost scary... her people are using the girls from the surface to gather ADAM from Lamb s followers... it s in the blood - and eventually they give themselves over, like dying is an honor. I d almost feel sorry for them... if they didn t have my daughter. I m going to find Lamb... and take Cindy back, one way or another. Stanley Poole Mole I wish I could publish this stuff. It s newsman paydirt. Sinclair says Ryan s making a move against Sofia Lamb, and they want to cut me in on the action. They re building a case that Lamb s a closet pinko. Sort of an undercover thing -- so, I cozy up to this guy Wales who works for Lamb, makin like I want to join up. Then I found out whether he grew his beard for Jesus... or Karl Marx. Grace Holloway Closing The Limbo Room That s it -- we have to close down the Limbo. Bomb goes off in that fancy place uptown, and everybody panics... pulls their money out of the banks... a whole city tuggin on the same dollar bill. So the banks fold, and maybe one in ten got their savings out... who s going to come hear me nightingalin about how broke they are? How am I going to provide for little Eleanor? Jackie Rodkins Sunday Services Been hearin rumors. Sounds like somebody name o Wales is startin up worship services down in Siren Alley, believe it or not. All faiths and creeds welcome, they says. They got big promises... salvation, immortality. A way outta here. I don t care how crazy it sounds -- a way outta Rapture s music to my ears. Next Sunday morning... I ll be there. Andrew Ryan Pauper s Drop Do you remember what you told me, Bill? A marketplace of ideas... that was you. If I submit to the debates with Lamb, we defang her. I have done so. And have you been to Pauper s Drop, Bill? Listen (the sound of Grace singing in a nightclub) Between each song, these Oblomovs hand out her manifesto. Her face adorns every wall. Saint Lamb. You made her, McDonagh... and now you will convince the council to sponsor her silence. Grace Holloway A Gift From Lamb I know it s wrong to feel so fine right now, but I can t seem to quit this grin. Doctor Lamb came to tell me that Ryan s finally going to lock her up. It s going to gut the believers. And I should feel the same. But. Sofia remembered that I... that I was barren. And she asked me to take care of her baby while she s gone -- baby Eleanor Lamb! Gorgeous, clever little girl. I have a child, now, and it s goign to put the whole world aright. Augustus Sinclair Profit Coming, Profit Going Now I m a modest man. But my piecemeal needle scam s an outright masterpiece some slob shacked up here buys a box of syringe parts from me for twice what it s worth. He assembles em in his rathole, and I buy back the finished product... for a dime against the dollar that I ll get from Ryan. Profit comin , profit goin . Ol Andy rambles on about the Great Chain... I got people shellin out to pull it for me! Gloria Parson Where Has Harry Gone? Another day waiting for Harry to come home. I told him not to speak up against Mr. Ryan s policies, and now he s missing! Just never came home! I went by the bookstore and all his books are gone too. I don t know what to do. Now I have to deal with that awful Sinclair just to have a roof over my head. Gideon Wyborn The Butterfly The blue morpho bounces off the glass as I watch. I fold these paper effigies as secret badges, for the faithful. The morpho caterpillar doesn t spin a coccoon... it just grows armor on the inside... before the change. It is us. To wear a butterfly is to support Doctor Lamb and the Family. Before long, Rapture will split wide... and take wing. Imago is coming. Elliot Nelson What A Snap ...and that s a hundred! What a snap! Give Sinclair a few bucks for a load of vials and needles, then it s evenings putting these syringes together while I listen to the radio... sell em back to Sinclair at twice the price! Whatta racket! A few pin-pricks here and there s nothin to complain about. Gonna be back on top soon. Thank you, Mr. Sinclair... sucker... Eleanor Lamb Barbarism I got in a fight with a dog eater today. His name is Amir, and he was picking on a smaller boy... we called a truce when his nose went red. But Mum says I m becoming a barbarian. So I said, "Eleanor eat dog now too.. Barbarian happy!" And Mum said they only think they re happy, because they re selfish and ignorant. Hmmph! "Eleanor think ignorant sound like fun!" Grace Holloway Failing Lamb Empty house. Only an echo to my name. Eleanor, baby... where are you? I turned my back, and someone took you - it happened so quick. I m not even a half-momma to you, girl. I couldn t protect you... This poster of Doctor Lamb in my room is staring me down like it knows I m ashamed... I ve always been loyal to your real mother, Eleanor... always trusted her with my secrets. But I lost you - what will the Doctor think of me now? Leo Hartwig Field Trial #1 Survival of the fittest. That s the rule in the Drop, the only rule. These numbskulls can t see the potential in leftover drops of Sports Boost, Armored Shell, the tonics for increasing muscle mass and density... but I see the king of the jungle. First field trial of my new formula. Subject Hartwig, Leo. Here goes... Ughh... urghh... rrrrrrrrrrrRRRRRAAAGHHH!!
https://w.atwiki.jp/naobe/pages/65.html
DB2に戻る 参考URL http //good-stream.com/goodstream/database/db2/tips.html 参照 http //www.altus5.co.jp/wordpress/db2_memo/#toc-dbddl 参照 http //db2watch.com/wiki/index.php/%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8 参照 制限 http //publib.boulder.ibm.com/infocenter/db2luw/v8//index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0001029.htm SQLステートメントの最大文字数:2MB DB2インストール(Linux) マニュアル https //www-304.ibm.com/support/docview.wss?rs=71 uid=swg27015149 参照 DB2権限 CSEとの接続 ローカルのデータベース 構成アシスタントを起動 ODBC登録したいデータベースをダブルクリック プロトコル:TCP/IP TCP/IP ホスト名、ポート番号(50000)を設定 データソース:CLI/ODBC用にこのデータベースを登録。システムデータソース選択。 AdminでCLPを開く catalog system odbc data source データベース名 リモートデータベース あああ スキーマ ユーザ名などを使って、テーブル、シーケンスなどのDBオブジェクトをグループ化するもの。スキーマにユーザ名を使うと、1つのデータベースに同じ名前のテーブルを作成できる。 テーブルにアクセスするときは、スキーマ.テーブルでアクセスする。スキーマを省略したときは、データベースに接続するユーザ名が使われる。 コマンド インスタンスの起動 インスタンスオーナでログイン。(Linuxの場合、デフォルトユーザはdb2inst1) db2start インスタンスの構成パラメータの、SYSADM_GROUP,SYSCTRL_GROUPをユーザが属するグループに設定しておくこと。(SYSADM_GROUPのデフォルトはdb2ladm1、SYSCTRL_GROUPのデフォルトは設定なし) 構成パラメータは、コントロールセンターからインスタンスを選択してポップアップメニューから修正可能。 インスタンスの停止 インスタンスオーナでログイン。(Linuxの場合、デフォルトユーザはdb2inst1) db2stop インスタンスの起動状況確認 Linuxでのコマンド db2inst1でログイン GUIツールのコマンド起動 項目 コマンド起動 コントロールセンター db2cc 構成アシスタント db2ca デフォルトスキーマを表示 $db2 "values current schema" デフォルトスキーマを変更 $db2 "set current schema = hoge " データのexport EXPORT TO ファイル名 OF IXF SELECT * FROM テーブル名; データのimport IMPORT FROM ファイル名 OF IXF INSERT_UPDATE INTO テーブル名; SQLファイルの実行 db2 connect to データベース db2 -tvf SQLファイル db2 terminate DDL出力 db2look -d sampledb -e -o a.out DBへの接続 db2 = connect to データベース user ユーザ userはOSのユーザでよい データベース作成 db2 create database データベース プライマリーキー作成 CREATE TABLE aaa ( id1 CHAR(10), id2 CHAR(10), valueCHAR(15), CONSTRAINT vwam07_pkey PRIMARY KEY (id1, id2) ); テーブルスキーマの修正 【列の追加】 ALTER TABLE テーブル名 ADD COLUMN 列名 データタイプ オプション 例 alter table INOUTDETAIL add column NAMEID char(12) 以下を実行するとエラーが発生する。 alter table INOUTDETAIL add column NAMEID char(12) not null DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned SQL0193N In an ALTER TABLE statement, the column "NAMEID" has been specified as NOT NULL and either the DEFAULT clause was not specified or was specified as DEFAULT NULL. SQLSTATE=42601 これは、成功するとNULLカラムができてしまうため。よって列を作成しupdate後に以下のコマンドを実行する。 alter table INOUTDETAIL alter NAMEID set not null 【外部キー制約の追加】 alter table テーブル名 add constraint 制約名 foreign key(列名,・・) references 親テーブル名(列名,・・) 各列名は、親テーブルの各列名に対応する。親テーブルの行を削除するとエラーになる。 ※注意 列を変更するとペンディング状態になり、SQLCODE=-668, SQLSTATE=57016, SQLERRMC=7のエラーが発生する。よって以下を実行する。メッセージの意味は「DB2メッセージレファレンス2」参照。 reorg table テーブル名 【UNIQUE制約の追加】 alter table テーブル名 add constraint 制約名 unique (列名,・・・) 【UNIQUE制約の削除】 alter table テーブル名 drop unique 制約名 terminate 接続を終了し、クライアントのバックエンドプロセス(db2bp)を終了する。db2 connect resetは接続のみ終了する データベースへの接続 db2 = connect to sample Database Connection Information Database server = DB2/LINUX 9.7.1 SQL authorization ID = DB2INST1 Local database alias = SAMPLE 終了 db2 = quit データベース一覧 db2 = list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry Database alias = SAMPLE Database name = SAMPLE Local database directory = /home/db2inst1 Database release level = d.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number = テーブル一覧 【全てのテーブル】 db2 = list tables for all Table/View Schema Type Creation time ------------------------------- --------------- ----- -------------------------- ACT DB2INST1 T 2010-09-06-20.44.43.170519 ADEFUSR DB2INST1 S 2010-09-06-20.44.46.721536 CL_SCHED DB2INST1 T 2010-09-06-20.44.41.958568 ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ 【スキーマ指定】 db2 = list tables for schema スキーマ テーブル構造 db2= DESCRIBE TABLE テーブル名 文字セットの確認 db2 get db config for データベース名 分離レベル http //www.ibm.com/developerworks/jp/data/products/db2/design-guide/lock_v97.html 参照 デフォルトはCS 表示 values current isolation 設定 【セッション内】 set current isolation 分離レベル db2 terminateでリセット 【JDBC】 Connection.TRANSACTION_READ_UNCOMMITED = Uncommitted Read(非コミット読取り) Connection.TRANSACTION_READ_COMMITTED = Cursor Stability(カーソル固定) Connection.TRANSACTION_REPEATABLE_READ = Read Stability(読み取り固定) Connection.TRANSACTION_SERIALIZABLE = Repeatable Read(反復可能読取り) 未コミット中のデータ参照動作 ver9.7から設定が可能。ver9.7のデフォルト動作は、update前の状態を表示(CUR_COMMIT=ON)。 未コミット更新中データが更新されるまで待つように変更するには、CUR_COMMIT=DISABLEDに設定する。 【現在の状態表示】 コマンドプロセッサから、get db cfg show detailを実行すると表示する。 Currently Committed (CUR_COMMIT) = DISABLED DISABLED 左が現在の値。右側が、次回インスタンスが有効になったときの値。 【設定の変更】 項目 内容 待つ db2 update db cfg using CUR_COMMIT DISABLED update前を表示 db2 update db cfg using CUR_COMMIT ON ロック監視 ロックインターバル db2 update db cfg using DLCHKTIME 監視間隔(msec) ロックタイムアウト db2 update db cfg using LOCKTIMEOUT タイムアウト(sec) ユーザの表示 コントロールセンターから可能 ユーザへの権限の付与 コントロールセンターから可能 静的SQL,動的SQL SQL 型 項目 内部サイズ(バイト) 説明 DATE 4 年、月、日。最初の2バイトが年、3バイト目が月、4バイト目が日 TIMESTAMP 7~13 年、月、日、時、分、秒 TIME 3 時、分、秒 CHAR 1~254 固定長の文字。 VARCHAR 最大32k 可変長文字 CLOB 最大2G 可変長文字。 BLOB 最大2G バイナリラージオブジェクト SMALLINT 2 短精度整数 INTEGER 4 超精度整数 BIGINT 8 64ビット整数 コメント "--"または/* */。行に対するコメント。開始位置はどこからでも良い。"--"は行末までがコメント。 プライマリーキー列、UNIQUEキー表示 select colnames, uniquerule from syscat.indexes where tabname = <テーブル名> 外部キーの表示 select constname, tabname, refkeyname, reftabname, colcount, deleterule, updaterule, fk_colnames, pk_colnames from syscat.references syscat.referencesについては「DB2_管理の概念および構成リファレンス.pdf」参照 制約一覧表示 SELECT TABSCHEMA, TABNAME, CONSTNAME FROM SYSCAT.TABCONST WHERE TABSCHEMA= スキーマ名 AND TABNAME= テーブル名 ビュー一覧 SELECT TABSCHEMA, TABNAME FROM SYSCAT.TABLES WHERE TYPE= V SELECT操作 db2 = select * from ACT ACTNO ACTKWD ACTDESC ------ ------ -------------------- 10 MANAGE MANAGE/ADVISE 20 ECOST ESTIMATE COST ・ ・ 180 DOC DOCUMENT 18 record(s) selected. シーケンス作成 コマンドエディタから connect to SUNA; CREATE SEQUENCE inc_seq AS INT START WITH 1 INCREMENT BY 1 MINVALUE 1 NO MAXVALUE NO CYCLE NO CACHE ORDER; quit; シーケンスをIDに適用 シーケンスを適用するカラムをGENERATED BY DEFAULTに設定(初期作成時は、GENERATED BY ALWAYS)。 ALTER TABLE INCIDENCE ALTER COLUMN INCID SET GENERATED BY DEFAULT; INSERTするときに、IDにNEXT VALUE FORを使ってシーケンスの次の値を設定する。 INSERT INTO INCIDENCE VALUES (NEXT VALUE FOR inc_seq, 値1,値2, ・・・) シーケンスをIDに適用(2) IDの一部にシーケンスを適用。現在の日付にシーケンスを追加してみる。 【例】 insert into inoutname (nameid, name, nametype) values (concat( T , concat(to_char(current date, yyyymmdd ), LPAD(inc_seq.nextval, 3, 0 ))), 食費 , 0); シーケンスに値を設定 ALTER SEQUENCE INOUT_NAME_SEQ RESTART WITH 7; シーケンスの取得(次のシーケンス) db2== values nextval for シーケンス名 シーケンスの取得(前のシーケンス) db2== values prevval for シーケンス名 シーケンスのテーブル SYSSEQUENCES コントロールセンターのTABLEから参照する。 JDBC http //www.atmarkit.co.jp/flinux/rensai/db2_03/db2_03a.html 参照 http //www-01.ibm.com/support/docview.wss?uid=std34d77226f5607fa2e4925758a0012c617 参照 ${INSTANCE_DIR}/sqllib/java 下に以下のjarファイルがあってJDBCドライバに使う。 jarファイル 説明 プロバイダタイプ(WAS) db2jcc.jar JDBC3.0以前の機能。JDK1.4以上。 DB2 Universal JDBC Driver Provider db2jcc4.jar JDBC4.0以前の機能。JDK1.6以上 DB2 Using IBM JCC Driver 【JDBCを使ったアクセス】 // DB2 JDBC Driverのロード Class.forName("com.ibm.db2.jcc.DB2Driver"); // DB2に接続 Connection conn = DriverManager.getConnection( "jdbc db2 //localhost 50000/db名", "ユーザ", "パスワード"); ユーザ、パスワードはOSのものを使う その他 項目 説明 静的SQL アプリケーション・プログラムの実行前に準備される。アプリケーション・プログラムが実行された後も残る。ホスト言語(COBOL)のアプリケーションプログラム内部に組み込まれる。 動的SQL SQL アプリケーションの実行時に準備される。 BIND データベース構成パラメータ表示 get db cfg データベースマネージャ構成パラメータ表示 get dbm cfg オートコミットオフで起動 db2 -c-
https://w.atwiki.jp/twwiki/pages/98.html
Tier1 スキル 効果 その他 Group Steel (Level 1) Damage2-8 Attack+40% Precise Hit+15% First attack 2連コンボ Precise Hit I Precise Hit+10% Half-Spin I Damage+20% Trip I Knockdown+20% 3体以上の敵との戦闘でのみ発動 Tier2 スキル 効果 その他 Group Steel (Level 2) Damage5-20 Attack+40% Precise Hit+25% Second attack 5連コンボ Precise Hit II Precise Hit+10% Half-Spin II Damage+25% Trip II Knockdown+30% 3体以上の敵との戦闘でのみ発動 Tier3 スキル 効果 その他 Group Steel (Level3) Damage10-35 Attack+40% Precise Hit+40% Third attack 5連コンボ Silver Talent Precise Hit III Precise Hit+15% Silver Talent Half-Spin III Damage+30% Silver Talent Trip III Knockdown+40% 3体以上の敵との戦闘でのみ発動 Silver Talent Tier4 スキル 効果 その他 Group Steel (Level4) Damage30-60 Attack+40% Precise Hit+90% The Executioner 右クリ保持でスペシャル5連コンボ Silver Talent Tier5 スキル 効果 その他 Group Steel (Level5) Damage30-75 Attack+40% Precise Hit+75% Fourth attack 3連コンボ Gold Talent
https://w.atwiki.jp/lud-p/pages/25.html
jail fulltree 10.0-Release jail fulltree 10.0-Release mainte 用 jail fulltree の構築 base バイナリの構築 jail fulltree の初期設定 jail fulltree の稼動 自動起動設定 jail fulltree の整備 portsnap で ports の更新 portsの自動メンテナンス ports メンテナンス結果のメール送信 pkg_replace のインストール portconf のインストール ports の脆弱性チェック設定 ports の脆弱性チェック結果のメール送信 sendmail の設定 freebsd-update 自動更新設定 資料 アーカイブ 関連ページ FreeBSD 10.0-Releaseにjail fulltreeを導入した時の備忘的まとめです 今後、このfulltreeを使用して minitree を作成していきます jail fulltree 8.2-Release (i386+512M) mainte jail fulltree 8.1-RELEASE common jailstp 以上のサイトを参考にさせていただいております 基本的にはwirednoize様のmainte jail fulltree のそのままです ですので、詳細はmainte jail fulltree 8.1-RELEASEを参照してください mainte 用 jail fulltree の構築 HOST環境での作業 base バイナリの構築 ftp サーバよりrelease/baseファイルを取得して、jail環境を構築します bsdinstall jail を使用したかったのですが、ダウンロードするアドレスに間違いあって動かなかったので、従来の方法で構築します base バイナリ展開用ディレクトリを作成します # mkdir /tmp/base # cd /tmp/base base.txzを取得します日本のミラーサーバは数字なし[ftp]と2-9の番号つき[ftp2]~[ftp9]がありますので、適宜変更してください # fetch ftp //ftp.jp.freebsd.org/pub/FreeBSD/releases/amd64/10.0-RELEASE/base.txz jail fulltree 用ディレクトリを作成しますzfs でディレクトリを切り分けます # zfs create tank0/jail # zfs create -o mountpoint=/home/mainte tank0/jail/mainte100 base バイナリを展開します # cat base.txz | tar --unlink -xpJf - -C /home/mainte ↑ jail fulltree の初期設定 設定のため、起動させます # mount -t devfs devfs /home/mainte/dev # jail /home/mainte test.localdomain 192.168.100.90 /bin/tcsh JAIL環境での作業 起動時の警告を抑制するため、空の/etc/fstabファイルを作成します # touch /etc/fstab sendmailの警告を抑制するため/etc/mail/aliases.dbを生成します # newaliases rc.confの設定をします # vi /etc/rc.conf network_interface="" rpcbind_enable="NO" inet_enable="NO" syslogd_flags="-ss" sshd_enable="NO" sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" resolv.conf の設定をします # echo nameserver 192.168.1.1 /etc/resolv.conf root のログインシェルを変更しますjexec を使用して jail fulltree に入るので ログインシェルを無しにします # vipw root 0 0 0 0 Charlie /root /usr/sbin/nologin toor * 0 0 0 0 Bourne-again Superuser /root /usr/sbin/nologin 上記2行のみ変更 タイムゾーンを変更します # cp -p /usr/share/zoneinfo/Asia/Tokyo /etc/localtime crontab を編集します # vi /etc/crontab # SHELL=/bin/sh PATH=/etc /bin /sbin /usr/bin /usr/sbin HOME=/var/log # #minute hour mday month wday who command 1 0 * * * root newsyslog その他は削除 newsyslog を編集します # vi /etc/newsyslog.conf # logfilename [owner group] mode count size when flags [/pid_file][sig_num] /var/log/all.log 600 7 * @T00 - その他は削除 ログを設定します # echo *.* /var/log/all.log /etc/syslog.conf # touch /var/log/all.log # chmod 600 /var/log/all.log /etc/hosts.allowをすべて拒否に変更します # echo ALL ALL deny /etc/hosts.allow /etc/make.confを設定しますX等のグラフィック関係、IPV6など使用しないものを無効にし、マルチバイト関数はないとハマルとのことSUPHOST と MASTER_SITE_OVERRIDE は、CVSup サイト一覧 と ftp サイト一覧 から日本のサイトを選択WRKDIRPREFIX と DISTDIR の設定は、/usr/ports ディレクトリをを綺麗にしておくのに必須とのこと最適化のためCPUTYPE CFLAGS COPTFLAGS を設定/usr/share/example/etc/make.confと/usr/share/mk/bas.cpu.mkを参考にCPUTYPEをnoconaに設定しました # vi /etc/make.conf WITHOUT_X11=yes WITHOUT_GUI=yes NO_X=true WITHOUT_IPV6=yes WITH_MBSTRING=yes SUPHOST=cvsup3.jp.freebsd.org MASTER_SITE_OVERRIDE=ftp //ftp3.jp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR} WRKDIRPREFIX=/tmp DISTDIR=/tmp/distfiles CPUTYPE=nocona CFLAGS= -O2 -fno-strict-aliasing -pipe COPTFLAGS= -O2 -fno-strict-aliasing -pipe Jail環境での作業を終了します # exit ↑ jail fulltree の稼動 HOST環境での作業 自動起動設定 jail共通起動停止シェルスクリプトの設置jail共通起動停止シェルスクリプトから最新の common_Njailstp.file.?.?.gz をダウンロードします解凍して common_Njailstp.file にファイル名を変更後、/usr/local/etc/rc.d におきます 自動起動用スクリプトの設定 # vi /usr/local/etc/rc.d/mainte90_jail.sh #!/bin/sh #--------------------------------------- Jid="240" Secu="-1" NtwkIF="lo0" HsFQDN="mainte90.localdomain" IPAdrs="192.168.1.240 BDcast="192.168.1.240" NTmask="255.255.255.255" PsName="mainte90" ChRoot="/home/$PsName" MTdpnf="$ChRoot/dev /tmp/$PsName/tmp $ChRoot/tmp" #---------------------------------------------------------------------- BFsrtJ="/bin/mkdir -p /tmp/$PsName/tmp/distfiles /bin/chmod 1777 /tmp/$PsName/tmp" /sbin/mount -t zfs tank0/ports /home/$PsName/usr/ports" AFsrtJ="" BFstpJ="jexec Jid /bin/sh /etc/rc.shutdown" AFstpJ="/bin/rm -rf /tmp/$PsName" Jstcom="/bin/sh /etc/rc" #--------------------------------------- . /usr/local/etc/rc.d/common_Njailstp.file jailstartop $1 実行権限付与 chmod u+x /usr/local/etc/rc.d/mainte_jail.sh 起動・停止 /usr/local/etc/rc.d/mainte_jaile.sh start /usr/local/etc/rc.d/mainte_jaile.sh stop ↑ jail fulltree の整備 maintenance 用 jail fulltree を起動します # /usr/local/etc/rc.d/mainte_jail.sh start # jexec 240 /bin/tcsh portsnap で ports の更新 JAIL環境での作業 portsnap を起動して ports の更新をします初回 # portsnap fetch portsnap extract portsnap update 2回目以降 # portsnap fetch portsnap update ↑ portsの自動メンテナンス portsnap fetch の代わりに portsnap cron を使ったスクリプトを記述します portsnap の実行ログを保存します 後で、ログローテーションの対象にするので、ひたすら追記書きさせます portsnap を cron で流して ports の自動更新をします。 portsnap の自動更新スクリプト # mkdir /root/update # cd /root/update # vi ports_update_cron.sh #!/bin/sh LogFile="/var/log/ports_update.log" echo "### `date` ###" $LogFile /usr/sbin/portsnap cron $LogFile 2 1 /usr/sbin/portsnap update $LogFile 2 1 echo "### `date` ###" $LogFile portsnap の手動更新スクリプト # vi port_update.sh #!/bin/sh /usr/sbin/portsnap fetch /usr/sbin/portsnap update 実行権の付与 # chmod u+x ports_update.sh ports_update_cron.sh crontab の設定適当な頻度で ports の自動更新が走るように設定を追記します vi /etc/crontab # portsnap ports_update 1 9 * * 1,4 root /root/update/ports_update_cron.sh /dev/null 2 1 ログローテーション設定portsnap のログローテーション設定を 追記します vi /etc/newsyslog.conf # logfilename [owner group] mode count size when flags [/pid_file][sig_num] /var/log/all.log 600 7 * @T00 - /var/log/ports_update.log 600 7 1 * N ↑ ports メンテナンス結果のメール送信 ports 更新の有無を簡単に知る為に、定期的に portversion のコマンド結果をメールで送信します mail コマンドを使ってメールを送信するスクリプト # vi portvermail.sh #!/bin/sh #------------------------------------------ MailTO="root" MilTmp=/tmp/pkgversion.txt MilHed="mainte pkg version list" #------------------------------------------ echo $MilHed $MilTmp echo "" $MilTmp /usr/sbin/pkg_version -v $MilTmp cat $MilTmp | /usr/bin/mail -s "$MilHed" $MailTO 実行権の付与 chmod u+x portvermail.sh ports_update_cron.sh へ追加 echo /root/update/portvermail.sh ports_update_cron.sh ↑ pkg_replace のインストール ports の更新やインストールに pkg_replace を入れます ports からインストールとハッシュテーブルの再構築 # cd /usr/ports/ports-mgmt/pkg_replace # make install clean # rehash ↑ portconf のインストール portをインストールする際の設定をmake install でも同じくするためのツールだそうです pkg_replace コマンドでインストールします。 # pkg_replace -vcCN ports-mgmt/portconf ↑ ports の脆弱性チェック設定 ports ソフトウェアの脆弱性をチェックします 脆弱性のチェック # pkg audit -F ↑ ports の脆弱性チェック結果のメール送信 毎日 pkg audit のチェック結果をメールで報告させます mail コマンドを使ってメールを送信するスクリプトを記述します #cd /root/update #vi pkg_auditmail.sh #!/bin/sh RanDOM=`jot -r 1 1 1800` /bin/sleep $RanDOM #------------------------------------------ MailTO="root" MilTmp="/tmp/pkg_audit.txt MilHed="pkg audit report" #------------------------------------------ echo $MilHed $MilTmp echo "" $MilTmp /usr/sbin/pkg audit -F $MilTmp cat $MilTmp | /usr/bin/mail -s "$MilHed" $MailTO 実行権の付与 chmod u+x pkg_auditmail.sh crontab の設定適当な頻度で ports の自動更新が走るように設定を追記します vi /etc/crontab # pkg audit 1 5 * * * root /root/update/pkg_auditmail.sh /dev/null 2 1 ↑ sendmail の設定 結果メールを送信する為に sendmail を起動し、送信後に sendmail を止めるスクリプトを作成します 全拒否の hosts.allow # vi /root/update/hosts.allow_deny ALL ALL deny sendmail許可の hosts.allow # vi /root/update/hosts.allow_mail sendmail localhost allow sendmail 192.168.1.90 allow sendmail .localdomain allow ALL ALL deny sendmail 完全停止用の rc.conf cp /etc/rc.conf rc.conf_none sendmail 起動用の rc.conf現在の /etc/rc.confを流用します # cp /etc/rc.conf rc.conf_mail # sed -i -e "/^sendmail_/d" /root/update/rc.conf_mail # echo sendmail_enable="NO" /root/update/rc.conf_mail メールの転送設定 echo admin@localdomain /root/.forward メール送信シェルスクリプトの作成# vi resend.sh #!/bin/sh cp -p /root/update/rc.conf_mail /etc/rc.conf cp -p /root/update/hosts.allow_mail /etc/hosts.allow sh /etc/rc.sendmail start sleep 6 sh /etc/rc.sendmail stop sleep 4 pkill sendmail cp -p /root/update/hosts.allow_deny /etc/hosts.allow cp -p /root/update/rc.conf_none /etc/rc.conf 実行権付与 # chmod u+x resend.sh portvermail.sh の変更メール送信シェルスクリプトの起動を追記します echo /root/update/resend.sh /root/update/portvermail.sh portauditmail.sh の変更メール送信シェルスクリプトの起動を追記します echo /root/update/resend.sh /root/update/portauditmail.sh ↑ freebsd-update 自動更新設定 freebsd-updateがディレクトリ指定で updateできるようなのでその機能を利用します Jail環境での作業を終了します # exit HOST環境での作業 freebsd-updateスクリプトの設定freebsd-update fetch の代わりに freebsd-update cron という cron 動作用のコマンドを使用しますまた HOST は cron(fetch) のみ jail は install まで行います # mkdir /root/update # cd /root/update # vi freebsd-update_cron.sh #!/bin/sh ### HOST用 /usr/sbin/freebsd-update cron #/usr/sbin/freebsd-update install ### mainte jail用 /usr/sbin/freebsd-update -b /home/mainte90 -d /home/mainte90/var/db/freebsd-update fetch /usr/sbin/freebsd-update -b /home/mainte90 -d /home/mainte90/var/db/freebsd-update install 実行権付与 chmod u+x freebsd-update_cron.sh crontab の設定適当な頻度で freebsd-update が起動するように追記します vi /etc/crontab # freebsd-update 0 6 * * 2,4,6 root /root/freebsd-update_cron.sh /var/log/freebsd-update.log 2 1 freebsd-update の結果をメール送信freebsd-update cron が実行されて何らかのアップデートがあった場合、ローカルの root 宛にメールを出してくれる機能が組み込まれているので、特別な作業はありません メールの転送設定ローカルのroot宛にメールを出してくれるので、普段使うアドレスへ転送する設定をします echo admin@localdomain /root/.forward 資料 アーカイブ mainte jail fulltree 8.1-RELEASE (2011-09-10 15 15 28) common jailstp (2012-09-05 13 54 52) ↑ 関連ページ ↑ 名前 コメント
https://w.atwiki.jp/lud-p/pages/22.html
jail fulltree 9.0-Release jail fulltree 9.0-Release mainte 用 jail fulltree の構築 base バイナリの構築 jail fulltree の初期設定 jail fulltree の稼動 自動起動設定 jail fulltree の整備 portsnap で ports の更新 portsの自動メンテナンス ports メンテナンス結果のメール送信 pkg_replace のインストール portconf のインストール portaudit のインストール portaudit 脆弱性チェック結果のメール送信 sendmail の設定 freebsd-update 自動更新設定 資料 アーカイブ 関連ページ FreeBSD 9.0-Releaseにjail fulltreeを導入した時の備忘的まとめです 今後、このfulltreeを使用して minitree を作成していきます jail fulltree 8.2-Release (i386+512M) mainte jail fulltree 8.1-RELEASE common jailstp 以上のサイトを参考にさせていただいております 基本的にはwirednoize様のmainte jail fulltree のそのままです ですので、詳細はmainte jail fulltree 8.1-RELEASEを参照してください mainte 用 jail fulltree の構築 HOST環境での作業 base バイナリの構築 ftp サーバよりrelease/baseファイルを取得して、jail環境を構築します base バイナリ展開用ディレクトリを作成します # mkdir /tmp/base # cd /tmp/base base.txzを取得します日本のミラーサーバは数字なし[ftp]と2-9の番号つき[ftp2]~[ftp9]がありますので、適宜変更してください # fetch ftp //ftp.jp.freebsd.org/pub/FreeBSD/releases/amd64/9.0-RELEASE/base.txz jail fulltree 用ディレクトリを作成しますzfs でディレクトリを切り分けます # zfs create tank0/jail # zfs create -o mountpoint=/home/mainte90 tank0/jail/mainte90 base バイナリを展開します # cat base.txz | tar --unlink -xpJf - -C /home/mainte90 ↑ jail fulltree の初期設定 設定のため、起動させます # mount -t devfs devfs /home/mainte90/dev # jail /home/mainte90 test.localdomain 192.168.100.90 /bin/tcsh JAIL環境での作業 起動時の警告を抑制するため、空の/etc/fstabファイルを作成します # touch /etc/fstab sendmailの警告を抑制するため/etc/mail/aliases.dbを生成します # newaliases rc.confの設定をします # vi /etc/rc.conf network_interface="" rpcbind_enable="NO" inet_enable="NO" syslogd_flags="-ss" sshd_enable="NO" sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" resolv.conf の設定をします # echo nameserver 192.168.1.1 /etc/resolv.conf root のログインシェルを変更しますjexec を使用して jail fulltree に入るので ログインシェルを無しにします # vipw root 0 0 0 0 Charlie /root /usr/sbin/nologin toor * 0 0 0 0 Bourne-again Superuser /root /usr/sbin/nologin 上記2行のみ変更 タイムゾーンを変更します # cp -p /usr/share/zoneinfo/Asia/Tokyo /etc/localtime crontab を編集します # vi /etc/crontab # SHELL=/bin/sh PATH=/etc /bin /sbin /usr/bin /usr/sbin HOME=/var/log # #minute hour mday month wday who command 1 0 * * * root newsyslog その他は削除 newsyslog を編集します # vi /etc/newsyslog.conf # logfilename [owner group] mode count size when flags [/pid_file][sig_num] /var/log/all.log 600 7 * @T00 - その他は削除 ログを設定します # echo *.* /var/log/all.log /etc/syslog.conf # touch /var/log/all.log # chmod 600 /var/log/all.log /etc/hosts.allowをすべて拒否に変更します # echo ALL ALL deny /etc/hosts.allow /etc/make.confを設定しますX等のグラフィック関係、IPV6など使用しないものを無効にし、マルチバイト関数はないとハマルとのことSUPHOST と MASTER_SITE_OVERRIDE は、CVSup サイト一覧 と ftp サイト一覧 から日本のサイトを選択WRKDIRPREFIX と DISTDIR の設定は、/usr/ports ディレクトリをを綺麗にしておくのに必須とのこと最適化のためCPUTYPE CFLAGS COPTFLAGS を設定/usr/share/example/etc/make.confと/usr/share/mk/bas.cpu.mkを参考にCPUTYPEをnoconaに設定しました # vi /etc/make.conf WITHOUT_X11=yes WITHOUT_GUI=yes NO_X=true WITHOUT_IPV6=yes WITH_MBSTRING=yes SUPHOST=cvsup3.jp.freebsd.org MASTER_SITE_OVERRIDE=ftp //ftp3.jp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR} WRKDIRPREFIX=/tmp DISTDIR=/tmp/distfiles CPUTYPE=nocona CFLAGS= -O2 -fno-strict-aliasing -pipe COPTFLAGS= -O2 -fno-strict-aliasing -pipe Jail環境での作業を終了します # exit ↑ jail fulltree の稼動 HOST環境での作業 自動起動設定 jail共通起動停止シェルスクリプトの設置jail共通起動停止シェルスクリプトから最新の common_Njailstp.file.?.?.gz をダウンロードします解凍して common_Njailstp.file にファイル名を変更後、/usr/local/etc/rc.d におきます 自動起動用スクリプトの設定 # vi /usr/local/etc/rc.d/mainte90_jail.sh #!/bin/sh #--------------------------------------- Jid="90" Secu="-1" NtwkIF="lo0" HsFQDN="mainte90.localdomain" IPAdrs="192.168.1.90" BDcast="192.168.1.90" NTmask="255.255.255.255" PsName="mainte90" ChRoot="/home/$PsName" MTdpnf="$ChRoot/dev /tmp/$PsName/tmp $ChRoot/tmp" #---------------------------------------------------------------------- BFsrtJ="/bin/mkdir -p /tmp/$PsName/tmp/distfiles /bin/chmod 1777 /tmp/$PsName/tmp" /sbin/mount -t zfs tank0/ports /home/$PsName/usr/ports" AFsrtJ="" BFstpJ="jexec Jid /bin/sh /etc/rc.shutdown" AFstpJ="/bin/rm -rf /tmp/$PsName" Jstcom="/bin/sh /etc/rc" #--------------------------------------- . /usr/local/etc/rc.d/common_Njailstp.file jailstartop $1 実行権限付与 chmod u+x /usr/local/etc/rc.d/mainte90_jail.sh 起動・停止 /usr/local/etc/rc.d/mainte90_jaile.sh start /usr/local/etc/rc.d/mainte90_jaile.sh stop ↑ jail fulltree の整備 maintenance 用 jail fulltree を起動します # /usr/local/etc/rc.d/mainte90_jail.sh start # jexec 90 /bin/tcsh portsnap で ports の更新 JAIL環境での作業 portsnap を起動して ports の更新をします初回 # portsnap fetch portsnap extract portsnap update 2回目以降 # portsnap fetch portsnap update ↑ portsの自動メンテナンス portsnap fetch の代わりに portsnap cron を使ったスクリプトを記述します portsnap の実行ログを保存します 後で、ログローテーションの対象にするので、ひたすら追記書きさせます portsnap を cron で流して ports の自動更新をします。 portsnap の自動更新スクリプト # mkdir /root/update # cd /root/update # vi ports_update_cron.sh #!/bin/sh LogFile="/var/log/ports_update.log" echo "### `date` ###" $LogFile /usr/sbin/portsnap cron $LogFile 2 1 /usr/sbin/portsnap update $LogFile 2 1 echo "### `date` ###" $LogFile portsnap の手動更新スクリプト # vi port_update.sh #!/bin/sh /usr/sbin/portsnap fetch /usr/sbin/portsnap update 実行権の付与 # chmod u+x ports_update.sh ports_update_cron.sh crontab の設定適当な頻度で ports の自動更新が走るように設定を追記します vi /etc/crontab # portsnap ports_update 1 9 * * 1,4 root /root/update/ports_update_cron.sh /dev/null 2 1 ログローテーション設定portsnap のログローテーション設定を 追記します vi /etc/newsyslog.conf # logfilename [owner group] mode count size when flags [/pid_file][sig_num] /var/log/all.log 600 7 * @T00 - /var/log/ports_update.log 600 7 1 * N ↑ ports メンテナンス結果のメール送信 ports 更新の有無を簡単に知る為に、定期的に portversion のコマンド結果をメールで送信します mail コマンドを使ってメールを送信するスクリプト # vi portvermail.sh #!/bin/sh #------------------------------------------ MailTO="root" MilTmp=/tmp/pkgversion.txt MilHed="mainte pkg version list" #------------------------------------------ echo $MilHed $MilTmp echo "" $MilTmp /usr/sbin/pkg_version -v $MilTmp cat $MilTmp | /usr/bin/mail -s "$MilHed" $MailTO 実行権の付与 chmod u+x portvermail.sh ports_update_cron.sh へ追加 echo /root/update/portvermail.sh ports_update_cron.sh ↑ pkg_replace のインストール ports の更新やインストールに pkg_replace を入れます ports からインストールとハッシュテーブルの再構築 # cd /usr/ports/ports-mgmt/pkg_replace # make install clean # rehash ↑ portconf のインストール portをインストールする際の設定をmake install でも同じくするためのツールだそうです pkg_replace コマンドでインストールします。 # pkg_replace -vcCN ports-mgmt/portconf ↑ portaudit のインストール ports ソフトウェアの脆弱性をチェックします pkg_replace コマンドでインストールします。 # pkg_replace -vcCN ports-mgmt/portaudit 脆弱性のチェック # /usr/local/sbin/portaudit -Fda ↑ portaudit 脆弱性チェック結果のメール送信 毎日 portaudit のチェック結果をメールで報告させます mail コマンドを使ってメールを送信するスクリプトを記述します #cd /root/update #vi portauditmail.sh #!/bin/sh RanDOM=`jot -r 1 1 1800` /bin/sleep $RanDOM #------------------------------------------ MailTO="root" MilTmp="/tmp/portaudit.txt MilHed="portaudit report" #------------------------------------------ echo $MilHed $MilTmp echo "" $MilTmp /usr/local/sbin/portaudit -Fdav $MilTmp cat $MilTmp | /usr/bin/mail -s "$MilHed" $MailTO 実行権の付与 chmod u+x portauditmail.sh crontab の設定適当な頻度で ports の自動更新が走るように設定を追記します vi /etc/crontab # portaudit 1 5 * * * root /root/update/portauditmail.sh /dev/null 2 1 ↑ sendmail の設定 結果メールを送信する為に sendmail を起動し、送信後に sendmail を止めるスクリプトを作成します 全拒否の hosts.allow # vi /root/update/hosts.allow_deny ALL ALL deny sendmail許可の hosts.allow # vi /root/update/hosts.allow_mail sendmail localhost allow sendmail 192.168.1.90 allow sendmail .localdomain allow ALL ALL deny sendmail 完全停止用の rc.conf cp /etc/rc.conf rc.conf_none sendmail 起動用の rc.conf現在の /etc/rc.confを流用します # cp /etc/rc.conf rc.conf_mail # sed -i -e "/^sendmail_/d" /root/update/rc.conf_mail # echo sendmail_enable="NO" /root/update/rc.conf_mail メールの転送設定 echo admin@localdomain /root/.forward メール送信シェルスクリプトの作成# vi resend.sh #!/bin/sh cp -p /root/update/rc.conf_mail /etc/rc.conf cp -p /root/update/hosts.allow_mail /etc/hosts.allow sh /etc/rc.sendmail start sleep 6 sh /etc/rc.sendmail stop sleep 4 pkill sendmail cp -p /root/update/hosts.allow_deny /etc/hosts.allow cp -p /root/update/rc.conf_none /etc/rc.conf 実行権付与 # chmod u+x resend.sh portvermail.sh の変更メール送信シェルスクリプトの起動を追記します echo /root/update/resend.sh /root/update/portvermail.sh portauditmail.sh の変更メール送信シェルスクリプトの起動を追記します echo /root/update/resend.sh /root/update/portauditmail.sh ↑ freebsd-update 自動更新設定 freebsd-updateがディレクトリ指定で updateできるようなのでその機能を利用します Jail環境での作業を終了します # exit HOST環境での作業 freebsd-updateスクリプトの設定freebsd-update fetch の代わりに freebsd-update cron という cron 動作用のコマンドを使用しますまた HOST は cron(fetch) のみ jail は install まで行います # mkdir /root/update # cd /root/update # vi freebsd-update_cron.sh #!/bin/sh ### HOST用 /usr/sbin/freebsd-update cron #/usr/sbin/freebsd-update install ### mainte jail用 /usr/sbin/freebsd-update -b /home/mainte90 -d /home/mainte90/var/db/freebsd-update fetch /usr/sbin/freebsd-update -b /home/mainte90 -d /home/mainte90/var/db/freebsd-update install 実行権付与 chmod u+x freebsd-update_cron.sh crontab の設定適当な頻度で freebsd-update が起動するように追記します vi /etc/crontab # freebsd-update 0 6 * * 2,4,6 root /root/freebsd-update_cron.sh /var/log/freebsd-update.log 2 1 freebsd-update の結果をメール送信freebsd-update cron が実行されて何らかのアップデートがあった場合、ローカルの root 宛にメールを出してくれる機能が組み込まれているので、特別な作業はありません メールの転送設定ローカルのroot宛にメールを出してくれるので、普段使うアドレスへ転送する設定をします echo admin@localdomain /root/.forward 資料 アーカイブ mainte jail fulltree 8.1-RELEASE (2011-09-10 15 15 28) common jailstp (2012-09-05 13 54 52) ↑ 関連ページ ↑ 名前 コメント
https://w.atwiki.jp/tm-mura/pages/36.html
■表領域のresize alter database datafile /data/undo01.dbf resize 1500M ■既存データファイルの自動拡張を停止 ALTER DATABASE DATAFILE /u01/oradata/pro/SYS01.ORA AUTOEXTEND OFF; ALTER DATABASE TEMPFILE /u01/oradata/pro/TMP01.ORA AUTOEXTEND OFF; ■デフォルト表領域の変更 alter database default tablespace 表領域名; ■表領域のデータファイルの追加 永続/UNDO表領域の場合 Alter tablespace 表領域名 add datafile size 4000m autoextend off; 一時表領域の場合 Alter tablespace 表領域名 add tempfile size 4000m autoextend off; ■表領域の削除 念のためオフラインに alter tablespace 表領域名 offline drop tablespace 表領域名 [including contents] [cascade constraints] ※データファイルも消したい場合は drop tablespace 表領域名 including contents and datafiles