首页 » ORACLE » copy 数据文件数据库移植从windows到linux

copy 数据文件数据库移植从windows到linux

今天闲来无事,做了个极其无聊的实验,把windows上的orcl数据库的数据文件(dbf)复制到linux上会不会也能用呢?我觉的工作中除了测试没人这么搞,下面把步骤分享一下,今天试了一天,一步错步步错呀!

pc1:winxp 32bit oracle10.2.0.1 dbname:orcl
pc2:rehl 5 linux 32bit oracle 10.2.0.1 dbname:orcl

————–开始—————-
1,winrar 压缩 winxp 上的所有数据文件到一个zip文件

2,copy windows zip to linux(我用samba)

3,解决
[oracle@orazhang smb]$ unzip orcl.zip /oradata/windb/
Archive: orcl.zip
caution: filename not matched: /oradata/windb/
[oracle@orazhang smb]$ unzip orcl.zip -d /oradata/windb/
Archive: orcl.zip
inflating: /oradata/windb/TBSREAD.DBF
inflating: /oradata/windb/EXAMPLE01.DBF
inflating: /oradata/windb/SYSAUX01.DBF
inflating: /oradata/windb/SYSTEM01.DBF
inflating: /oradata/windb/TBSLOGMNR.DBF
inflating: /oradata/windb/TEMP01.DBF
inflating: /oradata/windb/UNDOTBS01.DBF
inflating: /oradata/windb/USERS01.DBF

4, 创建数据文件路径与dump文件路径
mkdir 4dump path

5, create pfile

*._awr_flush_threshold_metrics=TRUE
*.audit_file_dest=’/oradata/windb/admin/adump’
*.background_dump_dest=’/oradata/windb/admin/bdump’
*.compatible=’10.2.0.1.0′
*.control_file_record_keep_time=7
*.control_files=’/oradata/windb/control01.ctl’#Restore Controlfile
*.core_dump_dest=’/oradata/windb/admin/cdump’
*.db_4k_cache_size=8388608
*.db_block_size=8192
*.db_cache_size=4194304
*.db_create_file_dest=’/u01/app/oracle/oradata’
*.db_domain=’com’
*.db_file_multiblock_read_count=16
*.db_name=’orcl’
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)’
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=186646528
*.processes=150
*.sga_target=560988160
*.undo_management=’AUTO’
*.user_dump_dest=’/oradata/windb/admin/udump’

6, starup nomount pfile=’xxx’ —上面创建的

1 CREATE CONTROLFILE reuse DATABASE “ORCL” resetlogs noarchivelog
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 (
9 ‘/oradata/windb/redo1.log’
10 ) SIZE 50M,
11 GROUP 2 (
12 ‘/oradata/windb/redo2.log’
13 ) SIZE 50M
14 DATAFILE
15 ‘/oradata/windb/SYSTEM01.DBF’,
16 ‘/oradata/windb/EXAMPLE01.DBF’,
17 ‘/oradata/windb/TBSLOGMNR.DBF’,
18 ‘/oradata/windb/SYSAUX01.DBF’,
19 ‘/oradata/windb/USERS01.DBF’,
20 ‘/oradata/windb/TBSREAD.DBF’
21* CHARACTER SET AL32UTF8

Control file created.

–没有用temp.dbf

SQL> select open_mode from v$database;

OPEN_MODE
——————–
MOUNTED

SQL> set linesize 150
SQL> l
1 CREATE CONTROLFILE reuse DATABASE “ORCL” resetlogs noarchivelog
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 (
9 ‘/oradata/windb/redo1.log’
10 ) SIZE 50M,
11 GROUP 2 (
12 ‘/oradata/windb/redo2.log’
13 ) SIZE 50M
14 DATAFILE
15 ‘/oradata/windb/SYSTEM01.DBF’,
16 ‘/oradata/windb/EXAMPLE01.DBF’,
17 ‘/oradata/windb/TBSLOGMNR.DBF’,
18 ‘/oradata/windb/SYSAUX01.DBF’,
19 ‘/oradata/windb/USERS01.DBF’,
20 ‘/oradata/windb/TBSREAD.DBF’,
21 ‘/oradata/windb/UNDOTBS01.DBF’
22* CHARACTER SET AL32UTF8
SQL> show parameter undo

NAME TYPE VALUE
———————————— ———————- ——————————
undo_management string AUTO
undo_retention integer 900
undo_tablespace string
SQL> alter database open resetlogs upgrade;

Database altered.

SQL> @?/rdbms/admin/utlip.sql

4016 rows updated.

Commit complete.

2 rows updated.

Commit complete.

36 rows updated.

Commit complete.

System altered.

create or replace
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-00942: table or view does not exist

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

sql>@?/rdbms/admin/catupgrd.sql
…….

CREATE OR REPLACE FUNCTION version_script
*
ERROR at line 1:
ORA-04020: deadlock detected while trying to lock object SYS.DBMS_STANDARD

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options

sql>@?/rdbms/admin/utlip.sql

…………….

PL/SQL procedure successfully completed.

Commit complete.

System altered.

sql>@?/rdbms/admin/catupgrd.sql
–开始漫长的等待…

最后报了一些错 ,不管它

sql>shutdown immediate

SQL> startup pfile=’/oradata/win.tmp’;
ORACLE instance started.

Total System Global Area 562036736 bytes
Fixed Size 1220556 bytes
Variable Size 155189300 bytes
Database Buffers 398458880 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.

SQL> conn zhang/zhang
Connected.
SQL> select * from tab;

TNAME TABTYPE CLUSTERID
—————————— ——- ———-
TEST TABLE
TEST_P TABLE
TESTNULL TABLE
TLOG TABLE
TLOGMNR TABLE
TESTINDEX TABLE

6 rows selected.

—对象都在
————————end————

步骤顺序非常 非常重要,错一步我就rm所有的文件重建,稳定否?天知道,我比懒,同事把以下几种都做了

win32 oracle10201 ==> linux32 oracle10204
win32 oracle10201 ==> linux64 oracle10204
win64 oracle10201 ==> linux64 oracle10204
linux32 oracle10201 ==> linux32 oracle10204
linux32 oracle10201 ==> linux64 oracle10204

打赏

目前这篇文章有1条评论(Rss)评论关闭。

  1. Nicky Honaker | #1
    2011-12-21 at 16:46

    Thank you a bunch for sharing this with all people you really recognise what you’re speaking approximately! Bookmarked. Please additionally visit my web site =). We could have a hyperlink alternate arrangement between us!