この項では、階層ストアのウォレット管理およびRDMS_DBFS_HS
PL/SQLパッケージの詳細について説明します。
この項の内容は次のとおりです。
コマンドライン・ユーティリティmkstore
では、ウォレットの作成およびシークレット・ストアの別名の追加を行います。次のコマンドを使用して、ウォレットを作成および管理します。
次のようにしてウォレットを作成します。
mkstore -wrl wallet_location -create
次のようにしてKEY
別名を追加します。access_key
およびsecret_key
を一重引用符で囲んで指定します。
mkstore -wrl wallet_location -createCredential alias 'access_key' 'secret_key'
次に例を示します。
mkstore -wrl /home/user1/mywallet -createCredential mykey 'abc' 'xyz'
次のようにしてKEY別名を削除します。
mkstore -wrl wallet_location -deleteCredential alias
次に例を示します。
mkstore -wrl /home/user1/mywallet -deleteCredential mykey
関連項目:
|
Oracle Databaseファイルシステム階層ストア・パッケージ(DBMS_DBFS_HS
)は、DBMSコンテンツの階層ストレージをサポートするDBMS_DBFS_CONTENT
のストア・プロバイダです。DBFS階層ストア(DBFS HS)パッケージには、テープやAmazonS3 Webサービスのような外部ストレージ・デバイスのコンテンツ、およびデータベース内の関連するメタデータ(またはプロパティ)が格納されます。DBFS HSは、データベース表で頻繁にアクセスされるコンテンツをキャッシュして、パフォーマンスを向上させます。
DBMS_DBFS_HS
パッケージをDBMS_DBFS_CONTENT
パッケージと組み合せて使用すると、DBFSリンクを利用するSecureFiles LOBのための階層ストレージ管理を実装できます。このパッケージを使用して、使用頻度の低いデータをテープのような費用の小さい外部デバイスに移行できるため、より高価なデータベース・ディスクを頻繁にアクセスされるデータに使用して、ストレージの費用を大幅に削減できます。DBMS_DBFS_HS
パッケージをストア・プロバイダとしてDBMS_DBFS_CONTENT
パッケージにプラグインし、関連付けられた外部ストレージ・デバイスがテープの場合はテープ・ファイルシステムを、また関連付けられた外部ストレージ・デバイスがAmazon S3ストレージ・デバイスの場合はクラウド・ファイルシステムを実装できます。
DBMS_DBFS_HS
パッケージにより、データベースの表やコンテンツの情報ライフサイクル管理(ILM)の際、テープをストレージ層として使用できるようになります。パッケージでは、Amazon S3のようなWebサービスを含む他の形式のストレージ・ターゲットもサポートされています。このサービスにより、ユーザーはテープまたはこれまでOracleでサポートされていなかったその他の形式のストレージにデータベースのデータを格納できます。テープまたはAmazon S3のデータはOracle Databaseの一部であり、すべての標準APIでアクセスできますが、データベースを介してのみアクセスできます。
DBMS_DBFS_HS
は、情報ライフサイクル管理ソリューションのプリミティブを提供します。DBMS_DBFS_CONTENT_SPI
インタフェースで定義されるCREATE
、PUT
、GET
およびDELETE
などのすべての重要なプリミティブは、DBMS_DBFS_HS
パッケージで実装されます。
DBMS_DBFS_HS
は、DBMS_DBFS_CONTENT_SPI
で定義される方法を実装します。各ストアに関連付けられた外部ストレージ・デバイスおよびキャッシュを管理するために必要な追加インタフェースも用意されています。
関連項目: DBMS_DBFS_HS パッケージの詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。 |
表9-1は、DBMS_DBFS_HS
PL/SQL パッケージのメソッドをまとめています。
表9-1 DBMS_DBFS_HS Pl/SQLパッケージのメソッド
メソッド | 説明 |
---|---|
|
DBFS HSストアを作成します。 |
|
以前に作成したDBFS HSストアを削除します。 |
|
ストアで使用されているデータベース・キャッシュのパラメータを再構成します。 |
|
名前/値プロパティと登録済の階層ストアを関連付けます。 |
|
データベース内のストアのプロパティの値を取り出します。 |
|
|
|
ローカルにキャッシュ済のデータをアーカイブ・ストアにプッシュします。 |
|
コンテンツがない外部ストレージ・デバイスで作成されたファイルを削除します。 |
|
ストアに対するコマンド(メッセージ)を登録し、外部ストレージ・デバイスのメディア・マネージャに送信します。 |
|
ストアに関連付けられたコマンド(メッセージ)を削除します。 |
|
外部ストレージ・デバイスのメディア・マネージャにコマンド(メッセージ)を送信します。 |
このメソッドを使用すると、store_name
という名前でタイプstore_type
(STORETYPE_TAPE
またはSTORETYPE_AMAZONS3
)の新しいDBFS HSストアをスキーマschema_name
(デフォルトで現在のスキーマに設定)に作成できます。これは、表領域tbs_space
の呼出し側のセッションuser.tbl_name
の所有権の下に作成され、database.cache_size
の領域量でストア・エントリを保持して、コンテンツのキャッシュに使用されます。
ストア名は、所有者に対して一意である必要があります。ただし、異なる所有者が所有する別のストアで、同じストア名を使用することはできます。
現在、CREATESTORE()
では、ストアの特定のプロパティがデフォルト値に設定されています。ユーザーは、メソッドSETSTOREPROPERTY()
およびRECONFIGCACHE()
を使用して、プロパティ値を適切に変更したり、ストアのその他のプロパティを設定できます。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
このメソッドを使用すると、以前にstore_name
という名前で作成され、呼出し元のsession_user
により所有されているDBFS HSストアが削除されます。
このメソッドは、DBFSコンテンツAPI(DBMS_DBFS_CONTENT
パッケージ)からストアの登録を解除します。指定されたストアのすべてのファイルは、ストア(テープまたはAmazon S3 Webサービス)から削除されます。データベース内のストアのエントリを保持するデータベース表もまた、このメソッドにより削除されます。
このメソッドの実行は、DDLに類似しています(実行の前後に自動コミットされる)。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
このプロシージャでは、ストアで使用されているデータベース・キャッシュのパラメータが再構成されます。
階層ストアでは、レベル1キャッシュおよびレベル2キャッシュが使用されます。レベル1キャッシュにはほとんどの作業セットが含まれ、レベル2キャッシュはバックエンド・デバイスへの一括書込みに使用されます。
DBMS_DBFS_HS
パッケージは、同時実行性を促進するために、レベル2キャッシュに対して複数のtarballに相当するサイズをオプティミスティックに割り当てようとしますが、レベル2キャッシュには少なくとも1つのtarballのサイズが必要です。
累積キャッシュ・サイズおよびLOBキャッシュ割当て制限の値により、2つのキャッシュ領域の割当てが決まります。値が指定されていない場合、INSUFFICIENT CACHE
例外が発生する可能性があります。そのような場合、作業ストアを使用できるよう、キャッシュ・パラメータを修正することをお薦めします。
このサブプログラムが正常に実行されると、その動作はユーザーによりロールバックできません。そのような場合は、新規または変更済のパラメータを使用して、RECONFIGCACHE
を再度コールする必要があります。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
このメソッドを使用すると、階層ストアに登録されたストアにプロパティが関連付けられます。各プロパティは、名前/値ペアです。
このメソッドの詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』、このメソッドで使用されるDBMS_DBFS_HS
定数の詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
DBFS階層ストアはファイルを圧縮形式で格納する機能があります。圧縮は、プロパティPROPNAME_COMPRESSLVL
を使用して有効にできます。このプロパティはファイルの圧縮に使用する圧縮レベルを指定します。次の4つの許可された値のいずれかにできます: PROPVAL_COMPLVL_NONE
は圧縮なしを示し、PROPVAL_COMPLVL_LOW
はLOW
圧縮を示し、PROPVAL_COMPLVL_MEDIUM
はMEDIUM
圧縮を示し、PROPVAL_COMPLVL_HIGH
はHIGH
圧縮を示します。
通常、圧縮レベルLOW
を使用すると、適切な圧縮率と同時に最適なパフォーマンスを得ることが期待できます。圧縮レベルMEDIUM
および圧縮レベルHIGH
では、圧縮率が大きく向上することが期待されますが、それに対応して圧縮時間が長くなることがあります。DBFS HSストア内のファイルが頻繁に更新される場合など、書込みのパフォーマンスが重要である場合は、NONE
またはLOW
を使用することをお薦めします。領域が重要であるためにできるかぎり高い圧縮率が求められる場合は、MEDIUM
またはHIGH
を使用してください。
ファイルはキャッシュからステージング領域へページ・アウトされて(バックエンドのテープやS3ストレージに順番にプッシュバックされる前に)圧縮されることに注意してください。したがって、圧縮によりステージング領域内に小さいファイルを格納でき、またステージング領域の使用可能な容量を効果的に増加させることができます。
PROPNAME_ENABLECLEANUPONDELETE
動作については、DBMS_DBFS_HS
により各ストアに対してジョブが作成され、未使用のファイルが外部ストレージから削除されます。デフォルトでは、ジョブはSTORETYPE_AMAZONS3
では使用可能、STORETYPE_TAPE
では使用不可に設定されます。ENABLECLEANUPONDELETE
プロパティがTRUE
に設定されると、ジョブは使用可能、FALSE
に設定されると使用不可になります。ジョブが使用可能な場合、デフォルトではジョブは1時間間隔で実行されます。DBMS_SCHEDULER
パッケージを使用して、スケジュールを変更できます。ジョブの名前は、prop_name
=
'DELJOB_NAME
'でUSER_DBFS_HS_FIXED_PROPERTIES
を問い合せることで取得できます。
このメソッドにより、PropertyName
で識別されるデータベース内のストアのプロパティ値が取得されます。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
タイプSTORETYPE_AMAZONS3
のストアに関連付けられたS3バケットは、DBFS HSがコンテンツをそのバケットに移動する際に存在している必要があります。
S3バケットを作成する1つの方法として、DBMS_DBFS_HS.CREATEBUCKET
メソッドを使用する方法があります。このメソッドをコールする前に、ストアのPROPNAME_BUCKET
プロパティを設定する必要があります。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
ローカルにキャッシュ済のデータをstorename
で識別されるアーカイブ・ストアにプッシュします。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
このメソッドにより、現在使用されているデータ(コンテンツ)がない外部ストレージ・デバイスで作成されたファイルが削除されます。このメソッドを周期的に(1週間に1回程度)実行して、外部ストレージ・デバイスの領域をクリアできます。外部ストレージ・デバイスから非同期にコンテンツを削除するのは、OLTPパフォーマンスに対する影響が最小であるため有用です。周期的スケジュールは、DBMS_SCHEDULER
パッケージを使用して実行できます。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
クライアントはこのメソッドを使用して、ストアに対するコマンド(メッセージ)をDBFS HSに登録し、ストアに関連付けられた外部ストレージ・デバイスのメディア・マネージャに送信します。これらのコマンドは、次回のコンテンツの読取り/書込みの前に送信されます。DBFS HSは、ストレージ・デバイスにデータを送信またはストレージ・デバイスからデータを受信する場合、APIセッションを開始してデバイスと対話します。セッションの開始後、データの書込みまたは取得の前に、そのデバイスに対して登録されたすべてのコマンドをデバイスに送信します。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
このメソッドを使用すると、REGISTERSTORECOMMAND
を使用して以前にストアに関連付けられたコマンド(メッセージ)が削除されます。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
これは、外部ストレージ・デバイスのメディア・マネージャで実行されるコマンド(メッセージ)を送信します。
詳細は、『Oracle Database PL/SQLパッケージ・プロシージャおよびタイプ・リファレンス』を参照してください。
DBFS階層ストアの次のビューを使用できます。
パッケージDBMS_DBFS_HS
を使用するには、DBAによりdbfs_role
が付与されている必要があります。
ストアの設定手順:
createStore
をコールします。
DBMS_DBFS_HS.createStore( store_name, store_type, tbl_name, tbs_name, cache_size, lob_cache_quota, optimal_tarball_size, schema_name);
必須およびオプションのプロパティを次のインタフェースを使用して設定します。
DBMS_DBFS_HS.setStoreProperty(StoreName, PropertyName, PropertyValue);
store_type
= STORETYPE_TAPE
の必須プロパティは次のとおりです。
PROPNAME_DEVICELIBRARY, PROPNAME_MEDIAPOOL, PROPNAME_CACHESIZE. PROPNAME_CACHESIZE is already set by createStore.
setStoreProperty
を使用して、PROPNAME_CACHESIZE
の値を変更できます。
オプションのプロパティは次のとおりです。
PROPNAME_OPTTARBALLSIZE, PROPNAME_READCHUNKSIZE, PROPNAME_WRITECHUNKSIZE, PROPNAME_STREAMABLE.
store_type
= STORETYPE_AMAZONS3
の必須プロパティは次のとおりです。
PROPNAME_DEVICELIBRARY, PROPNAME_CACHESIZE, PROPNAME_S3HOST,PROPNAME_BUCKET, PROPNAME_LICENSEID, PROPNAME_WALLET.
PROPNAME_CACHESIZE
は、createStore
により設定済です。setStoreProperty
を使用して、PROPNAME_CACHESIZE
の値を変更できます。
オプションのプロパティは次のとおりです。
PROPNAME_OPTTARBALLSIZE, PROPNAME_READCHUNKSIZE, PROPNAME_WRITECHUNKSIZE, PROPNAME_STREAMABLE, PROPNAME_HTTPPROXY.
次を使用して、ストアをDBFSコンテンツAPIに登録します。
DBMS_DBFS_CONTENT.registerStore(store_name, provider_name, provider_package);
次を使用して、アクセスのためにストアをマウントします。
DBMS_DBFS_CONTENT.mountStore(store_name, store_mount, singleton,principal, owner, acl, asof, read_only);
階層ストアを、独立したファイルシステムまたはSecureFiles LOBのアーカイブ・ソリューションとして使用できます。
DBMS_DBFS_CONTENT
パッケージを使用して、ストア内のファイルシステム・エントリを作成、更新、読取りおよび削除します。
詳細は、DBMS_DBFS_CONTENT
のドキュメントを参照してください。
Amazon S3ストアを構成および使用するプログラムの例を次に示します。
<...>で示される場所を有効な値に置き換えて、プログラムを正しく実行する必要があります。
メソッドおよびそのパラメータの詳細は、DBMS_DBFS_HS
のドキュメントを参照してください。
Rem Example to configure and use an Amazon S3 store. Rem Rem hsuser should be a valid database user who has been granted Rem the role dbfs_role. connect hsuser/hsuser Rem The following block sets up a STORETYPE_AMAZONS3 store with Rem DBMS_DBFS_HS acting as the store provider. declare storename varchar2(32) ; tblname varchar2(30) ; tbsname varchar2(30) ; lob_cache_quota number := 0.8 ; cachesz number ; ots number ; begin cachesz := 50 * 1048576 ; ots := 1048576 ; storename := 's3store10' ; tblname := 's3tbl10' ; tbsname := '<TBS_3>' ; -- Substitute a valid tablespace name -- Create the store. -- Here tbsname is the tablespace used for the store, -- tblname is the table holding all the store entities, -- cachesz is the space used by the store to cache content -- in the tablespace, -- lob_cache_quota is the fraction of cachesz allocated -- to level-1 cache and -- ots is minimum amount of content that is accumulated -- in level-2 cache before being stored in AmazonS3 dbms_dbfs_hs.createStore( storename, dbms_dbfs_hs.STORETYPE_AMAZONS3, tblname, tbsname, cachesz, lob_cache_quota, ots) ; dbms_dbfs_hs.setstoreproperty(storename, dbms_dbfs_hs.PROPNAME_SBTLIBRARY, '<ORACLE_HOME/work/libosbws11.so>'); -- Substitute your ORACLE_HOME path dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_S3HOST, 's3.amazonaws.com') ; dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_BUCKET, 'oras3bucket10') ; dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_WALLET, 'LOCATION=file:<ORACLE_HOME>/work/wlt CREDENTIAL_ALIAS=a_key') ; -- Substitute your ORACLE_HOME path dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_LICENSEID, '<xxxxxxxxxxxxxxxx>') ; -- Substitute a valid SBT license id dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_HTTPPROXY, '<http://www-proxy.mycompany.com:80/>') ; -- Substitute valid value. If a proxy is not used, -- then this property need not be set. dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_COMPRESSLEVEL, 'NONE') ; dbms_dbfs_hs.createbucket(storename) ; -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.registerstore( storename, 's3prvder10', 'dbms_dbfs_hs') ; -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.mountstore( storename, 's3mnt10') ; end ; / Rem The following code block does file operations Rem using DBMS_DBFS_CONTENT on the store configured Rem in the previous code block connect hsuser/hsuser declare path varchar2(256) ; path_pre varchar2(256) ; mount_point varchar2(32) ; store_name varchar2(32) ; prop1 dbms_dbfs_content_properties_t ; prop2 dbms_dbfs_content_properties_t ; mycontent blob := empty_blob() ; buffer varchar2(1050) ; rawbuf raw(1050) ; outcontent blob := empty_blob() ; itemtype integer ; pflag integer ; filecnt integer ; iter integer ; offset integer ; rawlen integer ; begin mount_point := '/s3mnt10' ; store_name := 's3store10' ; path_pre := mount_point ||'/file' ; -- We create 10 empty files in the following loop filecnt := 0 ; loop exit when filecnt = 10 ; path := path_pre || to_char(filecnt) ; mycontent := empty_blob() ; prop1 := null ; -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.createFile( path, prop1, mycontent) ; -- Create the file commit ; filecnt := filecnt + 1 ; end loop ; -- We populate the newly created files with content -- in the following loop pflag := dbms_dbfs_content.prop_data + dbms_dbfs_content.prop_std + dbms_dbfs_content.prop_opt ; buffer := 'Oracle provides an integrated management ' || 'solution for managing Oracle database with '|| 'a unique top-down application management ' || 'approach. With new self-managing ' || 'capabilities, Oracle eliminates time-' || 'consuming, error-prone administrative ' || 'tasks, so database administrators can ' || 'focus on strategic business objectives ' || 'instead of performance and availability ' || 'fire drills. Oracle Management Packs for ' || 'Database provide signifiCant cost and time-'|| 'saving capabilities for managing Oracle ' || 'Databases. Independent studies demonstrate '|| 'that Oracle Database is 40 percent easier ' || 'to manage over DB2 and 38 percent over ' || 'SQL Server.'; rawbuf := utl_raw.cast_to_raw(buffer) ; rawlen := utl_raw.length(rawbuf) ; offset := 1 ; filecnt := 0 ; loop exit when filecnt = 10 ; path := path_pre || to_char(filecnt) ; prop1 := null; -- Append buffer to file -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.putpath( path, prop1, rawlen, offset, rawbuf) ; commit ; filecnt := filecnt + 1 ; end loop ; -- Clear out level 1 cache dbms_dbfs_hs.flushCache(store_name) ; commit ; -- Do write operation on even-numbered files. -- Do read operation on odd-numbered files. filecnt := 0 ; loop exit when filecnt = 10; path := path_pre || to_char(filecnt) ; if mod(filecnt, 2) = 0 then -- Get writable file -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.getPath( path, prop2, outcontent, itemtype, pflag, null, true) ; buffer := 'Agile businesses want to be able to ' || 'quickly adopt new technologies, whether '|| 'operating systems, servers, or ' || 'software, to help them stay ahead of ' || 'the competition. However, change often ' || 'introduces a period of instability into '|| 'mission-critical IT systems. Oracle ' || 'Real Application Testing-with Oracle ' || 'Database 11g Enterprise Edition-allows ' || 'businesses to quickly adopt new ' || 'technologies while eliminating the ' || 'risks associated with change. Oracle ' || 'Real Application Testing combines a ' || 'workload capture and replay feature ' || 'with an SQL performance analyzer to ' || 'help you test changes against real-life '|| 'workloads, and then helps you fine-tune '|| 'the changes before putting them into' || 'production. Oracle Real Application ' || 'Testing supports older versions of ' || 'Oracle Database, so customers running ' || 'Oracle Database 9i and Oracle Database ' || '10g can use it to accelerate their ' || 'database upgrades. '; rawbuf := utl_raw.cast_to_raw(buffer) ; rawlen := utl_raw.length(rawbuf) ; -- Modify file content -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_lob.write(outcontent, rawlen, 10, rawbuf); commit ; else -- Read the file -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.getPath( path, prop2, outcontent, itemtype, pflag) ; end if ; filecnt := filecnt + 1 ; end loop ; -- Delete the first 2 files filecnt := 0; loop exit when filecnt = 2 ; path := path_pre || to_char(filecnt) ; -- Delete file -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.deleteFile(path) ; commit ; filecnt := filecnt + 1 ; end loop ; -- Move content staged in database to Amazon S3 store dbms_dbfs_hs.storePush(store_name) ; commit ; end ; /
テープ・ストアを構成および使用するプログラムの例を次に示します。
<...>で示される場所を有効な値に置き換えて、プログラムを正しく実行する必要があります。
メソッドおよびそのパラメータの詳細は、DBMS_DBFS_HS
のドキュメントを参照してください。
Rem Example to configure and use a Tape store. Rem Rem hsuser should be a valid database user who has been granted Rem the role dbfs_role. connect hsuser/hsuser Rem The following block sets up a STORETYPE_TAPE store with Rem DBMS_DBFS_HS acting as the store provider. declare storename varchar2(32) ; tblname varchar2(30) ; tbsname varchar2(30) ; lob_cache_quota number := 0.8 ; cachesz number ; ots number ; begin cachesz := 50 * 1048576 ; ots := 1048576 ; storename := 'tapestore10' ; tblname := 'tapetbl10' ; tbsname := '<TBS_3>' ; -- Substitute a valid tablespace name -- Create the store. -- Here tbsname is the tablespace used for the store, -- tblname is the table holding all the store entities, -- cachesz is the space used by the store to cache content -- in the tablespace, -- lob_cache_quota is the fraction of cachesz allocated -- to level-1 cache and -- ots is minimum amount of content that is accumulated -- in level-2 cache before being stored in AmazonS3 dbms_dbfs_hs.createStore( storename, dbms_dbfs_hs.STORETYPE_TAPE, tblname, tbsname, cachesz, lob_cache_quota, ots) ; dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_SBTLIBRARY, '<ORACLE_HOME/work/libobkuniq.so>') ; -- Substitute your ORACLE_HOME path dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_MEDIAPOOL, '<0>') ; -- Substitute valid value dbms_dbfs_hs.setstoreproperty( storename, dbms_dbfs_hs.PROPNAME_COMPRESSLEVEL, 'NONE') ; -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.registerstore( storename, 'tapeprvder10', 'dbms_dbfs_hs') ; -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.mountstore(storename, 'tapemnt10') ; end ; / Rem The following code block does file operations Rem using DBMS_DBFS_CONTENT on the store configured Rem in the previous code block connect hsuser/hsuser declare path varchar2(256) ; path_pre varchar2(256) ; mount_point varchar2(32) ; store_name varchar2(32) ; prop1 dbms_dbfs_content_properties_t ; prop2 dbms_dbfs_content_properties_t ; mycontent blob := empty_blob() ; buffer varchar2(1050) ; rawbuf raw(1050) ; outcontent blob := empty_blob() ; itemtype integer ; pflag integer ; filecnt integer ; iter integer ; offset integer ; rawlen integer ; begin mount_point := '/tapemnt10' ; store_name := 'tapestore10' ; path_pre := mount_point ||'/file' ; -- We create 10 empty files in the following loop filecnt := 0 ; loop exit when filecnt = 10 ; path := path_pre || to_char(filecnt) ; mycontent := empty_blob() ; prop1 := null ; -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.createFile( path, prop1, mycontent) ; -- Create the file commit ; filecnt := filecnt + 1 ; end loop ; -- We populate the newly created files with content -- in the following loop pflag := dbms_dbfs_content.prop_data + dbms_dbfs_content.prop_std + dbms_dbfs_content.prop_opt ; buffer := 'Oracle provides an integrated management ' || 'solution for managing Oracle database with '|| 'a unique top-down application management ' || 'approach. With new self-managing ' || 'capabilities, Oracle eliminates time-' || 'consuming, error-prone administrative ' || 'tasks, so database administrators can ' || 'focus on strategic business objectives ' || 'instead of performance and availability ' || 'fire drills. Oracle Management Packs for ' || 'Database provide signifiCant cost and time-'|| 'saving capabilities for managing Oracle ' || 'Databases. Independent studies demonstrate '|| 'that Oracle Database is 40 percent easier ' || 'to manage over DB2 and 38 percent over ' || 'SQL Server.'; rawbuf := utl_raw.cast_to_raw(buffer) ; rawlen := utl_raw.length(rawbuf) ; offset := 1 ; filecnt := 0 ; loop exit when filecnt = 10 ; path := path_pre || to_char(filecnt) ; prop1 := null; -- Append buffer to file -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.putpath( path, prop1, rawlen, offset, rawbuf) ; commit ; filecnt := filecnt + 1 ; end loop ; -- Clear out level 1 cache dbms_dbfs_hs.flushCache(store_name) ; commit ; -- Do write operation on even-numbered files. -- Do read operation on odd-numbered files. filecnt := 0 ; loop exit when filecnt = 10; path := path_pre || to_char(filecnt) ; if mod(filecnt, 2) = 0 then -- Get writable file -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.getPath( path, prop2, outcontent, itemtype, pflag, null, true) ; buffer := 'Agile businesses want to be able to ' || 'quickly adopt new technologies, whether '|| 'operating systems, servers, or ' || 'software, to help them stay ahead of ' || 'the competition. However, change often ' || 'introduces a period of instability into '|| 'mission-critical IT systems. Oracle ' || 'Real Application Testing-with Oracle ' || 'Database 11g Enterprise Edition-allows ' || 'businesses to quickly adopt new ' || 'technologies while eliminating the ' || 'risks associated with change. Oracle ' || 'Real Application Testing combines a ' || 'workload capture and replay feature ' || 'with an SQL performance analyzer to ' || 'help you test changes against real-life '|| 'workloads, and then helps you fine-tune '|| 'the changes before putting them into' || 'production. Oracle Real Application ' || 'Testing supports older versions of ' || 'Oracle Database, so customers running ' || 'Oracle Database 9i and Oracle Database ' || '10g can use it to accelerate their ' || 'database upgrades. '; rawbuf := utl_raw.cast_to_raw(buffer) ; rawlen := utl_raw.length(rawbuf) ; -- Modify file content -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_lob.write(outcontent, rawlen, 10, rawbuf); commit ; else -- Read the file -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.getPath( path, prop2, outcontent, itemtype, pflag) ; end if ; filecnt := filecnt + 1 ; end loop ; -- Delete the first 2 files filecnt := 0; loop exit when filecnt = 2 ; path := path_pre || to_char(filecnt) ; -- Delete file -- Please refer to DBMS_DBFS_CONTENT documentation -- for details about this method dbms_dbfs_content.deleteFile(path) ; commit ; filecnt := filecnt + 1 ; end loop ; -- Move content staged in database to Amazon S3 store dbms_dbfs_hs.storePush(store_name) ; commit ; end ; /