oracle 10g数据库跨平台迁移(参考循序渐进oracle)
2013-03-09 11:51
537 查看
源平台:linux 5
目标平台:windos xp
1.确认平台及版本
SQL> select platform_name,endian_format from v$transportable_platform;
PLATFORM_NAME ENDIAN_FORMAT
----------------------------------------------------------------------------------------------------- --------------
Solaris[tm] OE (32-bit) Big
Solaris[tm] OE (64-bit) Big
Microsoft Windows IA (32-bit) Little
Linux IA (32-bit) Little
AIX-Based Systems (64-bit) Big
HP-UX (64-bit) Big
HP Tru64 UNIX Little
HP-UX IA (64-bit) Big
Linux IA (64-bit) Little
HP Open VMS Little
Microsoft Windows IA (64-bit) Little
IBM zSeries Based Linux Big
Linux 64-bit for AMD Little
Apple Mac OS Big
Microsoft Windows 64-bit for AMD Little
Solaris Operating System (x86) Little
IBM Power Based Linux Big
17 rows selected.
可知,要迁移的平台是同自序的
查看数据库版本
在源平台上
SQL> select * from v$version where rownum<2;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
在目标平台上执行:
SQL> select * from v$version where rownum<2;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
数据库版本完全一致
2.确认迁移是否支持
先让数据库运行在只读模式下
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 75499764 bytes
Database Buffers 88080384 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database open read only;
Database altered.
进行检测
SQL> set serveroutput on
SQL> declare
2 db_ready boolean;
3 begin
4 db_ready:=dbms_tdb.check_db('Microsoft Windows IA (32-bit)');
5 end;
6 /
PL/SQL procedure successfully completed.
如果没有提示相关的警告信息,说明数据库支持跨平台迁移
3.检查外部对象
SQL> set serveroutput on
SQL> declare
2 exteranl boolean;
3 begin
4 exteranl:=dbms_tdb.check_external;
5 end;
6 /
The following directories exist in the database:
SYS.WORK_DIR, SYS.ADMIN_DIR, SYS.DATA_PUMP_DIR
PL/SQL procedure successfully completed.
识别外部表,directories或bfiles,这些对象所指向的外部数据不能被rman自动迁移
4.使用rman进行跨平台文件迁移
[oracle@hxy ~]$ rlwrap rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sat Mar 9 10:20:49 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1336191018)
RMAN> convert database new database 'baozhu'
2> transport script '/opt/oracle/oradata/transport/tarnsport.sql'
3> to platform 'Microsoft Windows IA (32-bit)'
4> db_file_name_convert '/opt/oracle/oradata/orcl' '/opt/oracle/oradata/transport';
Starting convert at 09-MAR-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 devtype=DISK
Directory SYS.WORK_DIR found in the database
Directory SYS.ADMIN_DIR found in the database
Directory SYS.DATA_PUMP_DIR found in the database
User SYS with SYSDBA and SYSOPER privilege found in password file
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00001 name=/opt/oracle/oradata/orcl/system01.dbf
converted datafile=/opt/oracle/oradata/transport/system01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00003 name=/opt/oracle/oradata/orcl/sysaux01.dbf
converted datafile=/opt/oracle/oradata/transport/sysaux01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00002 name=/opt/oracle/oradata/orcl/undotbs01.dbf
converted datafile=/opt/oracle/oradata/transport/undotbs01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00005 name=/opt/oracle/oradata/orcl/hxy01.dbf
converted datafile=/opt/oracle/oradata/transport/hxy01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00004 name=/opt/oracle/oradata/orcl/users01.dbf
converted datafile=/opt/oracle/oradata/transport/users01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Run SQL script /opt/oracle/oradata/transport/tarnsport.sql on the target platform to create database
Edit init.ora file /opt/oracle/product/10.2.0/dbs/init_00o436rg_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 09-MAR-13
RMAN>
5.转移文件到目标平台
为了快速传输,我们压缩tranport文件夹
[oracle@hxy oradata]$ tar -czvf transport.tar.gz transport/
transport/
transport/tarnsport.sql
transport/system01.dbf
transport/undotbs01.dbf
transport/sysaux01.dbf
transport/hxy01.dbf
transport/users01.dbf
[oracle@hxy oradata]$ ll
total 141944
drwxr-x--- 2 oracle oinstall 4096 Mar 8 11:16 orcl
drwxr-xr-x 2 oracle oinstall 4096 Mar 9 10:35 transport
-rw-r--r-- 1 oracle oinstall 145194742 Mar 9 10:39 transport.tar.gz
把数据文件传输到目标平台,可以通过发ftp方式(把压缩的包移动到目标平台并解压)
我的解压路径为:D:\oracle\product\10.2.0\oradata\baozhu(把解压出来的数据文件拷贝到此目录下)
数据文件,控制文件,日志文件都放在这个目录下面
6.创建基础环境
首先创建相关目录
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\adump
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\bdump
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\cdump
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\dpdump
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\pfile
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\udump
创建windows相关服务
C:\Documents and Settings\haoxiaoyu>oradim -new -sid baozhu
实例已创建。
修改参数文件(来自由rman自动生成的参数文件)
该参数文件内容如下:
分为3部分(第一部分红色为修改的部分)
# Please change the values of the following parameters:
control_files = "/opt/oracle/product/10.2.0/dbs/cf_D-BAOZHU_id-1336191018_00o436rg"
db_recovery_file_dest = "/opt/oracle/product/10.2.0/dbs/flash_recovery_area"
db_recovery_file_dest_size= 2147483648
background_dump_dest = "/opt/oracle/product/10.2.0/dbs/bdump"
user_dump_dest = "/opt/oracle/product/10.2.0/dbs/udump"
core_dump_dest = "/opt/oracle/product/10.2.0/dbs/cdump"
audit_file_dest = "/opt/oracle/product/10.2.0/dbs/adump"
db_name = "BAOZHU"
# Please review the values of the following parameters:
__shared_pool_size = 67108864
__large_pool_size = 4194304
__java_pool_size = 4194304
__streams_pool_size = 0
__db_cache_size = 88080384
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=orclXDB)"
# The values of the following parameters are from source database:
processes = 150
sga_target = 167772160
db_block_size = 8192
compatible = "10.2.0.1.0"
db_file_multiblock_read_count= 16
undo_management = "AUTO"
undo_tablespace = "UNDOTBS1"
job_queue_processes = 10
open_cursors = 300
pga_aggregate_target = 16777216
修改内容如下;
#control_files = "/opt/oracle/product/10.2.0/dbs/cf_D-BAOZHU_id-1336191018_00o436rg"
db_recovery_file_dest = "D:\oracle\product\10.2.0\flash_recovery_area"
db_recovery_file_dest_size= 2147483648
background_dump_dest = "D:\oracle\product\10.2.0\admin\baozhu\bdump"
user_dump_dest = "D:\oracle\product\10.2.0\admin\baozhu\udump"
core_dump_dest = "D:\oracle\product\10.2.0\admin\baozhu\cdump"
audit_file_dest = "D:\oracle\product\10.2.0\admin\baozhu\adump"
db_name = "BAOZHU"
重命名为:initbaozhu.ora,放在D:\oracle\product\10.2.0\db_1\database下
如采用OMF管理,暂时注释控制路径
7,迁移步骤
C:\Documents and Settings\haoxiaoyu>set ORACLE_SID=baozhu
C:\Documents and Settings\haoxiaoyu>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 3月 9 11:09:37 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
已连接到空闲例程。
SQL> startup nomount;
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1247876 bytes
Variable Size 62915964 bytes
Database Buffers 96468992 bytes
Redo Buffers 7139328 bytes
SQL>
接下来创建控制文件(可参看我们使用rman转换时生成的脚本文件transport.sql文件进行修改)
CREATE CONTROLFILE REUSE SET DATABASE "BAOZHU" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 10M,
GROUP 2 SIZE 10M,
GROUP 3 SIZE 10M
DATAFILE
'D:\oracle\product\10.2.0\oradata\baozhu\system01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\undotbs01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\sysaux01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\users01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\hxy01.dbf'
CHARACTER SET ZHS16GBK
;
控制文件已创建
然后把控制文件的名称等信息加载到参数文件中
SQL> select value from v$parameter where name ='control_files';
VALUE
--------------------------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\BAOZHU\CONTROLFILE\O1_MF_8MOBJW6T_.CTL
修改参数文件中控制文件中的路径!
关闭数据库,启动到mount模式,使控制文件生效
SQL> shutdown immediate
ORA-01109: ??????
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount;
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1247876 bytes
Variable Size 62915964 bytes
Database Buffers 96468992 bytes
Redo Buffers 7139328 bytes
数据库装载完毕。
8.完成,打开数据库
SQL> alter database open resetlogs;
数据库已更改。
最后别忘了在临时表空间中添加数据文件
SQL> alter tablespace temp add tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\BAOZHU
\temp01.dbf' size 10M autoextend on next 512K;
表空间已更改。
好了!!!数据库迁移完成!!!如果迁移的平台版本不一致!还需执行一些数据字典的升级等步骤!
查看一下
SQL> set line 200
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ---------------------- --------------------
----------
instance_name string
baozhu
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ---------------------- --------------------
----------
db_name string
BAOZHU
付:transport.sql
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT PFILE='/opt/oracle/product/10.2.0/dbs/init_00o436rg_1_0.ora'
CREATE CONTROLFILE REUSE SET DATABASE "BAOZHU" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 10M,
GROUP 2 SIZE 10M,
GROUP 3 SIZE 10M
DATAFILE
'D:\oracle\product\10.2.0\oradata\baozhu\system01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\undotbs01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\sysaux01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\users01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\hxy01.dbf'
CHARACTER SET ZHS16GBK
;
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/product/10.2.0/dbs/data_D-BAOZHU_I-1336191018_TS-TEMP_FNO-1_00o436rg'
SIZE 27262976 AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
set echo off
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prompt * Your database has been created successfully!
prompt * There are many things to think about for the new database. Here
prompt * is a checklist to help you stay on track:
prompt * 1. You may want to redefine the location of the directory objects.
prompt * 2. You may want to change the internal database identifier (DBID)
prompt * or the global database name for this database. Use the
prompt * NEWDBID Utility (nid).
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SHUTDOWN IMMEDIATE
STARTUP UPGRADE PFILE='/opt/oracle/product/10.2.0/dbs/init_00o436rg_1_0.ora'
@@ ?/rdbms/admin/utlirp.sql
SHUTDOWN IMMEDIATE
STARTUP PFILE='/opt/oracle/product/10.2.0/dbs/init_00o436rg_1_0.ora'
-- The following step will recompile all PL/SQL modules.
-- It may take serveral hours to complete.
@@ ?/rdbms/admin/utlrp.sql
set feedback 6;
目标平台:windos xp
1.确认平台及版本
SQL> select platform_name,endian_format from v$transportable_platform;
PLATFORM_NAME ENDIAN_FORMAT
----------------------------------------------------------------------------------------------------- --------------
Solaris[tm] OE (32-bit) Big
Solaris[tm] OE (64-bit) Big
Microsoft Windows IA (32-bit) Little
Linux IA (32-bit) Little
AIX-Based Systems (64-bit) Big
HP-UX (64-bit) Big
HP Tru64 UNIX Little
HP-UX IA (64-bit) Big
Linux IA (64-bit) Little
HP Open VMS Little
Microsoft Windows IA (64-bit) Little
IBM zSeries Based Linux Big
Linux 64-bit for AMD Little
Apple Mac OS Big
Microsoft Windows 64-bit for AMD Little
Solaris Operating System (x86) Little
IBM Power Based Linux Big
17 rows selected.
可知,要迁移的平台是同自序的
查看数据库版本
在源平台上
SQL> select * from v$version where rownum<2;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
在目标平台上执行:
SQL> select * from v$version where rownum<2;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
数据库版本完全一致
2.确认迁移是否支持
先让数据库运行在只读模式下
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 75499764 bytes
Database Buffers 88080384 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database open read only;
Database altered.
进行检测
SQL> set serveroutput on
SQL> declare
2 db_ready boolean;
3 begin
4 db_ready:=dbms_tdb.check_db('Microsoft Windows IA (32-bit)');
5 end;
6 /
PL/SQL procedure successfully completed.
如果没有提示相关的警告信息,说明数据库支持跨平台迁移
3.检查外部对象
SQL> set serveroutput on
SQL> declare
2 exteranl boolean;
3 begin
4 exteranl:=dbms_tdb.check_external;
5 end;
6 /
The following directories exist in the database:
SYS.WORK_DIR, SYS.ADMIN_DIR, SYS.DATA_PUMP_DIR
PL/SQL procedure successfully completed.
识别外部表,directories或bfiles,这些对象所指向的外部数据不能被rman自动迁移
4.使用rman进行跨平台文件迁移
[oracle@hxy ~]$ rlwrap rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sat Mar 9 10:20:49 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1336191018)
RMAN> convert database new database 'baozhu'
2> transport script '/opt/oracle/oradata/transport/tarnsport.sql'
3> to platform 'Microsoft Windows IA (32-bit)'
4> db_file_name_convert '/opt/oracle/oradata/orcl' '/opt/oracle/oradata/transport';
Starting convert at 09-MAR-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 devtype=DISK
Directory SYS.WORK_DIR found in the database
Directory SYS.ADMIN_DIR found in the database
Directory SYS.DATA_PUMP_DIR found in the database
User SYS with SYSDBA and SYSOPER privilege found in password file
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00001 name=/opt/oracle/oradata/orcl/system01.dbf
converted datafile=/opt/oracle/oradata/transport/system01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00003 name=/opt/oracle/oradata/orcl/sysaux01.dbf
converted datafile=/opt/oracle/oradata/transport/sysaux01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00002 name=/opt/oracle/oradata/orcl/undotbs01.dbf
converted datafile=/opt/oracle/oradata/transport/undotbs01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00005 name=/opt/oracle/oradata/orcl/hxy01.dbf
converted datafile=/opt/oracle/oradata/transport/hxy01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile conversion
input datafile fno=00004 name=/opt/oracle/oradata/orcl/users01.dbf
converted datafile=/opt/oracle/oradata/transport/users01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Run SQL script /opt/oracle/oradata/transport/tarnsport.sql on the target platform to create database
Edit init.ora file /opt/oracle/product/10.2.0/dbs/init_00o436rg_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 09-MAR-13
RMAN>
5.转移文件到目标平台
为了快速传输,我们压缩tranport文件夹
[oracle@hxy oradata]$ tar -czvf transport.tar.gz transport/
transport/
transport/tarnsport.sql
transport/system01.dbf
transport/undotbs01.dbf
transport/sysaux01.dbf
transport/hxy01.dbf
transport/users01.dbf
[oracle@hxy oradata]$ ll
total 141944
drwxr-x--- 2 oracle oinstall 4096 Mar 8 11:16 orcl
drwxr-xr-x 2 oracle oinstall 4096 Mar 9 10:35 transport
-rw-r--r-- 1 oracle oinstall 145194742 Mar 9 10:39 transport.tar.gz
把数据文件传输到目标平台,可以通过发ftp方式(把压缩的包移动到目标平台并解压)
我的解压路径为:D:\oracle\product\10.2.0\oradata\baozhu(把解压出来的数据文件拷贝到此目录下)
数据文件,控制文件,日志文件都放在这个目录下面
6.创建基础环境
首先创建相关目录
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\adump
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\bdump
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\cdump
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\dpdump
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\pfile
C:\Documents and Settings\haoxiaoyu>mkdir D:\oracle\product\10.2.0\admin\baozhu\udump
创建windows相关服务
C:\Documents and Settings\haoxiaoyu>oradim -new -sid baozhu
实例已创建。
修改参数文件(来自由rman自动生成的参数文件)
该参数文件内容如下:
分为3部分(第一部分红色为修改的部分)
# Please change the values of the following parameters:
control_files = "/opt/oracle/product/10.2.0/dbs/cf_D-BAOZHU_id-1336191018_00o436rg"
db_recovery_file_dest = "/opt/oracle/product/10.2.0/dbs/flash_recovery_area"
db_recovery_file_dest_size= 2147483648
background_dump_dest = "/opt/oracle/product/10.2.0/dbs/bdump"
user_dump_dest = "/opt/oracle/product/10.2.0/dbs/udump"
core_dump_dest = "/opt/oracle/product/10.2.0/dbs/cdump"
audit_file_dest = "/opt/oracle/product/10.2.0/dbs/adump"
db_name = "BAOZHU"
# Please review the values of the following parameters:
__shared_pool_size = 67108864
__large_pool_size = 4194304
__java_pool_size = 4194304
__streams_pool_size = 0
__db_cache_size = 88080384
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=orclXDB)"
# The values of the following parameters are from source database:
processes = 150
sga_target = 167772160
db_block_size = 8192
compatible = "10.2.0.1.0"
db_file_multiblock_read_count= 16
undo_management = "AUTO"
undo_tablespace = "UNDOTBS1"
job_queue_processes = 10
open_cursors = 300
pga_aggregate_target = 16777216
修改内容如下;
#control_files = "/opt/oracle/product/10.2.0/dbs/cf_D-BAOZHU_id-1336191018_00o436rg"
db_recovery_file_dest = "D:\oracle\product\10.2.0\flash_recovery_area"
db_recovery_file_dest_size= 2147483648
background_dump_dest = "D:\oracle\product\10.2.0\admin\baozhu\bdump"
user_dump_dest = "D:\oracle\product\10.2.0\admin\baozhu\udump"
core_dump_dest = "D:\oracle\product\10.2.0\admin\baozhu\cdump"
audit_file_dest = "D:\oracle\product\10.2.0\admin\baozhu\adump"
db_name = "BAOZHU"
重命名为:initbaozhu.ora,放在D:\oracle\product\10.2.0\db_1\database下
如采用OMF管理,暂时注释控制路径
7,迁移步骤
C:\Documents and Settings\haoxiaoyu>set ORACLE_SID=baozhu
C:\Documents and Settings\haoxiaoyu>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 3月 9 11:09:37 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
已连接到空闲例程。
SQL> startup nomount;
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1247876 bytes
Variable Size 62915964 bytes
Database Buffers 96468992 bytes
Redo Buffers 7139328 bytes
SQL>
接下来创建控制文件(可参看我们使用rman转换时生成的脚本文件transport.sql文件进行修改)
CREATE CONTROLFILE REUSE SET DATABASE "BAOZHU" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 10M,
GROUP 2 SIZE 10M,
GROUP 3 SIZE 10M
DATAFILE
'D:\oracle\product\10.2.0\oradata\baozhu\system01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\undotbs01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\sysaux01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\users01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\hxy01.dbf'
CHARACTER SET ZHS16GBK
;
控制文件已创建
然后把控制文件的名称等信息加载到参数文件中
SQL> select value from v$parameter where name ='control_files';
VALUE
--------------------------------------------------------------------------------
D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\BAOZHU\CONTROLFILE\O1_MF_8MOBJW6T_.CTL
修改参数文件中控制文件中的路径!
关闭数据库,启动到mount模式,使控制文件生效
SQL> shutdown immediate
ORA-01109: ??????
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount;
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1247876 bytes
Variable Size 62915964 bytes
Database Buffers 96468992 bytes
Redo Buffers 7139328 bytes
数据库装载完毕。
8.完成,打开数据库
SQL> alter database open resetlogs;
数据库已更改。
最后别忘了在临时表空间中添加数据文件
SQL> alter tablespace temp add tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\BAOZHU
\temp01.dbf' size 10M autoextend on next 512K;
表空间已更改。
好了!!!数据库迁移完成!!!如果迁移的平台版本不一致!还需执行一些数据字典的升级等步骤!
查看一下
SQL> set line 200
SQL> show parameter instance_name
NAME TYPE VALUE
------------------------------------ ---------------------- --------------------
----------
instance_name string
baozhu
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ---------------------- --------------------
----------
db_name string
BAOZHU
付:transport.sql
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT PFILE='/opt/oracle/product/10.2.0/dbs/init_00o436rg_1_0.ora'
CREATE CONTROLFILE REUSE SET DATABASE "BAOZHU" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 SIZE 10M,
GROUP 2 SIZE 10M,
GROUP 3 SIZE 10M
DATAFILE
'D:\oracle\product\10.2.0\oradata\baozhu\system01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\undotbs01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\sysaux01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\users01.dbf',
'D:\oracle\product\10.2.0\oradata\baozhu\hxy01.dbf'
CHARACTER SET ZHS16GBK
;
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/product/10.2.0/dbs/data_D-BAOZHU_I-1336191018_TS-TEMP_FNO-1_00o436rg'
SIZE 27262976 AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
set echo off
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prompt * Your database has been created successfully!
prompt * There are many things to think about for the new database. Here
prompt * is a checklist to help you stay on track:
prompt * 1. You may want to redefine the location of the directory objects.
prompt * 2. You may want to change the internal database identifier (DBID)
prompt * or the global database name for this database. Use the
prompt * NEWDBID Utility (nid).
prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SHUTDOWN IMMEDIATE
STARTUP UPGRADE PFILE='/opt/oracle/product/10.2.0/dbs/init_00o436rg_1_0.ora'
@@ ?/rdbms/admin/utlirp.sql
SHUTDOWN IMMEDIATE
STARTUP PFILE='/opt/oracle/product/10.2.0/dbs/init_00o436rg_1_0.ora'
-- The following step will recompile all PL/SQL modules.
-- It may take serveral hours to complete.
@@ ?/rdbms/admin/utlrp.sql
set feedback 6;
相关文章推荐
- oracle 10g 数据库迁移
- 从Sql server 2000往Oracle 10g数据库迁移遇到的问题——第一次不可抑止地想转载
- 从Sql server 2000往Oracle 10g数据库迁移遇到的问题
- 数据库迁移windows->linux ORACLE 10G
- Oracle 11g 数据库跨平台迁移
- Oracle 10g RMAN 跨平台迁移
- 从Sql server 2000 到 Oracle 10g数据库迁移数据类型转化
- 循序渐进Oracle:Oracle10g同字节序跨平台迁移
- 从Sql server 2000往Oracle 10g数据库迁移遇到的问题
- Oracle 10g RMAN 跨平台迁移
- Oracle 10g数据库迁移的经验 Windows环境
- 数据库迁移 oracle 10g -> oracle 11g (windows下)
- Oracle 10g FRA区域没有可用空间导致数据库故障一例分析
- SQL SERVER 2000/2005/2008数据库数据迁移到Oracle 10G细述
- Oracle 9i/10g/11g 数据库 升级路线图(upgrade roadmap)
- RMAN同字节序跨平台跨版本迁移数据库
- Oracle 10g数据库概述
- 阿里巴巴核心业务系统数据库平台迁移: Oracle -> MySQL 停机时间控制在10分钟之内
- oracle 单实例数据库规划参考
- windows 2003下oracle 10G数据库自动备份