转://RMAN跨平台可传输表空间和数据库
參考鏈接:
http://blog.itpub.net/23135684/viewspace-776048/
http://blog.sina.com.cn/s/blog_69e7b8d7010164xh.html
https://www.2cto.com/database/201311/260446.html
這篇文章翻譯自O(shè)racle 11gR2官方文檔。詳細討論了使用RMAN工具的CONVERT DATAFILE,CONVERT TABLESPACE和CONVERT DATABASE命令實現(xiàn)跨平臺傳輸表空間和數(shù)據(jù)庫。
?
27? Transporting Data Across Platforms
You?can use RMAN to transport tablespaces across platforms with different endian formats. You can also use RMAN to transport an entire database to a different platform so long as the two platforms have the same endian format.
你可以使用RMAN在具有不同字節(jié)序序列的平臺之間傳輸表空間。?你也可以使用RMAN傳輸整個數(shù)據(jù)庫到不同的平臺,只要這兩個平臺具有相同的字符串格式即可。
?
Overview of Cross-Platform Data Transportation
This section explains the basic concepts and tasks involved in transporting tablespaces and databases across platforms.
Purpose of Cross-Platform Data Transportation
You can transport tablespaces in a database that runs on one platform into a database that runs on a different platform. Typical uses of cross-platform transportable tablespaces include the following:
你可以將在一個平臺上運行的數(shù)據(jù)庫中的表空間傳輸?shù)皆诓煌脚_上運行的數(shù)據(jù)庫。跨平臺可運輸表空間的典型用途包括:
- Publishing structured data as transportable tablespaces for distribution to customers, who can convert the tablespaces for integration into their existing databases regardless of platform
- Moving data from a large data warehouse server to data marts on smaller computers such as Linux-based workstations or servers
- Sharing read-only tablespaces across a heterogeneous cluster in which all hosts share the same endian format
·?????????將結(jié)構(gòu)化數(shù)據(jù)作為可傳輸表空間發(fā)布給客戶,無論平臺如何,可將表空間轉(zhuǎn)換為現(xiàn)有數(shù)據(jù)庫進行集成
·?????????將數(shù)據(jù)從大型數(shù)據(jù)倉庫服務(wù)器移動到較小型計算機(如基于Linux的工作站或服務(wù)器)上的數(shù)據(jù)集市
·?????????在異構(gòu)集群中共享只讀表空間,其中所有主機共享相同的端格式
You can also use RMAN to transport an entire database from one platform to another. For example, business requirements demand that you run your databases on less expensive servers that use a different platform. In this case, you can use RMAN to transport the entire database rather than re-create it and use import utilities or transportable tablespaces to repopulate the data.
你還可以使用RMAN將整個數(shù)據(jù)庫從一個平臺傳輸?shù)搅硪粋€平臺。例如,業(yè)務(wù)需求要求在使用不同平臺的較便宜的服務(wù)器上運行數(shù)據(jù)庫。在這種情況下,你可以使用RMAN傳輸整個數(shù)據(jù)庫,而不是重新創(chuàng)建它,并使用導(dǎo)入實用程序或可移動表空間重新填充數(shù)據(jù)。
You can convert a database on the destination host or source host. Reasons for converting on the destination host include:
你可以在目標(biāo)主機或源主機上轉(zhuǎn)換數(shù)據(jù)庫。?在目的主機上轉(zhuǎn)換的原因包括:
- Avoiding performance overhead on the source host due to the conversion process
- Distributing a database from one source system to multiple recipients on several different platforms
- Evaluating a migration path for a new platform
·?????????由于轉(zhuǎn)換過程,避免源主機的性能開銷
·?????????將數(shù)據(jù)庫從一個源系統(tǒng)分發(fā)到多個不同平臺上的多個收件人
·?????????評估新平臺的遷移路徑
?
Basic Concepts of Cross-Platform Data Transportation
You must use the RMAN?CONVERT?command in a transportable tablespace operation when the?source platform?is different from the?destination platformand the endian formats are different. If you are converting part of the database between platforms that have the same endian format, you can use operating system methods to copy the files from the source to the destination. If you are converting an entire, same endian database, any data files with undo information must be converted. You cannot copy the data files directly from the source to the destination platform.
當(dāng)源平臺與目標(biāo)平臺不同,并且字節(jié)存儲順序不同時,必須在可移動表空間操作中使用RMAN CONVERT命令。?如果要在具有相同字節(jié)存儲順序的平臺之間轉(zhuǎn)換部分?jǐn)?shù)據(jù)庫,則可以使用操作系統(tǒng)方法將文件從源端復(fù)制到目標(biāo)端。?如果要轉(zhuǎn)換整個具有相同字節(jié)存儲順序的數(shù)據(jù)庫,則必須轉(zhuǎn)換具有undo信息的任何數(shù)據(jù)文件。不能將數(shù)據(jù)文件直接從源端復(fù)制到目標(biāo)平臺。
Tablespace and Data File Conversion
You can perform tablespace conversion with the RMAN?CONVERT?TABLESPACE?command on the source host, but not on the destination host. The?CONVERT TABLESPACE?command does not perform in-place conversion of data files. Rather, the command produces output files in the correct format for use on the destination platform. The command does not alter the contents of data files in the source database.
你以在源主機上使用RMAN CONVERT TABLESPACE命令進行表空間轉(zhuǎn)換,但該命令不能用在目標(biāo)主機。?CONVERT TABLESPACE命令不能進行數(shù)據(jù)文件的就地轉(zhuǎn)換。?相反,該命令會以正確的格式生成輸出文件,以便在目標(biāo)平臺上使用。?該命令不會更改源數(shù)據(jù)庫中的數(shù)據(jù)文件的內(nèi)容。
You can use the?CONVERT?DATAFILE?command to convert files on the destination host, but not on the source host. The Data Pump Export utility generates anexport dump file?that, with data files manually copied to the destination host, can be imported into the destination database. Until the data files are transported into the destination database, the data files are not associated with a tablespace name in the database. In this case, RMAN cannot translate the tablespace name into a list of data files. Therefore, you must use?CONVERT?DATAFILE?and identify the data files by file name.
可以在目標(biāo)主機上使用CONVERT DATAFILE命令轉(zhuǎn)換文件,但該命令不能用在源主機上。“數(shù)據(jù)泵導(dǎo)出”生成一個轉(zhuǎn)儲文件,可將該dump文件手動復(fù)制到目標(biāo)主機,將其導(dǎo)入目標(biāo)數(shù)據(jù)庫。?在將數(shù)據(jù)文件傳輸?shù)侥繕?biāo)數(shù)據(jù)庫之前,數(shù)據(jù)文件不與數(shù)據(jù)庫中的表空間名稱相關(guān)聯(lián)。在這種情況下,RMAN無法將表空間名稱轉(zhuǎn)換為數(shù)據(jù)文件列表。?因此,必須使用CONVERT DATAFILE來根據(jù)文件名來識別數(shù)據(jù)文件。
Database Conversion
To convert a whole database to a different platform, both platforms must use the same endian format. The RMAN?CONVERT?DATABASE?command automates the movement of an entire database from a source platform to a destination platform. The transported database contains the same data as the source database and also has, with a few exceptions, the same settings as the source database.
要將整個數(shù)據(jù)庫轉(zhuǎn)換為不同的平臺,兩個平臺必須使用相同的字節(jié)存儲順序。?RMAN CONVERT DATABASE命令自動將整個數(shù)據(jù)庫從源平臺移動到目標(biāo)平臺。傳輸?shù)臄?shù)據(jù)庫包含與源數(shù)據(jù)庫相同的數(shù)據(jù),除了少數(shù)特例,還有與源數(shù)據(jù)庫相同的設(shè)置。
自動傳送到目標(biāo)平臺的文件包括:
Files automatically transported to the destination platform include:
- Data files that belong to permanent tablespaces
Unlike transporting tablespaces across platforms, transporting entire databases requires that certain types of blocks, such as blocks in undo segments, be reformatted to ensure compatibility with the destination platform. Even though the endian formats for the source and destination platforms are the same, the data files for a transportable database must under go a conversion process. You cannot simply copy data files from one platform to another as you can when transporting tablespaces.
?屬于永久表空間的數(shù)據(jù)文件
與跨平臺傳輸表空間不同,傳輸整個數(shù)據(jù)庫需要重新格式化某些類型的塊(例如undo段中的塊),以確保與目標(biāo)平臺的兼容性。即使源平臺和目標(biāo)平臺的字節(jié)存儲順序相同,可傳輸數(shù)據(jù)庫的數(shù)據(jù)文件必須經(jīng)過轉(zhuǎn)換。當(dāng)在傳輸表空間時,你不能簡單地將數(shù)據(jù)文件從一個平臺復(fù)制到另一個平臺。
- Initialization parameter file or server parameter file
If the database uses a text-based initialization parameter file, then RMAN transports it. If the database uses a server parameter file, then RMAN generates an initialization parameter file based on the server parameter file, transports it and creates a new server parameter file at the destination based on the settings in the initialization parameter file.
Usually, some parameters in the initialization parameter file require manual updating for the new database. For example, you may change the?DB_NAMEand parameters such as?CONTROL_FILES?that indicate the locations of files on the destination host.
?初始化參數(shù)文件或服務(wù)器參數(shù)文件
如果數(shù)據(jù)庫使用文本初始化參數(shù)文件,那么RMAN會傳輸它。如果數(shù)據(jù)庫使用服務(wù)器參數(shù)文件,首先RMAN會根據(jù)服務(wù)器參數(shù)文件生成一個初始化參數(shù)文件,并在目標(biāo)端根據(jù)初始化參數(shù)文件中的設(shè)置傳輸并創(chuàng)建一個新的服務(wù)器參數(shù)文件。
通常,初始化參數(shù)文件中的一些參數(shù)需要手動更新新的數(shù)據(jù)庫。例如,您可以更改DB_NAME和參數(shù)(如CONTROL_FILES),以指示目標(biāo)主機上文件的位置。
You can convert the format of the data files either on the source platform or on the destination platform. The?CONVERT DATABASE ON DESTINATION PLATFORM command does not convert the format of data files. Rather, it generates scripts that you can run manually to perform the conversion. The?CONVERT SCRIPTparameter creates a?convert script?that you can manually execute at the destination host to convert data file copies in batch mode. The?TRANSPORT SCRIPTparameter generates a?transport script?that contains SQL statements to create the new database on the destination platform.
可以在源平臺或目標(biāo)平臺上轉(zhuǎn)換數(shù)據(jù)文件的格式。?CONVERT DATABASE ON DESTINATION PLATFORM命令不轉(zhuǎn)換數(shù)據(jù)文件的格式。?相反,它生成可以手動運行以執(zhí)行轉(zhuǎn)換的腳本。?CONVERT SCRIPT參數(shù)創(chuàng)建一個轉(zhuǎn)換腳本,你可以在目標(biāo)主機上手動執(zhí)行轉(zhuǎn)換腳本,以批處理模式轉(zhuǎn)換數(shù)據(jù)文件副本。?TRANSPORT SCRIPT參數(shù)生成包含SQL語句的傳輸腳本,以在目標(biāo)平臺上創(chuàng)建新的數(shù)據(jù)庫。
Performing Cross-Platform Tablespace Conversion on the Source Host(在源主機中執(zhí)行跨平臺表空間傳輸)
For purposes of illustration, assume that you must transport tablespaces?finance?and?hr?from source database?prod_source, which runs on a Sun Solaris host. You plan to transport them to destination database?prod_dest?running on a Linux PC. You plan to store the converted data files in the temporary directory/tmp/transport_linux/?on the source host.
為了說明情況,假設(shè)你必須從在Sun Solaris主機上運行的源數(shù)據(jù)庫prod_source傳輸表空間finance和hr。?你計劃將它們傳輸?shù)竭\行在Linux PC上的目標(biāo)數(shù)據(jù)庫prod_dest。你計劃將轉(zhuǎn)換的數(shù)據(jù)文件存儲在源主機上的/ tmp / transport_linux /臨時目錄中。
To perform cross-platform tablespace conversion on the source host:
在源主機上執(zhí)行跨平臺表空間轉(zhuǎn)換:
啟動SQL * Plus,并以管理員權(quán)限連接到源數(shù)據(jù)庫prod_source。
The database has a list of its own internal names for each platform supporting cross-platform data transport. You may need the exact name of the source or destination platform as a parameter to the?CONVERT?command. Query?V$TRANSPORTABLE_PLATFORM?to get the platform names. The following example queries Linux platform names:
在V $ TRANSPORTABLE_PLATFORM視圖中查詢目標(biāo)平臺的名稱。
數(shù)據(jù)庫具有支持跨平臺數(shù)據(jù)傳輸?shù)拿總€平臺的自己內(nèi)部名稱的列表。?你可能需要源平臺或目標(biāo)平臺的確切名稱作為CONVERT命令的參數(shù)。?查詢V $ TRANSPORTABLE_PLATFORM以獲取平臺名稱。?以下示例查詢Linux平臺名稱:
SELECT PLATFORM_ID, PLATFORM_NAME, ENDIAN_FORMAT
FROM?? V$TRANSPORTABLE_PLATFORM?
WHERE? UPPER(PLATFORM_NAME) LIKE '%LINUX%';
The?PLATFORM_NAME?for Linux on a PC is?Linux IA (32-bit).
將待傳輸?shù)谋砜臻g放置在只讀模式。
ALTER TABLESPACE finance READ ONLY;
ALTER TABLESPACE hr READ ONLY;
You must use the?FORMAT?or?DB_FILE_NAME_CONVERT?arguments to the?CONVERT?command to control the names of the output files. The rules are listed in order of precedence:
你必須使用CONVERT命令的FORMAT或DB_FILE_NAME_CONVERT參數(shù)來控制輸出文件的名稱。?規(guī)則按優(yōu)先順序列出:
如果指定了FORMAT子句,則根據(jù)CONVERT ... DB_FILE_NAME_CONVERT子句中提供的模式未命名的任何文件都將基于FORMAT模式進行命名。
Note:
You cannot use?CONVERT ... DB_FILE_NAME_CONVERT?to generate output file names for the?CONVERT?command when the source and destination files have Oracle Managed File names.
當(dāng)源文件和目標(biāo)文件具有Oracle托管文件名時,不能使用CONVERT ... DB_FILE_NAME_CONVERT為CONVERT命令生成輸出文件名。
?
% rman
RMAN> CONNECT TARGET SYS@prod_source
In the following example, the?FORMAT?argument controls the name and location of the converted data files:
RMAN> CONVERT TABLESPACE finance,hr
2>?? TO PLATFORM 'Linux IA (32-bit)'
3> ??FORMAT '/tmp/transport_linux/%U';
The result is a set of converted data files in the?/tmp/transport_linux/?directory, with data in the correct endian format for the Linux IA (32-bit) platform.
使用Oracle?數(shù)據(jù)泵在源主機上創(chuàng)建導(dǎo)出轉(zhuǎn)儲文件。
將轉(zhuǎn)換的數(shù)據(jù)文件和導(dǎo)出轉(zhuǎn)儲文件從源主機移動到目標(biāo)主機上的所需目錄。
使用導(dǎo)入程序?qū)⒈砜臻g插入新數(shù)據(jù)庫。
如果適用,將傳輸?shù)谋砜臻g設(shè)置為讀/寫模式。
?
Performing Cross-Platform Data File Conversion on the Destination Host(在目標(biāo)主機中執(zhí)行跨平臺數(shù)據(jù)文件傳輸)
About Cross-Platform Data File Conversion on the Destination Host
Data file conversion necessitates that you choose a technique for naming the output files. You must use the?FORMAT?or?DB_FILE_NAME_CONVERT?arguments to theCONVERT?command to control the naming of output files. The rules are listed in order of precedence:
你必須使用CONVERT命令的FORMAT或DB_FILE_NAME_CONVERT參數(shù)來控制命名輸出文件。規(guī)則按優(yōu)先順序列出:
與CONVERT中提供的任何模式匹配的文件... DB_FILE_NAME_CONVERT子句根據(jù)此模式命名。
如果指定FORMAT子句,則根據(jù)CONVERT ... DB_FILE_NAME_CONVERT子句中提供的模式未命名的任何文件都將基于FORMAT模式進行命名。
Note:
You cannot use?CONVERT ... DB_FILE_NAME_CONVERT?to generate output file names for the?CONVERT?command when both the source and destination files are Oracle Managed Files.
當(dāng)源文件和目標(biāo)文件都是Oracle托管文件時,不能使用CONVERT ... DB_FILE_NAME_CONVERT來生成CONVERT命令的輸出文件名。
If the source and destination platforms differ, then you must specify the?FROM PLATFORM?parameter. View platform names by querying the V$TRANSPORTABLE_PLATFORM. The?FROM PLATFORM?value must match the format of the data files to be converted to avoid an error. If you do not specify?FROM PLATFORM, then this parameter defaults to the value of the destination platform.
如果源和目標(biāo)平臺不同,則必須指定FROM PLATFORM參數(shù)。通過查詢V $ TRANSPORTABLE_PLATFORM查看平臺名稱。?FROM PLATFORM值必須與要轉(zhuǎn)換的數(shù)據(jù)文件的格式相匹配,以避免錯誤。如果不指定FROM PLATFORM,則此參數(shù)默認(rèn)為目標(biāo)平臺的值。
Using CONVERT DATAFILE to Convert Data File Formats
This section explains how to use the?CONVERT DATAFILE?command. The section assumes that you intend to transport tablespaces?finance?(data filesfin/fin01.dbf?and?fin/fin02.dbf) and?hr?(data files?hr/hr01.dbf?and?hr/hr02.dbf) from a source database named?prod_source. The database runs on a Sun Solaris host. You plan to transport these tablespaces into a destination database named?prod_dest, which runs on a Linux PC. You plan to perform conversion on the destination host.
假設(shè)你打算從prod_source源數(shù)據(jù)庫傳輸表空間finance(data filesfin / fin01.dbf和fin / fin02.dbf)和hr(數(shù)據(jù)文件hr / hr01.dbf和hr / hr02.dbf)。?該數(shù)據(jù)庫在Sun Solaris主機上運行。?你計劃將這些表空間傳輸?shù)?/strong>prod_dest目標(biāo)數(shù)據(jù)庫,該數(shù)據(jù)庫在Linux PC上運行。你計劃在目標(biāo)主機上執(zhí)行轉(zhuǎn)換。
When the data files are plugged into the destination database, you plan to store them in?/orahome/dbs?and preserve the current directory structure. That is, data files for the?hr?tablespace are stored in the?/orahome/dbs/hr?subdirectory, and data files for the?finance?tablespace are stored in the?/orahome/dbs/fin directory.
當(dāng)數(shù)據(jù)文件插入目標(biāo)數(shù)據(jù)庫時,你計劃將它們存儲在/ orahome / dbs中,并保留當(dāng)前的目錄結(jié)構(gòu)。?也就是說,hr表空間的數(shù)據(jù)文件存儲在/ orahome / dbs / hr子目錄中,finance表空間數(shù)據(jù)文件存儲在/ orahome / dbs / fin目錄中。
To perform cross-platform data file conversion on the destination host:
啟動SQL * Plus,并以管理員權(quán)限連接到源數(shù)據(jù)庫prod_source。
The database has a list of its own internal names for each platform supporting cross-platform data transport. You may need the exact name of the source or destination platform as a parameter to the?CONVERT?command. For example, you can obtain the platform name of the connected database as follows:
在V $ TRANSPORTABLE_PLATFORM中查詢源平臺的名稱。
數(shù)據(jù)庫具有支持跨平臺數(shù)據(jù)傳輸?shù)拿總€平臺的自己內(nèi)部名稱的列表。?您可能需要源或目標(biāo)平臺的確切名稱作為CONVERT命令的參數(shù)。?例如,可以如下獲取連接的數(shù)據(jù)庫的平臺名稱:
SELECT PLATFORM_NAME
FROM?? V$TRANSPORTABLE_PLATFORM?
WHERE? PLATFORM_ID =
??????? ( SELECT PLATFORM_ID
?????????????????? FROM?? V$DATABASE );
For this scenario, assume that the?PLATFORM_NAME?for the source host is?Solaris[tm] OE (64-bit).
將待傳輸?shù)谋砜臻g放置在只讀模式。
For example, enter the following SQL statements to place?finance?and?hr?in read-only mode:
ALTER TABLESPACE finance READ ONLY;
ALTER TABLESPACE hr READ ONLY;
In this example, the dump file is named?expdat.dmp.
在源主機使用數(shù)據(jù)泵導(dǎo)出一個dump文件
將導(dǎo)出轉(zhuǎn)儲文件和要傳輸?shù)臄?shù)據(jù)文件提供給目標(biāo)主機
You can use NFS to make the dump file and current database files (not copies) accessible. Alternatively, you can use an operating system utility to copy these files to the destination host.
In this example, you store the files in the?/tmp/transport_solaris/?directory of the destination host. You preserve the subdirectory structure from the original location of the files, that is, the data files are stored as:
- /tmp/transport_solaris/fin/fin01.dbf
- /tmp/transport_solaris/fin/fin02.dbf
- /tmp/transport_solaris/hr/hr01.dbf
- /tmp/transport_solaris/hr/hr02.dbf
% rman
RMAN> CONNECT TARGET SYS@prod_dest
執(zhí)行CONVERT DATAFILE命令將數(shù)據(jù)文件轉(zhuǎn)換為目標(biāo)主機的字節(jié)存儲順序。
In this example, you use?DB_FILE_NAME_CONVERT?to control the name and location of the converted data files. You also specify the?FROM?PLATFORM?clause.
RMAN> CONVERT DATAFILE
2>?? '/tmp/transport_solaris/fin/fin01.dbf',
3>?? '/tmp/transport_solaris/fin/fin02.dbf',
4>?? '/tmp/transport_solaris/hr/hr01.dbf',
5>?? '/tmp/transport_solaris/hr/hr02.dbf'
6>?? DB_FILE_NAME_CONVERT
7>???? '/tmp/transport_solaris/fin','/orahome/dbs/fin',
8>???? '/tmp/transport_solaris/hr','/orahome/dbs/hr'
9>?? FROM PLATFORM 'Solaris[tm] OE (64-bit)
The result is a set of converted data files in the?/orahome/dbs/?directory that are named as follows:
- /orahome/dbs/fin/fin01.dbf
- /orahome/dbs/fin/fin02.dbf
- /orahome/dbs/hr/hr01.dbf
- /orahome/dbs/hr/hr02.dbf
使用導(dǎo)入程序?qū)⒈砜臻g插入新數(shù)據(jù)庫。
將傳送的表空間置于只讀模式。
?
Checking the Database Before Cross-Platform Database Conversion(跨平臺數(shù)據(jù)庫轉(zhuǎn)換之前檢查數(shù)據(jù)庫)
As explained in?"Basic Concepts of Cross-Platform Data Transportation", you can use the RMAN?CONVERT DATABASE?command to automate the copying of an entire database from one platform to another.
你可以使用RMAN CONVERT DATABASE命令自動將整個數(shù)據(jù)庫從一個平臺復(fù)制到另一個平臺。
Before converting the database, see the list of?CONVERT DATABASE?command prerequisites described in?Oracle Database Backup and Recovery Reference.Confirm that you meet all these prerequisites before attempting the procedure in this section.
在轉(zhuǎn)換數(shù)據(jù)庫之前,請參閱Oracle數(shù)據(jù)庫備份和恢復(fù)參考中描述的CONVERT DATABASE命令先決條件列表。確認(rèn)在嘗試本節(jié)中的過程之前,滿足所有這些先決條件。
One prerequisite is that both the source and destination platform must share the same endian format. For example, you can transport a database from Microsoft Windows to Linux for x86 (both little-endian), or from HP-UX to AIX (both big-endian), but not from HP-UX to Linux for x86 (big-endian to little-endian).
一個先決條件是源平臺和目標(biāo)平臺必須共享相同的字節(jié)存儲順序。例如,你可以將數(shù)據(jù)庫從Microsoft Windows傳輸?shù)?/strong>Linux for x86(小端),或從HP-UX傳輸?shù)?/strong>AIX(大端),但不能從HP-UX到Linux for x86(大端到小端)。
Note:
If you cannot use the?CONVERT DATABASE?command because the platforms do not share endian formats, then you can create a database on a destination platform manually and transport needed tablespaces from the source database with cross-platform transportable tablespaces.
如果不能使用CONVERT DATABASE命令,因為平臺字節(jié)存儲序列不一致,那么你可以手動創(chuàng)建目標(biāo)平臺上的數(shù)據(jù)庫,并使用跨平臺的可移動表空間從源數(shù)據(jù)庫傳輸所需的表空間。
When you transport entire databases, note that certain files require RMAN conversion to ensure compatibility with the destination platform. Even though the endian formats for the source and destination platform are the same, these files cannot be simply copied from the source to the destination system. The following kinds of files require RMAN conversion:
當(dāng)傳輸整個數(shù)據(jù)庫時,請注意,某些文件需要進行RMAN轉(zhuǎn)換才能確保與目標(biāo)平臺的兼容性。即使源平臺和目標(biāo)平臺的字節(jié)存儲順序相同,這些文件也不能簡單地從源文件復(fù)制到目標(biāo)系統(tǒng)。以下類型的文件需要RMAN轉(zhuǎn)換:
- Any file containing undo segments
- Any file containing automatic segment space management (ASSM) segment headers that is being transported to or from the HP Tru64 platform
·?????????任何包含undo段的文件
·?????????任何包含自動段空間管理(ASSM)段頭的文件,這些段頭正在傳輸?shù)?/strong>HP Tru64平臺或從HP Tru64平臺傳輸
The?CONVERT DATABASE?command, by default, processes all data files in the database using RMAN conversion. The RMAN conversion copies the files from one location to another, even when it does not make any changes to the file. If you have other preferred means to copy those files that do not require RMAN conversion, you can use the?SKIP UNNECESSARY DATAFILES?option of the?CONVERT DATABASE?command. If you select this option, then the?CONVERT DATABASE?command only processes the kinds of files previously mentioned. All other files must be copied by the user from the source to the destination database.
CONVERT DATABASE命令默認(rèn)使用RMAN轉(zhuǎn)換來處理數(shù)據(jù)庫中的所有數(shù)據(jù)文件。即使文件沒有進行任何更改,RMAN轉(zhuǎn)換將文件從一個位置復(fù)制到另一個位置。如果有其他首選方法來復(fù)制不需要RMAN轉(zhuǎn)換的文件,則可以使用CONVERT DATABASE命令的SKIP UNNECESSARY DATAFILES選項。如果選擇此選項,則CONVERT DATABASE命令僅處理上述文件的種類。所有其他文件必須由用戶從源復(fù)制到目標(biāo)數(shù)據(jù)庫。
The files should be copied while the source database is open in read-only mode. Similarly, if the conversion is performed at the destination, all data files should be copied to the destination when the source database is open in read-only mode.
在源數(shù)據(jù)庫以只讀模式打開時,在復(fù)制文件。類似地,如果在目的地執(zhí)行轉(zhuǎn)換,則當(dāng)源數(shù)據(jù)庫以只讀模式打開時,所有數(shù)據(jù)文件都應(yīng)被復(fù)制到目標(biāo)。
To prepare for database conversion:
以SYSDBA的權(quán)限使用SQl*Plus連接到源數(shù)據(jù)庫
以只讀模式打開數(shù)據(jù)庫
ALTER DATABASE OPEN READ ONLY;
For example, enter the following SQL*Plus command:
SET SERVEROUTPUT ON
執(zhí)行DBMS_TDB.CHECK_DB函數(shù)
This check ensures that no conditions would prevent the transport of the database, such as incorrect compatibility settings, in-doubt or active transactions, or incompatible endian formats between the source platform and destination platform.
此檢查確保沒有條件會阻止數(shù)據(jù)庫的傳輸,例如不正確的兼容性設(shè)置,無效或活動事務(wù),或源平臺和目標(biāo)平臺之間不兼容的字節(jié)存儲順序。
You can call?CHECK_DB?without arguments to see if a condition at the source database prevents transport. You can also call this function with the arguments shown in?Table 27-1.
可以調(diào)用CHECK_DB而不用參數(shù)來查看源數(shù)據(jù)庫中的條件是否阻止傳輸。還可以使用表27-1所示的參數(shù)調(diào)用此函數(shù)。
Table 27-1 CHECK_DB Function Parameters
| Parameter | Description |
| target_platform_name | The name of the destination platform as it appears in the?V$DB_TRANSPORTABLE_PLATFORM?view. This parameter is optional, but is required when the?skip_option?parameter is used. If omitted, it is assumed that the destination platform is compatible with the source platform, and only the conditions not related to platform compatibility are tested. |
| skip_option | Specifies which, if any, parts of the database to skip when checking whether the database can be transported. Supported values (of type?NUMBER) are: <span "="">o????SKIP_NONE?(or?0), which checks all tablespaces <span "="">o????SKIP_OFFLINE?(or?2), which skips checking data files in offline tablespaces <span "="">o????SKIP_READONLY?(or?3), which skips checking data files in read-only tablespaces |
?
Example 27-1?illustrates executing?CHECK_DB?on a 32-bit Linux platform for transporting a database to 32-bit Windows, skipping read-only tablespaces.
驗證在32位Linux平臺上執(zhí)行CHECK_DB,用于將數(shù)據(jù)庫傳輸?shù)?/strong>32位Windows,并跳過只讀表空間。
Example 27-1 Executing DBMS_TDB.CHECK_DB
DECLARE
? db_ready BOOLEAN;
BEGIN
? db_ready :=
?????? DBMS_TDB.CHECK_DB('Microsoft Windows IA (32-bit)',DBMS_TDB.SKIP_READONLY);
END;
/
?
PL/SQL procedure successfully completed.
If no warnings appear, or if?DBMS_TDB.CHECK_DB?returns?TRUE, then you can transport the database. Proceed to Step 6.
如果沒有出現(xiàn)警告,或DBMS_TDB.CHECK_DB返回TRUE,則可以傳輸數(shù)據(jù)庫。?繼續(xù)步驟6。
If warnings appear, or if?DBMS_TDB.CHECK_DB?returns?FALSE, then you cannot currently transport the database. Proceed to Step 5.
如果出現(xiàn)警告,或DBMS_TDB.CHECK_DB返回FALSE,則無法傳輸數(shù)據(jù)庫。?繼續(xù)步驟5。
檢查輸出以了解為什么無法傳輸數(shù)據(jù)庫,如果可能的話可以解決問題,然后返回到步驟4.有關(guān)條件的信息,請參閱DBMS_TDB文檔。
執(zhí)行DBMS_TDB.CHECK_EXTERNAL函數(shù)來識別任何外部表,目錄或BFILE。?RMAN無法自動傳輸這些文件,因此你必須手動復(fù)制文件并重新創(chuàng)建數(shù)據(jù)庫目錄。
?
Example 27-2?shows how to call the?DBMS_TDB.CHECK_EXTERNAL?function.
如何調(diào)用DBMS_TDB.CHECK_EXTERNAL函數(shù)
Example 27-2 Executing DBMS_TDB.CHECK_EXTERNAL
DECLARE
???? external BOOLEAN;
BEGIN
??? /* value of external is ignored, but with SERVEROUTPUT set to ON
???? * dbms_tdb.check_external displays report of external objects
???? * on console */
??? external := DBMS_TDB.CHECK_EXTERNAL;
END;
/
If no external objects exist, then the procedure completes with no output. If external objects exist, however, then the output is similar to the following:
如果沒有外部對象存在,那么該過程完成,沒有輸出。?但是,如果存在外部對象,則輸出類似于以下內(nèi)容:
The following external tables exist in the database:
SH.SALES_TRANSACTIONS_EXT
The following directories exist in the database:
SYS.DATA_PUMP_DIR, SYS.MEDIA_DIR, SYS.DATA_FILE_DIR, SYS.LOG_FILE_DIR
The following BFILEs exist in the database:
PM.PRINT_MEDIA
?
PL/SQL procedure successfully completed.
Converting Data Files on the Source Host When Transporting a Database(在傳輸數(shù)據(jù)庫時轉(zhuǎn)換源主機上的數(shù)據(jù)文件)
When you transport entire databases, certain types of blocks, such as blocks in undo segments, must be reformatted to ensure compatibility with the destination platform. Even though the endian formats for the source and destination platform are the same, the data files for a transportable database must undergo a conversion process. You cannot simply copy data files from one platform to another as you can when transporting tablespaces.
當(dāng)在傳輸整個數(shù)據(jù)庫時,必須重新格式化某些類型的塊(例如undo段中的塊),以確保與目標(biāo)平臺的兼容性。盡管源平臺和目標(biāo)平臺的字節(jié)存儲順序相同,但可傳輸數(shù)據(jù)庫的數(shù)據(jù)文件必須經(jīng)過轉(zhuǎn)換過程。你不可以在傳輸表空間時簡單地將數(shù)據(jù)文件從一個平臺復(fù)制到另一個平臺。
Data files with undo information and those from the HP Tru64 platform must be converted. By default, all data files are converted when the?CONVERT DATABASEcommand is executed. If, however,?SKIP UNNECESSARY DATAFILES?is used in the?CONVERT DATABASE?command, then the data files with undo segments and those from the HP Tru64 platform are converted. The data files without undo segments can be copied to the new database using FTP, an operating system copy command, or some other mechanism.
必須轉(zhuǎn)換具有undo信息和HP Tru64平臺的數(shù)據(jù)文件。默認(rèn)情況下,執(zhí)行CONVERT DATABASE命令時,將轉(zhuǎn)換所有數(shù)據(jù)文件。但是,如果在CONVERT DATABASE命令中使用SKIP UNNESSESSARY DATAFILES參數(shù),則會轉(zhuǎn)換具有undo段和HP Tru64平臺的數(shù)據(jù)文件。沒有undo段的數(shù)據(jù)文件可以使用FTP,操作系統(tǒng)復(fù)制命令或其他機制復(fù)制到新數(shù)據(jù)庫。
This section assumes that you have already met all of the?CONVERT DATABASE?prerequisites and followed the steps in?"Checking the Database Before Cross-Platform Database Conversion". The goal of this procedure is to convert the format of data files on the source host as part of a cross-platform database transport.
假設(shè)你已經(jīng)滿足了所有的CONVERT DATABASE先決條件,并按照“"Checking the Database Before Cross-Platform Database Conversion”中的步驟。該過程的目標(biāo)是在源主機上轉(zhuǎn)換數(shù)據(jù)文件的格式,作為跨平臺數(shù)據(jù)庫傳輸?shù)囊徊糠帧?/strong>
Assume that you want to convert a database running on Solaris to a database that runs on Windows.
假設(shè)要將在Solaris上運行的數(shù)據(jù)庫轉(zhuǎn)換為在Windows上運行的數(shù)據(jù)庫。
To convert the database on the source platform:
ALTER DATABASE OPEN READ ONLY;
% rman
RMAN> CONNECT TARGET SYS@source_db
Example 27-3?shows a?CONVERT DATABASE?command (sample output included). The?TRANSPORT SCRIPT?parameter specifies the location of the generated SQL script that you can use to create the new database. The?TO PLATFORM?parameter indicates the platform of the destination database. TheDB_FILE_NAME_CONVERT?parameter specifies the naming scheme for the generated data files.
例27-3顯示CONVERT DATABASE命令(包括樣本輸出)。?TRANSPORT SCRIPT參數(shù)指定可用于創(chuàng)建新數(shù)據(jù)庫的生成的SQL腳本的位置。?TO PLATFORM參數(shù)指示目標(biāo)數(shù)據(jù)庫的平臺。?DB_FILE_NAME_CONVERT參數(shù)指定生成的數(shù)據(jù)文件的命名方案。
Example 27-3 Converting a Database on the Source Host
RMAN> CONVERT DATABASE
2>?? NEW DATABASE 'newdb'
3>?? TRANSPORT SCRIPT '/tmp/convertdb/transportscript.sql'
4>?? TO PLATFORM 'Microsoft Windows IA (32-bit)'
5>?? DB_FILE_NAME_CONVERT '/disk1/oracle/dbs' '/tmp/convertdb';
?
Starting convert at 25-NOV-06
using channel ORA_DISK_1
?
External table SH.SALES_TRANSACTIONS_EXT found in the database
?
Directory SYS.DATA_PUMP_DIR found in the database
Directory SYS.MEDIA_DIR found in the database
Directory SYS.DATA_FILE_DIR found in the database
Directory SYS.LOG_FILE_DIR found in the database
?
BFILE PM.PRINT_MEDIA found in the database
?
User SYS with SYSDBA and SYSOPER privilege found in password file
User OPER with SYSDBA privilege found in password file
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00001 name=/disk1/oracle/dbs/tbs_01.f
converted datafile=/tmp/convertdb/tbs_01.f
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00002 name=/disk1/oracle/dbs/tbs_ax1.f
converted datafile=/tmp/convertdb/tbs_ax1.f
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:03
.
.
.
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00016 name=/disk1/oracle/dbs/tbs_52.f
converted datafile=/tmp/convertdb/tbs_52.f
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Run?SQL script /tmp/convertdb/transportscript.sql?on the destination platform
? to create database
Edit?init.ora file init_00gb3vfv_1_0.ora.?This PFILE will be used to
? create the database on the destination platform
To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on
? the destination platform
To change the internal database identifier, use DBNEWID Utility
Finished backup at 25-NOV-06
CONVERT DATABASE完成后,可以以讀寫的方式打開源數(shù)據(jù)庫。
將CONVERT DATABASE生成的數(shù)據(jù)文件移動到目標(biāo)主機上所需的位置。
In?Example 27-3, the command creates the files in the?/tmp/convertdb/?directory on the source host. Move these files to the directory on the destination host that will contain the destination database files.
在例27-3中,該命令將在源主機上的/ tmp / convertdb /目錄中創(chuàng)建文件。?將這些文件移動到將包含目標(biāo)數(shù)據(jù)庫文件的目標(biāo)主機上的目錄。
如果數(shù)據(jù)文件的路徑在目標(biāo)主機上不同,則編輯傳輸腳本以引用新的數(shù)據(jù)文件位置。
如有必要,請編輯初始化參數(shù)文件以更改目標(biāo)數(shù)據(jù)庫的任何設(shè)置。
You should edit several entries at the top of the initialization parameter file when the database is moved to the destination platform. For example, the initialization parameter file may look as follows:
當(dāng)數(shù)據(jù)庫移動到目標(biāo)平臺時,你應(yīng)該編輯初始化參數(shù)文件頂部的多個條目。?例如,初始化參數(shù)文件可能如下所示:
# Please change the values of the following parameters:
control_files??????????? = "/tmp/convertdb/cf_D-NEWDBT_id-1778429277_00gb9u2s"
db_recovery_file_dest??? = "/tmp/convertdb/orcva"
db_recovery_file_dest_size= 10737418240
instance_name??????????? = "NEWDBT"
service_names?? ?????????= "NEWDBT.example.com"
plsql_native_library_dir = "/tmp/convertdb/plsqlnld1"
db_name????????????????? = "NEWDBT"
如有必要,請編輯傳輸腳本以使用轉(zhuǎn)換后的數(shù)據(jù)文件的新名稱。
In?Example 27-3, the transport script is named?/tmp/convertdb/transportscript.sql. You run this script on the?destination?host to create the database. Thus, you must edit this script with the correct names for the data files.
在例27-3中,傳輸腳本命名為/tmp/convertdb/transportscript.sql。?您可以在目標(biāo)主機上運行此腳本來創(chuàng)建數(shù)據(jù)庫。?因此,您必須使用數(shù)據(jù)文件的正確名稱編輯此腳本。
在目標(biāo)主機上,啟動SQL * Plus,并使用操作系統(tǒng)身份驗證以SYSDBA連接到目標(biāo)數(shù)據(jù)庫實例。
For example, connect as follows:
SQL> CONNECT / AS SYSDBA
If you choose not to use operating system authentication, then you must first configure Oracle Net files, create a?password file, and start the listener. You can then connect to the instance with a net service name.
如果你選擇不使用操作系統(tǒng)身份驗證,則必須首先配置Oracle Net文件,創(chuàng)建密碼文件,然后啟動偵聽器。?然后,您可以使用網(wǎng)絡(luò)服務(wù)名稱連接到實例。
在SQL * Plus中執(zhí)行傳輸腳本,以在目標(biāo)主機上創(chuàng)建新的數(shù)據(jù)庫。
SQL> @transportscript
When the transport script finishes, the creation of the new database is complete.
傳輸腳本完成后,新數(shù)據(jù)庫的創(chuàng)建就完成了
?
Converting Data Files on the Destination Host When Transporting a Database(在傳輸數(shù)據(jù)庫時轉(zhuǎn)換目標(biāo)主機上的數(shù)據(jù)文件)
This section assumes that you have already met all of the?CONVERT DATABASE?command prerequisites and followed the steps in?"Checking the Database Before Cross-Platform Database Conversion". The goal of this procedure is to convert the format of data files on the destination host as part of a cross-platform database transport.
假設(shè)你已經(jīng)滿足了所有CONVERT DATABASE命令的先決條件,并按照“"Checking the Database Before Cross-Platform Database Conversion”中的步驟進行操作。?此過程的目標(biāo)是在目標(biāo)主機上轉(zhuǎn)換數(shù)據(jù)文件的格式,作為跨平臺數(shù)據(jù)庫傳輸?shù)囊徊糠帧?/strong>
Perform the data file conversion in the following phases:
在以下階段執(zhí)行數(shù)據(jù)文件轉(zhuǎn)換:
在源主機上執(zhí)行初步的數(shù)據(jù)文件轉(zhuǎn)換步驟
轉(zhuǎn)換目標(biāo)主機上的數(shù)據(jù)文件
Performing Preliminary Data File Conversion Steps on the Source Host
In this procedure, you execute the?CONVERT DATABASE?command on the source host. This command generates an initialization parameter file and scripts that you can edit for use on the destination host. You also copy the unconverted data files from the source host to the destination host.
在此過程中,你可以在源主機上執(zhí)行CONVERT DATABASE命令。?此命令生成一個初始化參數(shù)文件和腳本,你可以編輯該腳本以在目標(biāo)主機上使用。你還將未轉(zhuǎn)換的數(shù)據(jù)文件從源主機復(fù)制到目標(biāo)主機。
To perform preliminary data file conversion steps on the source host:
確保數(shù)據(jù)庫是以只讀方式打開
For example, enter the following commands:
% rman
RMAN> CONNECT TARGET SYS@source_db
Example 27-4?shows a sample?CONVERT DATABASE?command (sample output included). The?ON DESTINATION PLATFORM?parameter specifies that any?CONVERTcommands required for data files should be performed on the destination platform rather than the source platform. The?FORMAT?parameter specifies the naming scheme for the generated files.
示例27-4顯示了一個示例CONVERT DATABASE命令(包括樣本輸出)。?ON DESTINATION PLATFORM參數(shù)指定在目標(biāo)平臺而不是源平臺上執(zhí)行數(shù)據(jù)文件所需的任何CONVERT命令。?FORMAT參數(shù)指定生成的文件的命名方案。
Example 27-4 Executing CONVERT DATABASE ON DESTINATION PLATFORM
RMAN> CONVERT DATABASE
2>?? ON DESTINATION PLATFORM
3>?? CONVERT SCRIPT '/tmp/convertdb/convertscript-target'
4>?? TRANSPORT SCRIPT '/tmp/convertdb/transportscript-target'
5>?? NEW DATABASE 'newdbt'
6>?? FORMAT '/tmp/convertdb/%U';
?
Starting convert at 28-JAN-05
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=39 devtype=DISK
?
External table SH.SALES_TRANSACTIONS_EXT found in the database
?
Directory SYS.DATA_PUMP_DIR found in the database
Directory SYS.MEDIA_DIR found in the database
Directory SYS.DATA_FILE_DIR found in the database
Directory SYS.LOG_FILE_DIR found in the database
?
BFILE PM.PRINT_MEDIA found in the database
?
User SYS with SYSDBA and SYSOPER privilege found in password file
User OPER with SYSDBA privilege found in password file
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00001 name=/disk1/oracle/dbs/tbs_01.f
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00002 name=/disk1/oracle/dbs/tbs_ax1.f
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00017 name=/disk1/oracle/dbs/tbs_03.f
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
.
.
.
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00015 name=/disk1/oracle/dbs/tbs_51.f
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting to check datafiles
input datafile fno=00016 name=/disk1/oracle/dbs/tbs_52.f
channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
Run SQL script /tmp/convertdb/transportscript-target on the destination platform to create database
Edit init.ora file /tmp/convertdb/init_00gb9u2s_1_0.ora. This PFILE will be used to create the database on the destination platform
Run RMAN script /tmp/convertdb/convertscript-target on destination platform to convert datafiles
To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on the destination platform
To change the internal database identifier, use DBNEWID Utility
Finished backup at 28-JAN-05
The command in?Example 27-4?creates a transport script, an initialization parameter file for the new database, and a convert script containing RMANCONVERT DATAFILE?commands for each data file being converted.
示例27-4中的命令創(chuàng)建一個傳輸腳本,一個用于新數(shù)據(jù)庫的初始化參數(shù)文件,以及一個轉(zhuǎn)換腳本,其中包含要轉(zhuǎn)換的每個數(shù)據(jù)文件的RMANCONVERT DATAFILE命令。
Note:
CONVERT?DATABASE?ON?DESTINATION?PLATFORM?does?not?produce converted data file copies. The command only creates scripts.
CONVERT DATABASE ON DESTINATION PLATFORM不會生成轉(zhuǎn)換的數(shù)據(jù)文件副本。?該命令僅創(chuàng)建腳本。
使用操作系統(tǒng)實用程序?qū)⒁韵挛募?fù)制到目標(biāo)主機上的臨時位置:
- The data files to be converted(要轉(zhuǎn)換的數(shù)據(jù)文件)
- The convert script(轉(zhuǎn)換腳本)
- The transport script(傳輸腳本)
- The initialization file for the destination database(目標(biāo)數(shù)據(jù)庫的初始化文件)
使源數(shù)據(jù)庫讀/寫。
Converting Data Files on the Destination Host
This section explains how to use the script created in the previous section to convert the data files on the destination host.
本節(jié)介紹如何使用上一節(jié)中創(chuàng)建的腳本來轉(zhuǎn)換目標(biāo)主機上的數(shù)據(jù)文件。
The convert script created in the previous phase uses the original data file names of the source database files. The?FORMAT?parameter specifies the name that was generated with the?FORMAT?or?DB_FILE_NAME_CONVERT?parameter of the?CONVERT DATABASE?command.
在前一階段創(chuàng)建的轉(zhuǎn)換腳本使用源數(shù)據(jù)庫文件的原始數(shù)據(jù)文件名。?FORMAT參數(shù)指定使用CONVERT DATABASE命令的FORMAT或DB_FILE_NAME_CONVERT參數(shù)生成的名稱。
If the data files of the source database are accessible from the destination host with the same path names, then so long as the source database is read-only you can run the convert script on the destination host without any changes. For example, if the source and destination hosts both use NFS to mount a disk containing the source data files, and if the mount point for both hosts is?/fs1/dbs/, then no editing is needed.
如果源數(shù)據(jù)庫的數(shù)據(jù)文件可以從具有相同路徑名稱的目標(biāo)主機訪問,那么只要源數(shù)據(jù)庫是只讀的,你可以在目標(biāo)主機上運行轉(zhuǎn)換腳本,而不進行任何更改。?例如,如果源和目標(biāo)主機都使用NFS裝載包含源數(shù)據(jù)文件的磁盤,并且如果兩個主機的安裝點為/ fs1 / dbs /,則不需要編輯。
To convert the data files on the destination host:
If necessary, edit the convert script.(如有必要,編輯轉(zhuǎn)換腳本)
In the script, one?CONVERT?DATAFILE?command exists for each data file to be converted. The convert script should indicate the current temporary file names of the unconverted data files and the output file names of the converted data files. A typical convert script looks as follows:
在腳本中,每個要轉(zhuǎn)換的數(shù)據(jù)文件都有一個CONVERT DATAFILE命令。?轉(zhuǎn)換腳本應(yīng)該指示未轉(zhuǎn)換的數(shù)據(jù)文件的當(dāng)前臨時文件名和轉(zhuǎn)換的數(shù)據(jù)文件的輸出文件名。?一個典型的轉(zhuǎn)換腳本如下所示:
RUN
{
?CONVERT
?FROM PLATFORM 'Linux IA (32-bit)'
?PARALLELISM 10
? DATAFILE '/disk1/oracle/dbs/tbs_01.f'
? FORMAT
?'/tmp/convertdb/data_D-TV_I-1778429277_TS-SYSTEM_FNO-1_7qgb9u2s';
?
?DATAFILE '/disk1/oracle/dbs/tbs_ax1.f'
?FORMAT
?'/tmp/convertdb/data_D-TV_I-1778429277_TS-SYSAUX_FNO-2_7rgb9u2s';
?
?DATAFILE '/disk1/oracle/dbs/tbs_03.f'
?FORMAT
?'/tmp/convertdb/data_D-TV_I-1778429277_TS-SYSTEM_FNO-17_7sgb9u2s';
?
?DATAFILE '/disk1/oracle/dbs/tbs_51.f'
?FORMAT
?'/tmp/convertdb/data_D-TV_I-1778429277_TS-TBS_5_FNO-15_8egb9u2u';
?
?DATAFILE '/disk1/oracle/dbs/tbs_52.f'
? FORMAT
?'/tmp/convertdb/data_D-TV_I-1778429277_TS-TBS_5_FNO-16_8fgb9u2u';
}
Edit each?DATAFILE?command in the convert script to specify the temporary location of each data file as input. Also, edit the?FORMAT?parameter of each command to specify the desired final location of the data files of the transported database.
在convert腳本中編輯每個DATAFILE命令,以指定每個數(shù)據(jù)文件的臨時位置作為輸入。?此外,編輯每個命令的FORMAT參數(shù)以指定傳輸數(shù)據(jù)庫的數(shù)據(jù)文件的所需最終位置。
如有必要,編輯目標(biāo)主機上的初始化參數(shù)文件以更改目標(biāo)數(shù)據(jù)庫的設(shè)置。
You should edit several entries at the top of the initialization parameter file before moving the database to the destination platform. For example, the initialization parameter file may look as follows:
在將數(shù)據(jù)庫移動到目標(biāo)平臺之前,應(yīng)編輯初始化參數(shù)文件頂部的多個條目。?例如,初始化參數(shù)文件可能如下所示:
# Please change the values of the following parameters:
control_files??????????? = "/tmp/convertdb/cf_D-NEWDBT_id-1778429277_00gb9u2s"
db_recovery_file_dest??? = "/tmp/convertdb/orcva"
db_recovery_file_dest_size= 10737418240
instance_name??????????? = "NEWDBT"
service_names??????????? = "NEWDBT.example.com"
plsql_native_library_dir = "/tmp/convertdb/plsqlnld1"
db_name????????????????? = "NEWDBT"
在目標(biāo)主機上,使用SQL * Plus以NOMOUNT模式啟動數(shù)據(jù)庫實例。
Specify the initialization parameter file that you copied in the preceding step. For example, enter the following command:
指定在上一步中復(fù)制的初始化參數(shù)文件。?例如,輸入以下命令:
SQL> STARTUP NOMOUNT PFILE='/tmp/init_convertdb_00i2gj63_1_0.ora'
% rman
RMAN> CONNECT TARGET SYS@prod_dest
RMAN> @/tmp/convertdb/convertscript-target
關(guān)閉數(shù)據(jù)庫實例。
This step is necessary because the transport script that must execute already includes a?STARTUP NOMOUNT?command.
此步驟是必需的,因為必須執(zhí)行的傳輸腳本已經(jīng)包含STARTUP NOMOUNT命令。
如有必要,編輯傳輸腳本以使用轉(zhuǎn)換后的數(shù)據(jù)文件的新名稱。
In?Example 27-3, the transport script is?/tmp/convertdb/transportscript.sql. You run this script on the destination host to create the database. Thus, you must edit this script with the correct names for the data files.
在例27-3中,傳輸腳本為/tmp/convertdb/transportscript.sql。?您可以在目標(biāo)主機上運行此腳本來創(chuàng)建數(shù)據(jù)庫。?因此,您必須使用數(shù)據(jù)文件的正確名稱編輯此腳本。
在SQL * Plus中執(zhí)行傳輸腳本。
For example, create the new database on the destination host as follows:
SQL> @/tmp/convertdb/transportscript
When the transport script completes, the destination database is created.
傳輸腳本完成后,將創(chuàng)建目標(biāo)數(shù)據(jù)庫
轉(zhuǎn)載于:https://www.cnblogs.com/zfox2017/p/8562527.html
總結(jié)
以上是生活随笔為你收集整理的转://RMAN跨平台可传输表空间和数据库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 发送附件时,防止文件名中的中文字符变成乱
- 下一篇: MySQL服务读取参数文件my.cnf的