用于检查外部表和Bfile
SQL>SET SERVEROUTPUT ON
DECLARE
external BOOLEAN;
BEGIN
external := DBMS_TDB.CHECK_EXTERNAL;
END;
/
If you call DBMS_TDB.CHECK_DB and no messages are displayed indicating conditions preventing transport
before the PL/SQL procedure successfully completed message, then your database is ready for transport.
如果没有信息返回(在PL/SQL procedure successfully completed.之前)。说明数据库已经准备好了跨平台迁移。
2、在源数据库上转换数据库
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE OPEN READ ONLY;
SQL> select * from v$db_transportable_platform;
PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- ------------------------------------------------------------ --------------
7 Microsoft Windows IA (32-bit) Little
10 Linux IA (32-bit) Little
5 HP Tru64 UNIX Little
11 Linux IA (64-bit) Little
15 HP Open VMS Little
8 Microsoft Windows IA (64-bit) Little
13 Linux 64-bit for AMD Little
12 Microsoft Windows 64-bit for AMD Little
17 Solaris Operating System (x86) Little
9 rows selected.
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
db_ready BOOLEAN;
BEGIN
db_ready := DBMS_TDB.CHECK_DB('Microsoft Windows IA (32-bit)');
END;
/
PL/SQL procedure successfully completed.
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
external BOOLEAN;
BEGIN
external := DBMS_TDB.CHECK_EXTERNAL;
END;
/
The following directories exist in the database:
SYS.DB_FILES_DIRECTORY, SYS.DATA_PUMP_DIR, SYS.WORK_DIR, SYS.ADMIN_DIR
PL/SQL procedure successfully completed.
3、备份源库,并copy所有的pfile、数据文件、scrīpt到目标库
rman >run {
CONVERT DATABASE NEW DATABASE 'sztech'
transport script '/home/oracle/oradata/transportscript'
to platform 'Microsoft Windows IA (32-bit)'
db_file_name_convert '/oracle/app/oracle/oradata/sztech1' '/home/oracle/oradata/';
}
copy /home/oracle/oradata/目录下的数据文件、scrīpt到目标库
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Run SQL script /home/oracle/oradata/transportscript on the target platform to create database
Edit init.ora file /u01/app/oracle/product/11.2.0/db_1/dbs/init_00lh4ff9_1_0.ora.
This PFILE will be used to create the database on the target platform
To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on the target platform
To change the internal database identifier, use DBNEWID Utility
Finished backup at 25-JUN-10
创建基础环境
首先创建相关目录:
mkdir d:\oracle\product\11.2.0\admin\sztech\adump
mkdir d:\oracle\product\11.2.0\admin\sztech\bdump
mkdir d:\oracle\product\11.2.0\admin\sztech\cdump
mkdir d:\oracle\product\11.2.0\admin\sztech\dpdump
mkdir d:\oracle\product\11.2.0\admin\sztech\pfile
mkdir d:\oracle\product\11.2.0\admin\sztech\udump
创建Windows数据库服务:
d:\oracle\>oradim -new -sid sztech
实例已创建。
4、在目标库上恢复数据库、并升级数据库
在目标库上运行脚本transportscrīpt (需要根据需要修改该脚本文件,如controlfile的路径)
SQL>@transportscrīpt
该脚本包含步骤如下:
恢复pfile,修改pfile中相应的路径位置。启动数据库
STARTUP NOMOUNT PFILE='D:\oracle\product\11.2.0\db_1\database\initsztech.ora'
CREATE CONTROLFILE REUSE SET DATABASE "sztech" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 50M,
GROUP 2 SIZE 50M,
GROUP 3 SIZE 50M
DATAFILE
'D:\oracle\product\11.2.0\oradata\sztech\system01.dbf',
'D:\oracle\product\11.2.0\oradata\sztech\undotbs01.dbf',
'D:\oracle\product\11.2.0\oradata\sztech\sysaux01.dbf',
'D:\oracle\product\11.2.0\oradata\sztech\users01.dbf',
'D:\oracle\product\11.2.0\oradata\sztech\example01.dbf',
'D:\oracle\product\11.2.0\oradata\sztech\tbsaddm.dbf',
'D:\oracle\product\11.2.0\oradata\sztech\tbsaddm2.dbf',
'D:\oracle\product\11.2.0\oradata\sztech\tsp_ts.dbf'
CHARACTER SET ZHS16GBK
;
alter database open resetlogs; ---不需要升级就可以直接resetlog打开数据库
ALTER TABLESPACE TEMP ADD TEMPFILE 'D:\oracle\product\11.2.0\oradata\sztech\temp01.dbf'
SIZE 26214400 AUTOEXTEND ON NEXT 5242880 MAXSIZE 104857600 ;
附:
D:\oracle\product\11.2.0\db_1\database\initsztech.ora 内容:
# Please change the values of the following parameters:
control_files = "D:\oracle\product\11.2.0\oradata\sztech/control01_ctl"
db_recovery_file_dest = "D:\oracle\product\11.2.0\flash_recovery_area"
db_recovery_file_dest_size= 4244635648
background_dump_dest = "D:\oracle\product\11.2.0\admin\sztech\bdump"
user_dump_dest = "D:\oracle\product\11.2.0\admin\sztech\udump"
core_dump_dest = "D:\oracle\product\11.2.0\admin\sztech\cdump"
audit_file_dest = "D:\oracle\product\11.2.0\admin\sztech\adump"
db_name = "sztech"
# Please review the values of the following parameters:
__shared_pool_size = 104857600
__large_pool_size = 4194304
__java_pool_size = 4194304
__streams_pool_size = 0
__db_cache_size = 197132288
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=orclXDB)"