Database Storage
Supporting 4-KB Sector Disks
Using 4-KB Sector Disks
Specifying the Disk Sector Size
Transporting Tablespaces
Concept:Minimum Compatibility Level
如果表空间是read-only的,在移植之前, 把表空间改成read/write方式
Transportable Tablespace Procedure
Determining The Endian Format of a Platform
select tp.dndian_format from v$transportable_platform tp, v$database d where tp.platform_name=d.platform_name;
Using the RMAN CONVERT Command
orag11gr2-APP_TEST--user1
copydb
1. 确认平台是否支持
select d.name,i.version,d.platform_name,endian_format from v$transportable_platform tp,
V$database d, v$instance i where tp.PLATFORM_name=d.PLATFORM_NAME
2.选择自含的表空间集:
exec dbs_tt.transport_set_check('表空间名字',TRUE);
select * from transport_set_violations
3.read only tablespace
alter tablespace app_test read only;
4.导出元数据
expdp DUMPFILE=APP_TEST.dmp DIRECTORY=TEST_DIR TRANSPORT_TABLESPACES=APP_TEST
5.DBMS_TDB.CHECK_DB检查数据库状态
<img src="https://img-blog.csdn.net/20150514152212309" alt="" />
6.convert tablespace 在rman里执行
CONVERT TABLESPACE app_test TO PLATFORM 'Linux IA(32-bit)' db_file_name_convert '/xxxx/xxx','/xxxx/xx'
7.ftp 拷贝 目的 ,元素据文件
metadata, datafile
目标数据库:
create user user1 identified by user1;
create DIRECTORY test_dir as '/xxx/xxx/xxx/bak'
grant connect, resource to user1;
8.导入元数据
impdp dumpfile=APP_TEST.DMP directory=test_dir transport_datafile='/xxx/xxx/xxx/targedir/app_test01.dbf'
alter tablespace app_test read write;
alter user user1 default tablespace app_test;
conn user1/user1
select * from tab;
select segment_name ,tablespace_name from user_segments;
Transporting Database
Database Transportation Procedure: Source System Conversion
移植前 如果表空间是readonly 方式, 先变为read-write, 然后在变成 readonly方式
Database Transportation :Consideration
1.Create the password file on the target platform
2.Transport the BFILEs used in the source database
3.The generated PFILE and transport script use OMF
4.Use DBNEWID to change the DBID
需要在目标系统创建 控制文件(源数据库通过rman 会生成脚本,需要在目标机执行), 联机重做日志, 临时性表空间
1.源数据库:
database--ora11gr2-read-only
startup mount
alter database open readonly //只读
set serveroutput on
declare
db_ready boolean;
begin
db_ready:=dbms_tdb.check_db('Linux IA(32-bit)');
end;
/
看外部表:
declare
external boolean:
begin
external:=dbms_tdb.check_external;
end;
/
登录RMAN
convert database new database 'keelodb'
transport script 'F:\app\User\oradata\bak\kelodb.sql'
to platform 'Linux IX(32-bit)'
db_file_name_convert 'F:\app\User\oradata\ora11gr' , 'F:\app\User\oradata\kelodb'
4.复制文件到目标平台
把F:\app\User\oradata\kelodb 下生成的文件复制到目标文件夹下
修改脚本文件和初始化参数文件
改参数文件的名字: INITKELODB.ORA (rman转换过程中会提示 这个文件生成在哪里)
修改 INITKELODB.ORA, 可以修改控制文件的路径
F:\app\User\oradata\bak\kelodb.sql 改一下这个脚本,比如所日志文件的目录
到目标机器上:
set ORACLE_SID=kelodb
oradim.exe-new -sid kelod -startmode manual -spfile windows平台下 还需要这个命令
startup nomount;
创建数据库和控制文件: 用 F:\app\User\oradata\bak\kelodb.sql 里的SQL 建库
alter database open resetlogs
这里创建联机重做日志
alter tablespace temp add tempfile='F;\app\User\oradata\kelodb\temp1.dbf' size 20M
shutdown immediate
startup upgrage(参照kelodb.sql)
运行脚本编译对象:
@F:\app\User\product\11.2.0\dbhome_1\RDBMS\ADMIN\utlrp.sql
shutdown immediate;
startup
@F:\app\User\product\11.2.0\dbhome_1\RDBMS\ADMIN\utlrp.sql //再运行
select * from all_user;
select name from v$datebase;