検索
ホームページデータベースmysql チュートリアルOracle 10g新特性之-跨平台表空间传输

1.准备工作: 查询源数据库平台信息 SQLgt; col platform_name for a40SQLgt; SELECT d.PLATFORM_NAME, ENDIAN_FORMAT 2 FROM

1.准备工作:
 查询源数据库平台信息

SQL> col platform_name for a40
SQL> SELECT d.PLATFORM_NAME, ENDIAN_FORMAT
 2 FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d
 3 WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;

PLATFORM_NAME ENDIAN_FORMAT
 ---------------------------------------- --------------
 Solaris[tm] OE (64-bit) Big

查询目标数据库平台信息

SQL> col platform_name for a40
 SQL> SELECT d.PLATFORM_NAME, ENDIAN_FORMAT
 2 FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d
 3 WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;

PLATFORM_NAME ENDIAN_FORMAT
 ---------------------------------------- --------------
 Microsoft Windows IA (32-bit) Little

查询Oracle10g支持的平台转换

SQL> select * from v$transportable_platform;

PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- ---------------------------------------- --------------
1 Solaris[tm] OE (32-bit) Big
2 Solaris[tm] OE (64-bit) Big
7 Microsoft Windows IA (32-bit) Little
10 Linux IA (32-bit) Little
6 AIX-Based Systems (64-bit) Big
3 HP-UX (64-bit) Big
5 HP Tru64 UNIX Little
4 HP-UX IA (64-bit) Big
11 Linux IA (64-bit) Little
15 HP Open VMS Little
8 Microsoft Windows IA (64-bit) Little

PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- ---------------------------------------- --------------
9 IBM zSeries Based Linux Big
13 Linux 64-bit for AMD Little
16 Apple Mac OS Big
12 Microsoft Windows 64-bit for AMD Little

2.创建一个独立的自包含表空间

用于测试

$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.1.0.2.0 - Production on Tue Apr 27 14:04:08 2004

Copyright (c) 1982, 2004, Oracle.?All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/opt/oracle/oradata/wwl/system01.dbf
/opt/oracle/oradata/wwl/undotbs01.dbf
/opt/oracle/oradata/wwl/sysaux01.dbf
/opt/oracle/oradata/wwl/users01.dbf
/data1/oradata/systemfile/wwl01.dbf
/opt/oracle/oradata/wwl/wwl/datafile/o1_mf_test_03xv34ny_.dbf
/opt/oracle/oradata/wwl/wwl/datafile/o1_mf_itpub_03xv5g66_.dbf

7 rows selected.

SQL> create tablespace trans
2?datafile '/data1/oradata/systemfile/trans01.dbf'
3?size 10M;

Tablespace created.

SQL> create user trans identified by trans
2?default tablespace trans;

User created.

SQL> grant connect,resource to trans;

Grant succeeded.

SQL> connect trans/trans
Connected.

SQL> create table test as select * from user_objects;

Table created.

SQL> select count(*) from test;

COUNT(*)
----------
1

SQL> select * from test;

OBJECT_NAME
--------------------------------------------------------------------------------
SUBOBJECT_NAME?OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
------------------------------ ---------- -------------- -------------------
CREATED?LAST_DDL_TIM TIMESTAMP?STATUS?T G S
------------ ------------ ------------------- ------- - - -
TEST
15604?15604 TABLE
27-APR-04?27-APR-04?2004-04-27:14:05:42 VALID?N N N


SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data


3.导出要传输的表空间

$ pwd
 /opt/oracle
 $ cd dpdata
 $ ls
 $ expdp wwl/wwl dumpfile=trans.dmp directory=dpdata transport_tablespace=trans
 LRM-00101: unknown parameter name 'transport_tablespace'

$ expdp wwl/wwl dumpfile=trans.dmp directory=dpdata TRANSPORT_TABLESPACES=trans

Export: Release 10.1.0.2.0 - 64bit Production on Tuesday, 27 April, 2004 14:07

