下面文件raw_convert_fs.sql 中记录的是一个raw db到file系统db的大致过程!
[oracle@xys orcl]$ more raw_convert_fs.sql
SQL> !
SQL> @ dbf.sql
FILE_NAME BYTES TABLESPACE BLOCKS BYTES+BYTES/BLOCKS
---------------- ---------- ---------- ---------- ------------------
/dev/raw/raw1 314572800 SYSTEM 38400 314580992
/dev/raw/raw3 157286400 UNDOTBS1 19200 157294592
/dev/raw/raw2 125829120 SYSAUX 15360 125837312
/dev/raw/raw6 5242880 USERS 640 5251072
/dev/raw/raw14 5242880 TRANS 640 5251072
SQL> ! dd if=/dev/raw/raw14 of=trans.dbf bs=8k count=641
SQL> !
SQL> spool raw_convert_fs.sql append
SQL> ! dd if=/dev/raw/raw6 of=users01.dbf bs=8k count=641
SQL> ! dd if=/dev/raw/raw2 of=sysaux01.dbf bs=8k count=15361
SQL> @ dbf.sql
FILE_NAME BYTES TABLESPACE BLOCKS BYTES+BYTES/BLOCKS
---------------- ---------- ---------- ---------- ------------------
/dev/raw/raw1 314572800 SYSTEM 38400 314580992
/dev/raw/raw3 157286400 UNDOTBS1 19200 157294592
/dev/raw/raw2 125829120 SYSAUX 15360 125837312
/dev/raw/raw6 5242880 USERS 640 5251072
/dev/raw/raw14 5242880 TRANS 640 5251072
SQL> ! dd if=/dev/raw/raw3 of=undotbs01.dbf bs=8k count=19201
SQL> ! dd if=/dev/raw/raw1 of=system01.dbf bs=8k count=38401
SQL> desc v$controlfile;
Name Null? Type
----------------------------------------- -------- ----------------------------
STATUS VARCHAR2(7)
NAME VARCHAR2(513)
IS_RECOVERY_DEST_FILE VARCHAR2(3)
BLOCK_SIZE NUMBER
FILE_SIZE_BLKS NUMBER
SQL> select name , block_size , file_size_blks from v$controlfile;
NAME
--------------------------------------------------------------------------------
BLOCK_SIZE FILE_SIZE_BLKS
---------- --------------
/dev/raw/raw7
16384 430
/dev/raw/raw8
16384 430
SQL> col name format a20
SQL> select name , block_size , file_size_blks from v$controlfile;
NAME BLOCK_SIZE FILE_SIZE_BLKS
-------------------- ---------- --------------
/dev/raw/raw7 16384 430
/dev/raw/raw8 16384 430
SQL> ! dd if=/dev/raw/raw7 of=control01.ctl bs=16k count=430
SQL> ! dd if=/dev/raw/raw8 of=control02.ctl bs=16k count=430
SQL> host pwd
SQL> host pwd ls -l
SQL> host ls -l
SQL> desc v$logfile;
Name Null? Type
----------------------------------------- -------- ----------------------------
GROUP# NUMBER
STATUS VARCHAR2(7)
TYPE VARCHAR2(7)
MEMBER VARCHAR2(513)
IS_RECOVERY_DEST_FILE VARCHAR2(3)
SQL> col member format a20
SQL> select member , bytes/512 from v$logfile;
select member , bytes/512 from v$logfile
*
ERROR at line 1:
ORA-00904: "BYTES": invalid identifier
SQL> select member from v$logfile;
MEMBER
--------------------
/dev/raw/raw9
/dev/raw/raw10
/dev/raw/raw11
SQL> select bytes/512 from v$log;
BYTES/512
----------
20480
20480
20480
SQL> select bytes/1024/512 from v$log;
BYTES/1024/512
--------------
20
20
20
SQL> select distinct block_size from v$archived_log;
BLOCK_SIZE
----------
512
SQL> ! dd if=/dev/raw/raw9 of=redo01.log bs=512k count=20
SQL> select member from v$logfile;
MEMBER
--------------------
/dev/raw/raw9
/dev/raw/raw10
/dev/raw/raw11
SQL> ! dd if=/dev/raw/raw10 of=redo02.log bs=512k count=20
SQL> ! dd if=/dev/raw/raw11 of=redo03.log bs=512k count=20
SQL> create pfile from spfile;
File created.
--=============================
raw db下各类文件如下:
[oracle@xys orcl]$ sqlplus sys/system@test as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 2 22:40:40 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> col file_name fromat a50
SP2-0158: unknown COLUMN option "fromat"
SQL> col file_name format a50
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------
/opt/app/oracle/oradata/orcl/system01.dbf
/opt/app/oracle/oradata/orcl/undotbs01.dbf
/opt/app/oracle/oradata/orcl/sysaux01.dbf
/opt/app/oracle/oradata/orcl/users01.dbf
/opt/app/oracle/oradata/orcl/trans.dbf
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/orcl/control01.ctl
/opt/app/oracle/oradata/orcl/control02.ctl
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/orcl/redo01.log
/opt/app/oracle/oradata/orcl/redo02.log
/opt/app/oracle/oradata/orcl/redo03.log
SQL>
转化之后db_name并没有发生变化,因此要想在同一台os上启动转化后的db,需要创建bdump,cdump,udmp等各类文件以及需要编辑参数文件创建口令文件。
转换为文件系统 db各类文件如下:
SQL> connect sys/system@orcl as sysdba
Connected.
SQL> col file_name format a50
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------
/opt/app/oracle/oradata/orcl/system01.dbf
/opt/app/oracle/oradata/orcl/undotbs01.dbf
/opt/app/oracle/oradata/orcl/sysaux01.dbf
/opt/app/oracle/oradata/orcl/users01.dbf
/opt/app/oracle/oradata/orcl/trans.dbf
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/orcl/control01.ctl
/opt/app/oracle/oradata/orcl/control02.ctl
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/opt/app/oracle/oradata/orcl/redo01.log
/opt/app/oracle/oradata/orcl/redo02.log
/opt/app/oracle/oradata/orcl/redo03.log
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/19602/viewspace-1008367/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/19602/viewspace-1008367/