Copyright (c) 2003, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
 With the Partitioning, OLAP and Data Mining options
 Starting "wwl"."SYS_EXPORT_TRANSPORTABLE_01": wwl/******** dumpfile=trans.dmp directory=dpdata TRANSPORT_TABLESPACES=trans
ORA-39123: Data Pump transportable tablespace job aborted
 ORA-29335: tablespace 'TRANS' is not read only

Job "wwl"."SYS_EXPORT_TRANSPORTABLE_01" stopped due to fatal error at 14:08

注意:传输表空间必须置为只读状态

$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.1.0.2.0 - Production on Tue Apr 27 14:08:13 2004

Copyright (c) 1982, 2004, Oracle. All rights reserved.


 Connected to:
 Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
 With the Partitioning, OLAP and Data Mining options

SQL> alter tablespace trans read only;

Tablespace altered.

SQL> exit
 Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
 With the Partitioning, OLAP and Data Mining options


 $ expdp wwl/wwl dumpfile=trans.dmp directory=dpdata TRANSPORT_TABLESPACES=trans

Export: Release 10.1.0.2.0 - 64bit Production on Tuesday, 27 April, 2004 14:08

Copyright (c) 2003, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
 With the Partitioning, OLAP and Data Mining options
 Starting "wwl"."SYS_EXPORT_TRANSPORTABLE_01": wwl/******** dumpfile=trans.dmp directory=dpdata TRANSPORT_TABLESPACES=trans
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
 Processing object type TRANSPORTABLE_EXPORT/TABLE
 Processing object type TRANSPORTABLE_EXPORT/TTE_POSTINST/PLUGTS_BLK
 Master table "wwl"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
 ******************************************************************************
 Dump file set for wwl.SYS_EXPORT_TRANSPORTABLE_01 is:
 /opt/oracle/dpdata/trans.dmp
 Job "wwl"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 14:09

4.使用rman转换文件格式


 $ rman target /

Recovery Manager: Release 10.1.0.2.0 - 64bit Production

Copyright (c) 1995, 2004, Oracle. All rights reserved.

connected to target database: wwl (DBID=1337390772)

RMAN> convert tablespace trans
 2> to platform 'Microsoft Windows IA (32-bit)'
 3> Format '/tmp/%U';

Starting backup at 27-APR-04
 using target database controlfile instead of recovery catalog
 allocated channel: ORA_DISK_1
 channel ORA_DISK_1: sid=148 devtype=DISK
 channel ORA_DISK_1: starting datafile conversion
 input datafile fno=00008 name=/data1/oradata/systemfile/trans01.dbf
 converted datafile=/tmp/data_D-wwl_I-1337390772_TS-TRANS_FNO-8_01fk92hg
 channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
 Finished backup at 27-APR-04

RMAN> exit


 Recovery Manager complete.

5.确认导出文件已生成

$ ls /tmp/data*
 /tmp/data_D-wwl_I-1337390772_TS-TRANS_FNO-8_01fk92hg
 $ ls -l /tmp/data*
 -rw-r----- 1 oracle dba 10493952 Apr 27 14:12 /tmp/data_D-wwl_I-1337390772_TS-TRANS_FNO-8_01fk92hg
 $ chmod 777 /tmp/data*
 $ chmod 777 /opt/oracle/dpdata/*

6.通过ftp传输文件至目标主机

220 billing-center.hurray.com.cn FTP server (SunOS 5.8) ready.
 User (192.168.96.10none)): gqgai
 331 Password required for gqgai.
 Password:
 230 User gqgai logged in.
 ftp> bin
 200 Type set to I.
 ftp> cd /tmp
 250 CWD command successful.
 ftp> mget data*
 200 Type set to I.
 mget data_D-wwl_I-1337390772_TS-TRANS_FNO-8_01fk92hg? y
 200 PORT command successful.
 150 Binary data connection for data_D-wwl_I-1337390772_TS-TRANS_FNO-8_01fk92hg (192.168.96.5,2885) (10493952 bytes).
 226 Binary Transfer complete.
 ftp: 10493952 bytes received in 15.90Seconds 659.87Kbytes/sec.
 ftp> cd /opt/oracle/dpdata
 250 CWD command successful.
 ftp> ls
 200 PORT command successful.
 150 ASCII data connection for /bin/ls (192.168.96.5,2889) (0 bytes).
 export.log
 trans.dmp
 226 ASCII Transfer complete.
 ftp: 23 bytes received in 0.01Seconds 2.30Kbytes/sec.
 ftp> bin
 200 Type set to I.
 ftp> mget trans.dmp
 200 Type set to I.
 mget trans.dmp? y
 200 PORT command successful.
 150 Binary data connection for trans.dmp (192.168.96.5,2893) (73728 bytes).
 226 Binary Transfer complete.
 ftp: 73728 bytes received in 0.03Seconds 2457.60Kbytes/sec.
 ftp> bye
 221 Goodbye.


 7.使用rman在目标数据库转换文件

E:\Oracle\oradata\wwl\dpdata>rman target /

恢复管理器: 版本10.1.0.2.0 - Production

Copyright (c) 1995, 2004, Oracle. All rights reserved.

连接到目标数据库: wwl (DBID=1587222708)


 RMAN> CONVERT DATAFILE 'E:\Oracle\oradata\wwl\dpdata\data_D-wwl_I-1337390772_TS-TRANS_FNO-8_01fk92hg'
 2> DB_FILE_NAME_CONVERT
 3> 'E:\Oracle\oradata\wwl\dpdata\data_D-wwl_I-1337390772_TS-TRANS_FNO-8_01fk92hg','E:\Oracle\oradata\wwl\wwl\DATAFILE\trans01.dbf';

启动 backup 于 27-4月 -04
 使用通道 ORA_DISK_1
 通道 ORA_DISK_1: 启动数据文件转换
 输出文件名=E:\ORACLE\ORADATA\wwl\DPDATA\DATA_D-wwl_I-1337390772_TS-TRANS_FNO-8_01FK92HG
 已转换的数据文件 = E:\ORACLE\ORADATA\wwl\wwl\DATAFILE\TRANS01.DBF
 通道 ORA_DISK_1: 数据文件转换完毕, 经过时间: 00:00:04
 完成 backup 于 27-4月 -04

RMAN>


8.在目标数据库plugin数据文件

注意目标数据库中的目标用户必须存在,否则会报错.

E:\Oracle\oradata\wwl\dpdata>impdp wwl/wwl dumpfile=trans.dmp directory=dpdata transport_datafiles='E:\Oracle\orad
 ata\wwl\wwl\DATAFILE\TRANS01.DBF'

Import: Release 10.1.0.2.0 - Production on 星期二, 27 4月, 2004 15:02

Copyright (c) 2003, Oracle. All rights reserved.

连接到: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
 With the Partitioning, OLAP and Data Mining options
 已成功加载/卸载了主表 "wwl"."SYS_IMPORT_TRANSPORTABLE_01"
 启动 "wwl"."SYS_IMPORT_TRANSPORTABLE_01": wwl/******** dumpfile=trans.dmp directory=dpdata transport_datafiles='E:\
 Oracle\oradata\wwl\wwl\DATAFILE\TRANS01.DBF'
 处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
 ORA-39123: 数据泵可传输的表空间作业中止
 ORA-29342: 数据库中不存在用户 TRANS

作业 "wwl"."SYS_IMPORT_TRANSPORTABLE_01" 因致命错误于 15:02 停止


 E:\Oracle\oradata\wwl\dpdata>sqlplus "/ as sysdba"

SQL*Plus: Release 10.1.0.2.0 - Production on 星期二 4月 27 15:03:03 2004

Copyright (c) 1982, 2004, Oracle. All rights reserved.


 连接到:
 Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
 With the Partitioning, OLAP and Data Mining options

SQL> create user trans identified by trans;

用户已创建。

SQL> grant connect,resource to trans;

授权成功。

SQL> exit
 从 Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
 With the Partitioning, OLAP and Data Mining options 断开

E:\Oracle\oradata\wwl\dpdata>impdp wwl/wwl dumpfile=trans.dmp directory=dpdata transport_datafiles='E:\Oracle\orad
 ata\wwl\wwl\DATAFILE\TRANS01.DBF'

Import: Release 10.1.0.2.0 - Production on 星期二, 27 4月, 2004 15:03

Copyright (c) 2003, Oracle. All rights reserved.

连接到: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
 With the Partitioning, OLAP and Data Mining options
 已成功加载/卸载了主表 "wwl"."SYS_IMPORT_TRANSPORTABLE_01"
 启动 "wwl"."SYS_IMPORT_TRANSPORTABLE_01": wwl/******** dumpfile=trans.dmp directory=dpdata transport_datafiles='E:\
 Oracle\oradata\wwl\wwl\DATAFILE\TRANS01.DBF'
 处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
 处理对象类型 TRANSPORTABLE_EXPORT/TABLE
 处理对象类型 TRANSPORTABLE_EXPORT/TTE_POSTINST/PLUGTS_BLK
 作业 "wwl"."SYS_IMPORT_TRANSPORTABLE_01" 已于 15:03 成功完成

9.检查数据

E:\Oracle\oradata\wwl\dpdata>sqlplus trans/trans

SQL*Plus: Release 10.1.0.2.0 - Production on 星期二 4月 27 15:03:50 2004

Copyright (c) 1982, 2004, Oracle. All rights reserved.


 连接到:
 Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
 With the Partitioning, OLAP and Data Mining options

SQL> select count(*) from test;

COUNT(*)
 ----------
 1

SQL> exit
 从 Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
 With the Partitioning, OLAP and Data Mining options 断开

E:\Oracle\oradata\wwl\dpdata>

可以选择把表空间更改为读写

SQL> alter tablespace trans read write;

表空间已更改。


10.总结

10g的表空间跨平台迁移,,较9i就是增加了一个使用Rman进行的文件格式转换的过程.
 实际上也就是转换了数据文件头的格式信息而已.


-The End-

更多Oracle相关信息见Oracle 专题页面 ?tid=12

linux

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
MySQL:世界で最も人気のあるデータベースの紹介MySQL:世界で最も人気のあるデータベースの紹介Apr 12, 2025 am 12:18 AM

MySQLはオープンソースのリレーショナルデータベース管理システムであり、主にデータを迅速かつ確実に保存および取得するために使用されます。その実用的な原則には、クライアントリクエスト、クエリ解像度、クエリの実行、返品結果が含まれます。使用法の例には、テーブルの作成、データの挿入とクエリ、および参加操作などの高度な機能が含まれます。一般的なエラーには、SQL構文、データ型、およびアクセス許可、および最適化の提案には、インデックスの使用、最適化されたクエリ、およびテーブルの分割が含まれます。

MySQLの重要性:データストレージと管理MySQLの重要性:データストレージと管理Apr 12, 2025 am 12:18 AM

MySQLは、データストレージ、管理、クエリ、セキュリティに適したオープンソースのリレーショナルデータベース管理システムです。 1.さまざまなオペレーティングシステムをサポートし、Webアプリケーションやその他のフィールドで広く使用されています。 2。クライアントサーバーアーキテクチャとさまざまなストレージエンジンを通じて、MySQLはデータを効率的に処理します。 3.基本的な使用には、データベースとテーブルの作成、挿入、クエリ、データの更新が含まれます。 4.高度な使用には、複雑なクエリとストアドプロシージャが含まれます。 5.一般的なエラーは、説明ステートメントを介してデバッグできます。 6.パフォーマンスの最適化には、インデックスの合理的な使用と最適化されたクエリステートメントが含まれます。

なぜMySQLを使用するのですか?利点と利点なぜMySQLを使用するのですか?利点と利点Apr 12, 2025 am 12:17 AM

MySQLは、そのパフォーマンス、信頼性、使いやすさ、コミュニティサポートに選択されています。 1.MYSQLは、複数のデータ型と高度なクエリ操作をサポートし、効率的なデータストレージおよび検索機能を提供します。 2.クライアントサーバーアーキテクチャと複数のストレージエンジンを採用して、トランザクションとクエリの最適化をサポートします。 3.使いやすく、さまざまなオペレーティングシステムとプログラミング言語をサポートしています。 4.強力なコミュニティサポートを提供し、豊富なリソースとソリューションを提供します。

InnoDBロックメカニズム(共有ロック、排他的ロック、意図ロック、レコードロック、ギャップロック、次のキーロック)を説明します。InnoDBロックメカニズム(共有ロック、排他的ロック、意図ロック、レコードロック、ギャップロック、次のキーロック)を説明します。Apr 12, 2025 am 12:16 AM

INNODBのロックメカニズムには、共有ロック、排他的ロック、意図ロック、レコードロック、ギャップロック、次のキーロックが含まれます。 1.共有ロックにより、トランザクションは他のトランザクションが読み取らないようにデータを読み取ることができます。 2.排他的ロックは、他のトランザクションがデータの読み取りと変更を防ぎます。 3.意図ロックは、ロック効率を最適化します。 4。ロックロックインデックスのレコードを記録します。 5。ギャップロックロックインデックス記録ギャップ。 6.次のキーロックは、データの一貫性を確保するためのレコードロックとギャップロックの組み合わせです。

貧弱なMySQLクエリパフォーマンスの一般的な原因は何ですか?貧弱なMySQLクエリパフォーマンスの一般的な原因は何ですか?Apr 12, 2025 am 12:11 AM

MySQLクエリのパフォーマンスが低いことの主な理由には、インデックスの使用、クエリオプティマイザーによる誤った実行計画の選択、不合理なテーブルデザイン、過剰なデータボリューム、ロック競争などがあります。 1.インデックスがゆっくりとクエリを引き起こし、インデックスを追加するとパフォーマンスが大幅に向上する可能性があります。 2。説明コマンドを使用してクエリ計画を分析し、オプティマイザーエラーを見つけます。 3.テーブル構造の再構築と結合条件を最適化すると、テーブルの設計上の問題が改善されます。 4.データボリュームが大きい場合、パーティション化とテーブル分割戦略が採用されます。 5.高い並行性環境では、トランザクションの最適化とロック戦略は、ロック競争を減らすことができます。

複数の単一列インデックスに対して複合インデックスをいつ使用する必要がありますか?複数の単一列インデックスに対して複合インデックスをいつ使用する必要がありますか?Apr 11, 2025 am 12:06 AM

データベースの最適化では、クエリ要件に従ってインデックス作成戦略を選択する必要があります。1。クエリに複数の列が含まれ、条件の順序が固定されている場合、複合インデックスを使用します。 2。クエリに複数の列が含まれているが、条件の順序が修正されていない場合、複数の単一列インデックスを使用します。複合インデックスは、マルチコラムクエリの最適化に適していますが、単一列インデックスは単一列クエリに適しています。

MySQLでスロークエリを識別して最適化する方法は? (スロークエリログ、Performance_schema)MySQLでスロークエリを識別して最適化する方法は? (スロークエリログ、Performance_schema)Apr 10, 2025 am 09:36 AM

MySQLスロークエリを最適化するには、slowquerylogとperformance_schemaを使用する必要があります。1。LowerQueryLogを有効にし、しきい値を設定して、スロークエリを記録します。 2。performance_schemaを使用してクエリの実行の詳細を分析し、パフォーマンスのボトルネックを見つけて最適化します。

MySQLおよびSQL:開発者にとって不可欠なスキルMySQLおよびSQL:開発者にとって不可欠なスキルApr 10, 2025 am 09:30 AM

MySQLとSQLは、開発者にとって不可欠なスキルです。 1.MYSQLはオープンソースのリレーショナルデータベース管理システムであり、SQLはデータベースの管理と操作に使用される標準言語です。 2.MYSQLは、効率的なデータストレージと検索機能を介して複数のストレージエンジンをサポートし、SQLは簡単なステートメントを通じて複雑なデータ操作を完了します。 3.使用の例には、条件によるフィルタリングやソートなどの基本的なクエリと高度なクエリが含まれます。 4.一般的なエラーには、SQLステートメントをチェックして説明コマンドを使用することで最適化できる構文エラーとパフォーマンスの問題が含まれます。 5.パフォーマンス最適化手法には、インデックスの使用、フルテーブルスキャンの回避、参加操作の最適化、コードの読み取り可能性の向上が含まれます。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

SublimeText3 Linux 新バージョン

SublimeText3 Linux 新バージョン

SublimeText3 Linux 最新バージョン

DVWA

DVWA

Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser は、オンライン試験を安全に受験するための安全なブラウザ環境です。このソフトウェアは、あらゆるコンピュータを安全なワークステーションに変えます。あらゆるユーティリティへのアクセスを制御し、学生が無許可のリソースを使用するのを防ぎます。